Example #1
0
        protected void gvVendor_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                Controls          objControls = new Controls();
                ApplicationResult objResults  = new ApplicationResult();
                VendorBL          objVendorBL = new VendorBL();

                ViewState["VendorID"] = Convert.ToInt32(e.CommandArgument.ToString());
                if (e.CommandName.ToString() == "Edit1")
                {
                    objResults = objVendorBL.Vendor_Select(Convert.ToInt32(ViewState["VendorID"].ToString()));

                    if (objResults != null)
                    {
                        if (objResults.resultDT.Rows.Count > 0)
                        {
                            txtVendorName.Text  = objResults.resultDT.Rows[0][VendorBO.VENDOR_VENDORNAME].ToString();
                            txtAddress.Text     = objResults.resultDT.Rows[0][VendorBO.VENDOR_ADDRESS].ToString();
                            txtTelephoneNo.Text = objResults.resultDT.Rows[0][VendorBO.VENDOR_TELEPHONENO].ToString();
                            txtMobileNo.Text    = objResults.resultDT.Rows[0][VendorBO.VENDOR_MOBILENO].ToString();
                            txtFax.Text         = objResults.resultDT.Rows[0][VendorBO.VENDOR_FAX].ToString();
                            txtEmail.Text       = objResults.resultDT.Rows[0][VendorBO.VENDOR_EMAILID].ToString();
                            txtTinGst.Text      = objResults.resultDT.Rows[0][VendorBO.VENDOR_TINGST].ToString();
                            txtTinCst.Text      = objResults.resultDT.Rows[0][VendorBO.VENDOR_TINCST].ToString();
                            txtBankName.Text    = objResults.resultDT.Rows[0][VendorBO.VENDOR_BANKNAME].ToString();
                            txtAccountNo.Text   = objResults.resultDT.Rows[0][VendorBO.VENDOR_ACCOUNTNO].ToString();
                            txtAccountName.Text = objResults.resultDT.Rows[0][VendorBO.VENDOR_ACCOUNTNAME].ToString();
                            txtIFSCCode.Text    = objResults.resultDT.Rows[0][VendorBO.VENDOR_IFSCCODE].ToString();
                            txtPanNo.Text       = objResults.resultDT.Rows[0][VendorBO.VENDOR_PANNO].ToString();
                            txtTaxRegNo.Text    = objResults.resultDT.Rows[0][VendorBO.VENDOR_TAXREGNO].ToString();
                            ViewState["Mode"]   = "Edit";
                            PanelGrid_VisibilityMode(2);
                        }
                    }
                }
                else if ((e.CommandName.ToString() == "Delete1"))
                {
                    objResults = objVendorBL.Vendor_Delete(Convert.ToInt32(ViewState["VendorID"].ToString()));
                    if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                        ClearAll();
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Vendor deleted successfully.');</script>");
                        GridDataBind();
                        PanelGrid_VisibilityMode(1);
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Vendor is not deleted because it is in use.');</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }