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 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();
    }