Пример #1
0
    protected void imgBtnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            objVendor.Vendor_Code = txtVendorCode.Text.Trim();
            objVendor.Vendor_Name = txtVendorName.Text.Trim();
            objVendor.Address     = txtAddress.Text.Trim();
            objVendor.EmpCode     = Membership.GetUser().UserName.ToString();
            objVendor.ActiveFlag  = rdoStatus.SelectedValue.ToString();

            // added 4 july bhawesh
            if (ddlBranch.SelectedIndex != 0)
            {
                objVendor.Branch_ID = Convert.ToInt32(ddlBranch.SelectedValue);
            }
            else
            {
                objVendor.Branch_ID = 0;
            }
            string strMsg = objVendor.SaveData("INSERT_VENDOR");
            if (objVendor.ReturnValue == -1)
            {
                lblMessage.Text = SIMSCommonClass.getErrorWarrning(SIMSenuErrorWarrning.ErrorInStoreProc, SIMSenuMessageType.Error, false, "");
            }
            else
            {
                if (strMsg == "Exists")
                {
                    lblMessage.Text = SIMSCommonClass.getErrorWarrning(SIMSenuErrorWarrning.ActivateStatusNotChange, SIMSenuMessageType.UserMessage, false, "");
                }
                else
                {
                    lblMessage.Text = SIMSCommonClass.getErrorWarrning(SIMSenuErrorWarrning.RecordUpdated, SIMSenuMessageType.UserMessage, false, "");
                }
            }
        }

        catch (Exception ex)
        {
            //Writing Error message to File using CommonClass WriteErrorErrFile method taking arguments as URL of page
            // trace, error message
            SIMSCommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
        }
        objCommonClass.BindDataGrid(gvComm, "uspVendorMaster", true, sqlParamSrh, lblRowCount);
        ClearControls();
    }