Beispiel #1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        //Logging Start
        string Elmahid = string.Format("ElmahId: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(Elmahid, System.Reflection.MethodBase.GetCurrentMethod());
        }
        try
        {
            for (int i = 0; i < grdMakeInvoicePayment.Items.Count; i++)
            {
                CheckBox box = (CheckBox)grdMakeInvoicePayment.Items[i].FindControl("chkRemove");
                if (box.Checked)
                {
                    ArrayList arrList = new ArrayList();
                    string    id      = grdMakeInvoicePayment.Items[i].Cells[7].Text.ToString();
                    string    invid   = grdMakeInvoicePayment.Items[i].Cells[2].Text.ToString();
                    arrList.Add(id);
                    arrList.Add(invid);
                    arrList.Add(txtCompanyID.Text);
                    Employer obj = new Employer();
                    DataSet  ds  = obj.DeleteInvoicePayment(arrList);


                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0][0].ToString() != "" && ds.Tables[0].Rows[0][0].ToString() != "&nbsp;")
                        {
                            lblbal.Text = Convert.ToDecimal(ds.Tables[0].Rows[0][0].ToString()).ToString("F");
                        }
                        hdnbal.Value = ds.Tables[0].Rows[0][0].ToString();
                        this.usrMessage.PutMessage("Payment deleted successfully");
                        this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                        this.usrMessage.Show();
                    }
                    else
                    {
                        this.usrMessage.PutMessage("Error to save payment");
                        this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                        this.usrMessage.Show();
                    }
                }
            }
            BindPayment();
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(Elmahid, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + Elmahid + ".Please share with Technical support.";
            base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End

        using (Utils utility = new Utils())
        {
            utility.MethodEnd(Elmahid, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }