Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ApplicationResult objResults  = new ApplicationResult();
                VendorBO          objVendorBO = new VendorBO();
                VendorBL          objVendorBL = new VendorBL();

                objVendorBO.VendorName         = txtVendorName.Text;
                objVendorBO.Address            = txtAddress.Text;
                objVendorBO.TelephoneNo        = txtTelephoneNo.Text;
                objVendorBO.MobileNo           = txtMobileNo.Text;
                objVendorBO.Fax                = txtFax.Text;
                objVendorBO.EmailID            = txtEmail.Text;
                objVendorBO.TINGST             = txtTinGst.Text;
                objVendorBO.TINCST             = txtTinCst.Text;
                objVendorBO.BankName           = txtBankName.Text;
                objVendorBO.AccountNo          = txtAccountNo.Text;
                objVendorBO.AccountName        = txtAccountName.Text;
                objVendorBO.IFSCCode           = txtIFSCCode.Text;
                objVendorBO.PANNO              = txtPanNo.Text;
                objVendorBO.TaxRegNo           = txtTaxRegNo.Text;
                objVendorBO.LastModifiedDate   = DateTime.UtcNow.AddHours(5.5).ToString();
                objVendorBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                int intClear = 1;

                if (ViewState["Mode"].ToString() == "Save")
                {
                    objVendorBO.CreatedDate   = DateTime.UtcNow.AddHours(5.5).ToString();
                    objVendorBO.CreatedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                    objResults = objVendorBL.Vendor_Insert(objVendorBO);
                    if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                        intClear = 1;
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Vendor Created Successfully.');</script>");
                    }
                    else
                    {
                        intClear = 0;
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Vendor is already exist.');</script>");
                    }
                }
                else if (ViewState["Mode"].ToString() == "Edit")
                {
                    objVendorBO.VendorID = Convert.ToInt32(ViewState["VendorID"].ToString());
                    objResults           = objVendorBL.Vendor_Update(objVendorBO);
                    if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                        intClear = 1;
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Vendor updated successfully.');</script>");
                    }
                    else
                    {
                        intClear = 0;
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Unit Name is already exist.');</script>");
                    }
                }
                if (intClear == 1)
                {
                    ClearAll();
                    GridDataBind();
                }
                else
                {
                    txtVendorName.Text = "";
                }
            }
            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>");
            }
        }