예제 #1
0
 protected void btnExpenses_Click(object sender, EventArgs e)
 {
     try
     {
         if (ddlCategory.SelectedItem.Value != "0")
         {
             DropDownList ddlPropertyName = (DropDownList)Master.FindControl("ddlProperty");
             string       PropertyName    = ddlPropertyName.SelectedItem.Text;
             string       PropertyVale    = ddlPropertyName.SelectedValue;
             if (PropertyVale != "0")
             {
                 string mobile = Session["s_MobileNo"].ToString();
                 uc.AddExpence(mobile, PropertyName, PropertyVale, ddlCategory.SelectedItem.Text, ddlCategory.SelectedItem.Value, txtAmount.Text, ddlPaidBy.SelectedItem.Text, ddlPaidBy.SelectedItem.Value,
                               txtPaidTo.Text, ddlPaymentMethod.SelectedItem.Text, txtExpenseDate.Text, txtDetails.Text);
                 string textmsg = " Expence Added Successfully";
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpopsuccess('" + textmsg + "')</script>", false);
                 ddlCategory.SelectedIndex      = 0;
                 txtAmount.Text                 = string.Empty;
                 ddlPaidBy.SelectedIndex        = 0;
                 txtPaidTo.Text                 = string.Empty;
                 ddlPaymentMethod.SelectedIndex = 0;
                 txtExpenseDate.Text            = string.Empty;
                 txtDetails.Text                = string.Empty;
                 btnExpenses.Visible            = true;
                 btnSaveChenges.Visible         = false;
             }
             else
             {
                 string errormsg = "Please Select property name";
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + errormsg + "')</script>", false);
             }
         }
         else
         {
             string errormsg = "Please Select property name";
             ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + errormsg + "')</script>", false);
         }
     }
     catch (Exception Ex)
     {
         string exrmsg = Ex.Message.ToString();
         ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + exrmsg + "')</script>", false);
     }
 }