|
using System;
using System.Web.Mobile;
using System.Web.UI.MobileControls;
using System.Text;
using Microsoft.VisualBasic;
namespace STL.Web.Mobile.UI
{
public partial class Loan_RepaymentCalculator : System.Web.UI.MobileControls.MobilePage
{
#region Event
protected void Page_Load(object sender, EventArgs e)
{
Initialize();
}
protected void cmdRepayment_Click(object sender, EventArgs e)
{
if (!Page.IsValid) return;
try
{
Double dblPrincipal = double.Parse(this.PrincipalAmount.Text);
Double dblApr = double.Parse(this.Rate.Text);
Double dblMonthlyInterest = (Double)(dblApr / (12 * 100));
Int64 intTermInMonths = Int64.Parse(this.Term.Text) * 12;
Double dblMonthlyPayment;
dblMonthlyPayment = Microsoft.VisualBasic.Financial.Pmt(dblMonthlyInterest, intTermInMonths, -dblPrincipal, 0, Microsoft.VisualBasic.DueDate.BegOfPeriod);
this.ActiveForm = this.frmResult;
StringBuilder sbDetailsSpec = new StringBuilder("");
sbDetailsSpec.Append(String.Format("{0} @ {1}% for {2} years <br /> Payment: ", dblPrincipal.ToString("C0"), dblApr.ToString(), this.Term.Text));
sbDetailsSpec.Append("<b>" + dblMonthlyPayment.ToString("C") + "</b>");
this.tvLoanDetails.Text = sbDetailsSpec.ToString();
}
catch
{
this.ActiveForm = frmError;
}
}
protected void cmdBack_Click(object sender, EventArgs e)
{
this.ActiveForm = this.frmInput;
}
#endregion Event
#region Method
private void Initialize()
{
this.frmInput.Title = UIConstant.TITLE_BAR;
this.frmResult.Title = UIConstant.TITLE_BAR;
this.frmError.Title = UIConstant.TITLE_BAR;
this.lblHeading.Text = UIConstant.PAGE_TITLE;
this.lblHeadingResult.Text = UIConstant.PAGE_TITLE;
this.lblHeadingError.Text = UIConstant.PAGE_TITLE;
}
#endregion Method
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.