예제 #1
0
 protected void btnReciveDue_Click(object sender, EventArgs e)
 {
     try
     {
         string d_id              = Request.QueryString["d_id"].ToString();
         float  DueAmount         = float.Parse(txtDuesAmount.Text);
         float  DueRecivingAmount = float.Parse(txtRecivedAmount.Text);
         if ((txtDuesAmount.Text.Length > 0) && (txtRecivedAmount.Text.Length > 0))
         {
             if (DueAmount == DueRecivingAmount)
             {
                 uc.UpdateDuesRecived(d_id, txtDuesAmount.Text, txtRecivingDate.Text, ddlModeOfPayment.SelectedItem.Text, txtRemark.Text);
                 SendMsgToPGManager();
                 SendMsgToTenantsForDue();
                 string textmsg = " Dues Recived Successfully";
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpopsuccess('" + textmsg + "')</script>", false);
                 txtDuesAmount.Text    = string.Empty;
                 txtRemark.Text        = string.Empty;
                 txtRecivingDate.Text  = string.Empty;
                 txtRecivedAmount.Text = string.Empty;
             }
             else if (DueAmount > DueRecivingAmount)
             {
                 float remaingDue = DueAmount - DueRecivingAmount;
                 addDueForRemainingDue(remaingDue);
                 uc.UpdateDuesRecived(d_id, txtRecivedAmount.Text, txtRecivingDate.Text, ddlModeOfPayment.SelectedItem.Text, txtRemark.Text);
                 SendMsgToPGManagerRecivedDue();
                 SendMsgToTenantsForDueRecivedDue();
                 txtDuesAmount.Text    = string.Empty;
                 txtRemark.Text        = string.Empty;
                 txtRecivingDate.Text  = string.Empty;
                 txtRecivedAmount.Text = string.Empty;
                 string textmsg = " Dues Recived Successfully";
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpopsuccess('" + textmsg + "')</script>", false);
             }
             else if (DueAmount < DueRecivingAmount)
             {
                 string errormsg = "Recived Amount greater than due amount not accepted";
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + errormsg + "')</script>", false);
             }
         }
         else
         {
             string errormsg = "Please Enter Recived Amount";
             ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + errormsg + "')</script>", false);
         }
     }
     catch (Exception Ex)
     {
         string errormsg = Ex.Message.ToString();
         ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + errormsg + "')</script>", false);
     }
 }