Esempio n. 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (txt_userx.Text.Trim() == "")
            {
                errorProvider1.SetError(txt_userx, "User code cannot be a null value.");
                commonFunctions.SetMDIStatusMessage("User code cannot be a null value.", 1);
                return;
            }
            if (!U_UserxDL.ExistingU_User(txt_userx.Text.Trim()))
            {
                errorProvider1.SetError(txt_userx, "User code not exists.");
                commonFunctions.SetMDIStatusMessage("User code not exists.", 1);
                return;
            }
            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {
                    U_UserxDL.DeleteAllrights(txt_userx.Text.Trim());
                    U_UserxDL.ApplyDefaultSec(txt_userx.Text.Trim());
                    LoadDataSecdetails();
                    UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Save_Sucess, commonFunctions.Softwarename.Trim());


                    //ApplyDefaultSec
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
                }
            }
        }
Esempio n. 2
0
        private void GetData()
        {
            try
            {
                U_UserxDL bdl = new U_UserxDL();
                dataGridView1.DataSource = bdl.SelectAllu_User();

                if (dataGridView1.DataSource != null)
                {
                    dataGridView1.Columns[0].Width = 120;
                    dataGridView1.Columns[1].Width = 485;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
 private void SetValues(String sm_SalesMan)
 {
     try
     {
         U_UserxDL bdl           = new U_UserxDL();
         u_Userxcc objm_SalesMan = new u_Userxcc();
         if (sm_SalesMan != "")
         {
             objm_SalesMan.userId = sm_SalesMan;
             objm_SalesMan        = new U_UserxDL().Selectu_User(objm_SalesMan);
             if (objm_SalesMan != null)
             {
                 txt_SalesmanID.Text      = objm_SalesMan.userId.ToString();
                 txt_SalesmanName.Text    = objm_SalesMan.userName.ToString();
                 txt_TP.Text              = objm_SalesMan.TP.ToString();
                 txt_Fax.Text             = objm_SalesMan.Fax.ToString();
                 txt_Email.Text           = objm_SalesMan.Email.ToString();
                 txt_Address1.Text        = objm_SalesMan.Address1.ToString();
                 txt_Address2.Text        = objm_SalesMan.Address2.ToString();
                 txt_Address3.Text        = objm_SalesMan.Address3.ToString();
                 txt_ContactPerson.Text   = objm_SalesMan.ContactPerson.ToString();
                 txt_ContactPersonNo.Text = objm_SalesMan.ContactPersonNo.ToString();
                 txt_nic.Text             = objm_SalesMan.NICNo;
                 txt_paymeth.Text         = objm_SalesMan.Type;
                 txtusergroup.Text        = objm_SalesMan.roleId;
                 //txt_CurrentStatus.Text = objm_SalesMan.CurrentStatus.ToString();
                 //txt_Gradex.Text = objm_SalesMan.Gradex.ToString();
                 formMode = 3;
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
        private void button3_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            if (txtUCode.Text.Trim() == "")
            {
                errorProvider1.SetError(txtUCode, "User code cannot be a null value.");
                commonFunctions.SetMDIStatusMessage("User code cannot be a null value.", 1);
                return;
            }
            if (txtUCode.Text.Trim().Length < 5)
            {
                errorProvider1.SetError(txtUCode, "User code must be more than 6 charactors.");
                commonFunctions.SetMDIStatusMessage("User code must be more than 6 charactors", 1);
                return;
            }
            if (U_UserxDL.ExistingU_User(txtUserID.Text.Trim()))
            {
                errorProvider1.SetError(txtUCode, "User code already exists.");
                commonFunctions.SetMDIStatusMessage("User code already exists.", 1);
                return;
            }
            if (txtUName.Text.Trim() == "")
            {
                errorProvider1.SetError(txtUName, "User name cannot be a null value.");
                commonFunctions.SetMDIStatusMessage("User name cannot be a null value.", 1);
                return;
            }

            if (txtPw.Text == "")
            {
                errorProvider1.SetError(txtPw, "Password cannot be a null value.");
                commonFunctions.SetMDIStatusMessage("Password cannot be a null value.", 1);
                return;
            }
            if (txtPw.Text != txtRePw.Text)
            {
                errorProvider1.SetError(txtPw, "Password and the confirmation password must be same");
                commonFunctions.SetMDIStatusMessage("Password and the confirmation password must be same.", 1);
                return;
            }
            if (!U_UserRolexDL.ExistingU_UserRole(txtusergroup.Text.Trim()))
            {
                errorProvider1.SetError(txtusergroup, "User group already exists.");
                commonFunctions.SetMDIStatusMessage("User group already exists.", 1);
                return;
            }
            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {
                    //u_Userxcc obju_User = new u_Userxcc();
                    //obju_User.userId = txtUserID.Text.Trim();
                    //obju_User.userName = txtUCode.Text.Trim();
                    //obju_User.password = commonFunctions.CreateCheckPassword(true, txtPw.Text.Trim());
                    //obju_User.roleId = txtusergroup.Text.Trim();
                    //obju_User.userCreated = commonFunctions.Loginuser;
                    //obju_User.dateCreated = DateTime.Now;
                    //obju_User.userModified = "";
                    //obju_User.dateModified = DateTime.Now;
                    //obju_User.isActive = 1;
                    //obju_User.empId = "";
                    //obju_User.signOnTime = DateTime.Now;
                    //obju_User.signOnDate = DateTime.Now;
                    //obju_User.shiftNo = 1;
                    //obju_User.isSignOn = 1;
                    //obju_User.isSignOff = 1;
                    //obju_User.signOffDate = DateTime.Now;
                    //obju_User.signOffTime = DateTime.Now;
                    //obju_User.dateTimeFormat = "dd/MM/yyyy";
                    //obju_User.mobile = txtmobile.Text;
                    //obju_User.terminalID = "";
                    //obju_User.shiftOnLocation = commonFunctions.GlobalLocation;
                    //U_UserxDL bal = new U_UserxDL();
                    //bal.Saveu_UserSP(obju_User, 1);
                    UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Save_Sucess, commonFunctions.Softwarename.Trim());
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
                }
            }
        }
Esempio n. 5
0
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                if (ActiveControl.Name.Trim() == txt_SalesmanID.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["SalesmanFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["SalesmanSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["SalesmanField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                //txt_IDX.Text = commonFunctions.GetSerial("A0009");
                formMode = 1;
                txt_SalesmanID.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode = 3;
                txt_SalesmanID.Enabled = false;
                txt_SalesmanName.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Save:
                errorProvider1.Clear();
                if (txt_SalesmanID.Text.Trim().ToUpper() == "ADMIN")
                {
                    errorProvider1.SetError(txt_SalesmanID, "This user is the system administrator. you cannot change the details.");
                    commonFunctions.SetMDIStatusMessage("This user is the system administrator. you cannot change the details.", 1);
                    return;
                }

                if (txt_SalesmanID.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_SalesmanID, "User code cannot be a null value.");
                    commonFunctions.SetMDIStatusMessage("User code cannot be a null value.", 1);
                    return;
                }
                if (txt_SalesmanID.Text.Trim().Length < 5)
                {
                    errorProvider1.SetError(txt_SalesmanID, "User code must be more than 6 charactors.");
                    commonFunctions.SetMDIStatusMessage("User code must be more than 6 charactors", 1);
                    return;
                }

                if (txt_SalesmanName.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_SalesmanName, "User name cannot be a null value.");
                    commonFunctions.SetMDIStatusMessage("User name cannot be a null value.", 1);
                    return;
                }

                if (txtPw.Text == "")
                {
                    errorProvider1.SetError(txtPw, "Password cannot be a null value.");
                    commonFunctions.SetMDIStatusMessage("Password cannot be a null value.", 1);
                    return;
                }
                if (txtPw.Text != txtRePw.Text)
                {
                    errorProvider1.SetError(txtPw, "Password and the confirmation password must be same");
                    commonFunctions.SetMDIStatusMessage("Password and the confirmation password must be same.", 1);
                    return;
                }
                if (!U_UserRolexDL.ExistingU_UserRole(txtusergroup.Text.Trim()))
                {
                    errorProvider1.SetError(txtusergroup, "User group already exists.");
                    commonFunctions.SetMDIStatusMessage("User group already exists.", 1);
                    return;
                }

                if (txt_SalesmanName.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_SalesmanName, "Please enter a employee name !");
                    commonFunctions.SetMDIStatusMessage("Please enter a employee name.", 1);
                    return;
                }

                if (txt_SalesmanID.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_SalesmanID, "Please enter a employee name !");
                    commonFunctions.SetMDIStatusMessage("Please enter a employee name.", 1);
                    return;
                }

                if (formMode == 1)
                {
                    if (U_UserxDL.ExistingU_User(txt_SalesmanID.Text.Trim()))
                    {
                        errorProvider1.SetError(txt_SalesmanID, "User code already exists.");
                        commonFunctions.SetMDIStatusMessage("User code already exists.", 1);
                        return;
                    }
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        u_Userxcc obju_User = new u_Userxcc();
                        obju_User.userId          = txt_SalesmanID.Text.Trim();
                        obju_User.userName        = txt_SalesmanName.Text.Trim();
                        obju_User.password        = commonFunctions.CreateCheckPassword(true, txtPw.Text.Trim());
                        obju_User.roleId          = txtusergroup.Text.Trim();
                        obju_User.userCreated     = commonFunctions.Loginuser;
                        obju_User.dateCreated     = DateTime.Now;
                        obju_User.userModified    = "";
                        obju_User.dateModified    = DateTime.Now;
                        obju_User.isActive        = 1;
                        obju_User.Type            = txt_paymeth.Text.Trim().ToUpper();
                        obju_User.Compcode        = commonFunctions.GlobalCompany;
                        obju_User.Locacode        = commonFunctions.GlobalLocation;
                        obju_User.TP              = txt_TP.Text.Trim();
                        obju_User.Fax             = txt_Fax.Text.Trim();
                        obju_User.Email           = txt_Email.Text.Trim();
                        obju_User.Address1        = txt_Address1.Text.Trim();
                        obju_User.Address2        = txt_Address2.Text.Trim();
                        obju_User.Address3        = txt_Address3.Text.Trim();
                        obju_User.ContactPerson   = txt_ContactPerson.Text.Trim();
                        obju_User.ContactPersonNo = txt_ContactPersonNo.Text.Trim();
                        obju_User.CurrentStatus   = "Active";
                        obju_User.Gradex          = "Good";
                        obju_User.NICNo           = txt_nic.Text.Trim();
                        new U_UserxDL().Saveu_UserSP(obju_User, 1);

                        GetData();

                        txt_SalesmanID.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                    }
                }
                else if (formMode == 3)
                {
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        u_Userxcc obju_User = new u_Userxcc();
                        obju_User.userId = txt_SalesmanID.Text.Trim();
                        obju_User        = new U_UserxDL().Selectu_User(obju_User);

                        obju_User.userId          = txt_SalesmanID.Text.Trim();
                        obju_User.userName        = txt_SalesmanName.Text.Trim();
                        obju_User.password        = commonFunctions.CreateCheckPassword(true, txtPw.Text.Trim());
                        obju_User.roleId          = txtusergroup.Text.Trim();
                        obju_User.userCreated     = commonFunctions.Loginuser;
                        obju_User.dateCreated     = DateTime.Now;
                        obju_User.userModified    = "";
                        obju_User.dateModified    = DateTime.Now;
                        obju_User.isActive        = 1;
                        obju_User.Type            = txt_paymeth.Text.Trim().ToUpper();
                        obju_User.Compcode        = commonFunctions.GlobalCompany;
                        obju_User.Locacode        = commonFunctions.GlobalLocation;
                        obju_User.TP              = txt_TP.Text.Trim();
                        obju_User.Fax             = txt_Fax.Text.Trim();
                        obju_User.Email           = txt_Email.Text.Trim();
                        obju_User.Address1        = txt_Address1.Text.Trim();
                        obju_User.Address2        = txt_Address2.Text.Trim();
                        obju_User.Address3        = txt_Address3.Text.Trim();
                        obju_User.ContactPerson   = txt_ContactPerson.Text.Trim();
                        obju_User.ContactPersonNo = txt_ContactPersonNo.Text.Trim();
                        obju_User.CurrentStatus   = "Active";
                        obju_User.Gradex          = "Good";
                        obju_User.NICNo           = txt_nic.Text.Trim();
                        new U_UserxDL().Saveu_UserSP(obju_User, 3);


                        GetData();
                        txt_SalesmanID.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                    }
                }
                break;

            case xEnums.PerformanceType.Cancel:
                txt_SalesmanID.Enabled = true;
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Print:
                UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                break;
            }
        }
Esempio n. 6
0
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                if (ActiveControl.Name.Trim() == txt_CusID.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["BankFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["BankSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["BankField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                formMode               = 1;
                txt_subcat_name.Text   = "";
                txt_subcat.Text        = "";
                txt_cat_name.Text      = "";
                txt_cat.Text           = "";
                txt_salesman_name.Text = "";
                txt_salesman.Text      = "";
                txt_Areaname.Text      = "";
                txt_AreaCode.Text      = "";
                txt_ApplyingDisc.Text  = "0.00";
                txt_MinDisc.Text       = "0.00";
                txt_MaxDisc.Text       = "0.00";
                txt_CreditPeriod.Text  = "0.00";
                txt_CreditLimit.Text   = "0.00";
                txt_CusID.Text         = "";
                txt_CustName.Text      = "";
                txt_cat.Text           = "";
                txt_subcat.Text        = "";
                dtx.Clear();
                dataGridView2.Refresh();

                txt_ContactPerson.Text   = "";
                txt_ContactPersonNo.Text = "";
                txt_Fax.Text             = "";
                txt_TP.Text       = "";
                txt_Address3.Text = "";
                txt_Email.Text    = "";
                txt_Address1.Text = "";
                txt_Address2.Text = "";


                txt_CusID.Focus();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode          = 3;
                txt_CusID.Enabled = false;
                txt_CustName.Focus();
                break;

            case xEnums.PerformanceType.Save:

                try
                {
                    if (!discountHandling())
                    {
                        return;
                    }

                    if (txt_CusID.Text.Trim() == "")
                    {
                        errorProvider1.SetError(txt_CusID, "Please enter a customer code !");
                        return;
                    }

                    if (txt_CustName.Text.Trim() == "")
                    {
                        errorProvider1.SetError(txt_CustName, "Please enter a customer name !");
                        return;
                    }

                    if (formMode == 1)
                    {
                        if (M_CustomerDL.ExistingM_Customer(txt_CusID.Text.Trim()))
                        {
                            //UserDefineMessages.ShowMsg("The Customer code you have entered already exists!", UserDefineMessages.Msg_Warning);
                            errorProvider1.SetError(txt_CusID, "The Customer code you have entered already exists!");
                            return;
                        }

                        if (!M_AreaDL.ExistingM_Area(txt_AreaCode.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_AreaCode, "Area does not exists on the system ");
                            return;
                        }

                        if (!U_UserxDL.ExistingU_User(txt_salesman.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_salesman, "Salesman does not exists on the system ");
                            return;
                        }

                        if (commonFunctions.GetNoofItemsIndexBase(dataGridView2) <= 0)
                        {
                            errorProvider1.SetError(dataGridView2, "Please asign some agents to this customer.");
                            return;
                        }



                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            M_Customers objm_Customer = new M_Customers();
                            objm_Customer.CusID               = txt_CusID.Text.Trim();
                            objm_Customer.Compcode            = commonFunctions.GlobalCompany;  //txt_Compcode.Text.Trim();
                            objm_Customer.Locacode            = commonFunctions.GlobalLocation; //txt_Locacode.Text.Trim();
                            objm_Customer.CustName            = txt_CustName.Text.Trim();
                            objm_Customer.TP                  = txt_TP.Text.Trim();
                            objm_Customer.Fax                 = txt_Fax.Text.Trim();
                            objm_Customer.Email               = txt_Email.Text.Trim();
                            objm_Customer.Address1            = txt_Address1.Text.Trim();
                            objm_Customer.Address2            = txt_Address2.Text.Trim();
                            objm_Customer.Address3            = txt_Address3.Text.Trim();
                            objm_Customer.ContactPerson       = txt_ContactPerson.Text.Trim();
                            objm_Customer.ContactPersonNo     = txt_ContactPersonNo.Text.Trim();
                            objm_Customer.CurrentStatus       = "";// txt_CurrentStatus.Text.Trim();
                            objm_Customer.Gradex              = txt_Gradex.Text.Trim();
                            objm_Customer.CreditLimit         = commonFunctions.ToDecimal(txt_CreditLimit.Text.Trim());
                            objm_Customer.CreditPeriod        = int.Parse(txt_CreditPeriod.Text.Trim());
                            objm_Customer.MaxDisc             = commonFunctions.ToDecimal(txt_MaxDisc.Text.Trim());
                            objm_Customer.MinDisc             = commonFunctions.ToDecimal(txt_MinDisc.Text.Trim());
                            objm_Customer.ApplyingDisc        = commonFunctions.ToDecimal(txt_ApplyingDisc.Text.Trim());
                            objm_Customer.CusOpenBal          = decimal.Zero;
                            objm_Customer.customerOS          = decimal.Zero;
                            objm_Customer.CusCurBal           = decimal.Zero;
                            objm_Customer.pointsEarned        = decimal.Zero;
                            objm_Customer.controlAccountCode  = "";
                            objm_Customer.customerAccountCode = "";
                            objm_Customer.GLUpdate            = false;
                            objm_Customer.triggerVal          = 1;
                            objm_Customer.Area                = txt_AreaCode.Text.Trim();
                            objm_Customer.SalesMan            = txt_salesman.Text;
                            objm_Customer.cat                 = txt_cat.Text;
                            objm_Customer.subcat              = txt_subcat.Text;

                            M_CustomerDL bal = new M_CustomerDL();
                            bal.SaveM_CustomerSP(objm_Customer, 1);

                            foreach (DataGridViewRow drow in dataGridView2.Rows)
                            {
                                if (drow.Cells[0].Value.ToString().Trim() != null)
                                {
                                    M_CushasAgents objm_CushasAgent = new M_CushasAgents();
                                    objm_CushasAgent.AgentCode    = drow.Cells[0].Value.ToString();
                                    objm_CushasAgent.CustomerCode = txt_CusID.Text;
                                    objm_CushasAgent.Datex        = DateTime.Now;
                                    objm_CushasAgent.userx        = commonFunctions.Loginuser;
                                    new M_CushasAgentDL().Savem_CushasAgentSP(objm_CushasAgent, 1);
                                }
                            }



                            GetData();

                            txt_CusID.Enabled = true;
                            FunctionButtonStatus(xEnums.PerformanceType.Save);
                            commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                        }
                    }
                    else if (formMode == 3)
                    {
                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            M_Customers objm_Customer = new M_Customers();
                            objm_Customer.CusID           = txt_CusID.Text.Trim();
                            objm_Customer                 = new M_CustomerDL().Selectm_Customer(objm_Customer);
                            objm_Customer.Compcode        = commonFunctions.GlobalCompany;  //txt_Compcode.Text.Trim();
                            objm_Customer.Locacode        = commonFunctions.GlobalLocation; //txt_Locacode.Text.Trim();
                            objm_Customer.CustName        = txt_CustName.Text.Trim();
                            objm_Customer.TP              = txt_TP.Text.Trim();
                            objm_Customer.Fax             = txt_Fax.Text.Trim();
                            objm_Customer.Email           = txt_Email.Text.Trim();
                            objm_Customer.Address1        = txt_Address1.Text.Trim();
                            objm_Customer.Address2        = txt_Address2.Text.Trim();
                            objm_Customer.Address3        = txt_Address3.Text.Trim();
                            objm_Customer.ContactPerson   = txt_ContactPerson.Text.Trim();
                            objm_Customer.ContactPersonNo = txt_ContactPersonNo.Text.Trim();
                            objm_Customer.CurrentStatus   = "";  // txt_CurrentStatus.Text.Trim();
                            objm_Customer.Gradex          = txt_Gradex.Text.Trim();
                            objm_Customer.CreditLimit     = commonFunctions.ToDecimal(txt_CreditLimit.Text.Trim());
                            objm_Customer.CreditPeriod    = int.Parse(txt_CreditPeriod.Text.Trim());
                            objm_Customer.MaxDisc         = commonFunctions.ToDecimal(txt_MaxDisc.Text.Trim());
                            objm_Customer.MinDisc         = commonFunctions.ToDecimal(txt_MinDisc.Text.Trim());
                            objm_Customer.ApplyingDisc    = commonFunctions.ToDecimal(txt_ApplyingDisc.Text.Trim());
                            objm_Customer.cat             = txt_cat.Text;
                            objm_Customer.subcat          = txt_subcat.Text;
                            objm_Customer.SalesMan        = txt_salesman.Text;

                            new M_CustomerDL().SaveM_CustomerSP(objm_Customer, 3);

                            M_CushasAgents xx = new M_CushasAgents();
                            xx.CustomerCode = txt_CusID.Text.Trim();
                            List <M_CushasAgents> agents = new List <M_CushasAgents>();
                            agents = new M_CushasAgentDL().SelectM_CushasAgentMulti(xx);

                            foreach (M_CushasAgents age in agents)
                            {
                                new M_CushasAgentDL().Savem_CushasAgentSP(age, 4);
                            }

                            foreach (DataGridViewRow drow in dataGridView2.Rows)
                            {
                                if (drow.Cells[0].Value.ToString().Trim() != null)
                                {
                                    M_CushasAgents objm_CushasAgent = new M_CushasAgents();
                                    objm_CushasAgent.AgentCode    = drow.Cells[0].Value.ToString();
                                    objm_CushasAgent.CustomerCode = txt_CusID.Text;
                                    objm_CushasAgent.Datex        = DateTime.Now;
                                    objm_CushasAgent.userx        = commonFunctions.Loginuser;
                                    new M_CushasAgentDL().Savem_CushasAgentSP(objm_CushasAgent, 1);
                                }
                            }



                            GetData();
                            txt_CusID.Enabled = true;
                            FunctionButtonStatus(xEnums.PerformanceType.Save);

                            commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error on loading data", 1);
                }

                break;

            case xEnums.PerformanceType.Cancel:
                txt_CusID.Enabled = true;
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                break;

            case xEnums.PerformanceType.Print:
                if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Prnt, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                {
                    string          reporttitle = "List of All Customers".ToUpper();
                    frm_reportViwer rpt         = new frm_reportViwer();
                    rpt.MdiParent      = MDI_SMartAnything.ActiveForm;
                    rpt.FormHeadertext = reporttitle;

                    ParameterField  paramField  = new ParameterField();
                    ParameterFields paramFields = new ParameterFields();

                    paramFields = commonFunctions.AddCrystalParams(reporttitle, commonFunctions.Loginuser.ToUpper());

                    rpt_m_Customers rptBank = new rpt_m_Customers();
                    M_CustomerDL    bankdlx = new M_CustomerDL();
                    rptBank.SetDataSource(bankdlx.SelectAllm_CustomerAll());
                    rpt.RepViewer.ParameterFieldInfo = paramFields;
                    rpt.RepViewer.ReportSource       = rptBank;
                    rpt.RepViewer.Refresh();
                    rpt.Show();
                }

                break;
            }
        }