protected void ButtonSubmit_Click(object sender, EventArgs e) { if (tenant == null) { return; } securityDeposit = new QuickPM.SecurityDeposit(tenant.TenantId); decimal checkAmount = 0m; if (Decimal.TryParse(TextBoxSecurityDepositCheckAmount.Text, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.CurrentInfo, out checkAmount)) { securityDeposit.CheckAmount = checkAmount; } else { Session["Error"] = "<font color=\"red\">" + "Please enter an amount for the security deposit check." + "</font>"; } DateTime checkDate = DateTime.Now; securityDeposit.CheckDate = checkDate; if (DateTime.TryParse(TextBoxSecurityDepositCheckDate.Text, out checkDate)) { securityDeposit.CheckDate = checkDate; } else { Session["Error"] = "<font color=\"red\">" + "Please enter a date for the security deposit check." + "</font>"; } securityDeposit.CheckNumber = TextBoxSecurityDepositCheckNumber.Text.Trim(); DateTime checkReceivedDate = DateTime.Now; securityDeposit.CheckReceivedDate = checkReceivedDate; if (DateTime.TryParse(TextBoxSecurityDepositCheckReceivedDate.Text, out checkReceivedDate)) { securityDeposit.CheckReceivedDate = checkReceivedDate; } else { Session["Error"] = "<font color=\"red\">" + "Please enter a received date for the security deposit check." + "</font>"; } decimal depositAmount = 0m; if (Decimal.TryParse(TextBoxSecurityDepositAmount.Text, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.CurrentInfo, out depositAmount)) { securityDeposit.DepositAmount = depositAmount; } else { Session["Error"] = "<font color=\"red\">" + "Please enter a security deposit amount" + "</font>"; } securityDeposit.Notes = TextBoxNotes.Text.Trim(); //securityDeposit.RefundAmount = Decimal.Parse(TextBoxRefundAmount.Text); //securityDeposit.RefundCheckNumber = TextBoxRefundCheckNumber.Text; //securityDeposit.RefundDate = DateTime.Parse(TextBoxRefundDate.Text); securityDeposit.Save(); }
protected void Page_Load(object sender, EventArgs e) { string tenantId = Request["TenantId"]; string sRefundIndex = Request["Index"]; int refundIndex = 0; if (Request["TenantId"] == null || Request["Index"] == null) { return; } if (!Int32.TryParse(sRefundIndex, out refundIndex)) { return; } QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); if (!IsPostBack) { QuickPM.SecurityDeposit secD = new QuickPM.SecurityDeposit(tenant.TenantId); TextBoxAmount.Text = secD.RefundSchedule[refundIndex].Amount.ToString("c"); TextBoxDate.Text = secD.RefundSchedule[refundIndex].Date.ToShortDateString(); } bool canWrite = tenant.ACL.CanWrite(QuickPM.Database.GetUserId()); if (!canWrite) { QuickPMWebsite.AppCode.DisableControls.DisableTextBoxControls(Page); LinkButtonFinished.Visible = false; } }
protected void LinkButtonSubmit_Click(object sender, EventArgs e) { string tenantId = Request["TenantId"]; string sRefundIndex = Request["Index"]; int refundIndex = 0; if (Request["TenantId"] == null || Request["Index"] == null) { return; } if (!Int32.TryParse(sRefundIndex, out refundIndex)) { return; } QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); QuickPM.SecurityDeposit secD = new QuickPM.SecurityDeposit(tenant.TenantId); string sAmount = TextBoxAmount.Text.Trim(); decimal amount = 0m; if(!Decimal.TryParse(sAmount, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.CurrentInfo, out amount)) { return; } DateTime date; if (!DateTime.TryParse(TextBoxDate.Text, out date)) { return; } secD.RefundSchedule[refundIndex].Amount = amount; secD.RefundSchedule[refundIndex].Date = date; secD.Save(); Response.Redirect("SecurityDeposit.aspx?tenantid=" + tenant.TenantId); }
protected void LoadTenant() { string tenantid = Request["TenantId"]; if (tenantid == null) { return; } tenantid = QuickPM.Util.FormatTenantId(tenantid); tenant = new QuickPM.Tenant(tenantid); securityDeposit = new QuickPM.SecurityDeposit(tenant.TenantId); }
protected void LoadSecurityDeposit() { if (tenant == null) { return; } securityDeposit = new QuickPM.SecurityDeposit(tenant.TenantId); if (securityDeposit == null) { return; } //TextBoxRefundAmount.Text = securityDeposit.RefundAmount.ToString("c"); //TextBoxRefundCheckNumber.Text = securityDeposit.RefundCheckNumber; //TextBoxRefundDate.Text = securityDeposit.RefundDate.ToShortDateString(); TextBoxSecurityDepositAmount.Text = securityDeposit.DepositAmount.ToString("c"); TextBoxSecurityDepositCheckAmount.Text = securityDeposit.CheckAmount.ToString("c"); TextBoxSecurityDepositCheckDate.Text = securityDeposit.CheckDate.ToShortDateString(); TextBoxSecurityDepositCheckNumber.Text = securityDeposit.CheckNumber; TextBoxSecurityDepositCheckReceivedDate.Text = securityDeposit.CheckReceivedDate.ToShortDateString(); TextBoxNotes.Text = securityDeposit.Notes; }