public void AddUpdateCustomers(M_Customers _RQ) { try { if (DB_Service._dbconnection.State == ConnectionState.Closed) { DB_Service._dbconnection.Open(); } DB_Service._dbconnection.Query("splocal_AddUpdateCustomer", new { CustID = _RQ.CustID, CustName = _RQ.CustName, CustAddress = _RQ.CustAddress, CustMobile = _RQ.CustMobile, EmailID = _RQ.EmailID, CustType = _RQ.CustomerType, CreatedOn = DateTime.Now, }, commandType: CommandType.StoredProcedure); } catch (Exception ex) { throw ex; } }
private void SetValues(String sm_Customer) { try { M_CustomerDL objm_CustomerDL = new M_CustomerDL(); M_Customers objm_Customer = new M_Customers(); if (sm_Customer != "") { objm_Customer.CusID = sm_Customer; objm_Customer = objm_CustomerDL.Selectm_Customer(objm_Customer); if (objm_Customer != null) { txt_CusID.Text = objm_Customer.CusID.ToString(); //txt_Compcode.Text = objm_Customer.Compcode.ToString(); //txt_CusID.Text = objm_Customer.Locacode.ToString(); txt_CustName.Text = objm_Customer.CustName.ToString(); txt_TP.Text = objm_Customer.TP.ToString(); txt_Fax.Text = objm_Customer.Fax.ToString(); txt_Email.Text = objm_Customer.Email.ToString(); txt_Address1.Text = objm_Customer.Address1.ToString(); txt_Address2.Text = objm_Customer.Address2.ToString(); txt_Address3.Text = objm_Customer.Address3.ToString(); txt_ContactPerson.Text = objm_Customer.ContactPerson.ToString(); txt_ContactPersonNo.Text = objm_Customer.ContactPersonNo.ToString(); //txt_CurrentStatus.Text = objm_Customer.CurrentStatus.ToString(); txt_Gradex.Text = objm_Customer.Gradex.ToString(); txt_CreditLimit.Text = objm_Customer.CreditLimit.ToString(); txt_CreditPeriod.Text = objm_Customer.CreditPeriod.ToString(); txt_MaxDisc.Text = objm_Customer.MaxDisc.ToString(); txt_MinDisc.Text = objm_Customer.MinDisc.ToString(); txt_ApplyingDisc.Text = objm_Customer.ApplyingDisc.ToString(); txt_salesman.Text = objm_Customer.SalesMan; txt_AreaCode.Text = objm_Customer.Area; txt_cat.Text = objm_Customer.cat; txt_subcat.Text = objm_Customer.subcat; formMode = 0; dtx.Clear(); dataGridView2.Refresh(); M_CushasAgents req = new M_CushasAgents(); req.CustomerCode = objm_Customer.CusID.ToString(); List <M_CushasAgents> requests = new List <M_CushasAgents>(); requests = new M_CushasAgentDL().SelectM_CushasAgentMulti(req); foreach (M_CushasAgents det in requests) { commonFunctions.AddRowAgents(dtx, det.AgentCode, findExisting.FindExisitingAgent(det.AgentCode)); } } } } catch (Exception ex) { throw ex; } }
/// <summary> /// Saves a record to the M_Customers table. /// </summary> public Boolean SaveM_CustomerSP(M_Customers m_Customer, int formMode) { SqlCommand scom; bool retvalue = false; try { scom = new SqlCommand(); scom.CommandType = CommandType.StoredProcedure; scom.CommandText = "M_CustomersSave"; scom.Parameters.Add("@CusID", SqlDbType.VarChar, 20).Value = m_Customer.CusID; scom.Parameters.Add("@Compcode", SqlDbType.VarChar, 20).Value = m_Customer.Compcode; scom.Parameters.Add("@Locacode", SqlDbType.VarChar, 20).Value = m_Customer.Locacode; scom.Parameters.Add("@CustName", SqlDbType.VarChar, 50).Value = m_Customer.CustName; scom.Parameters.Add("@TP", SqlDbType.VarChar, 50).Value = m_Customer.TP; scom.Parameters.Add("@Fax", SqlDbType.VarChar, 50).Value = m_Customer.Fax; scom.Parameters.Add("@Email", SqlDbType.VarChar, 50).Value = m_Customer.Email; scom.Parameters.Add("@Address1", SqlDbType.VarChar, 50).Value = m_Customer.Address1; scom.Parameters.Add("@Address2", SqlDbType.VarChar, 50).Value = m_Customer.Address2; scom.Parameters.Add("@Address3", SqlDbType.VarChar, 50).Value = m_Customer.Address3; scom.Parameters.Add("@ContactPerson", SqlDbType.VarChar, 20).Value = m_Customer.ContactPerson; scom.Parameters.Add("@ContactPersonNo", SqlDbType.VarChar, 20).Value = m_Customer.ContactPersonNo; scom.Parameters.Add("@CurrentStatus", SqlDbType.VarChar, 10).Value = m_Customer.CurrentStatus; scom.Parameters.Add("@Gradex", SqlDbType.VarChar, 20).Value = m_Customer.Gradex; scom.Parameters.Add("@CreditLimit", SqlDbType.Decimal, 9).Value = m_Customer.CreditLimit; scom.Parameters.Add("@CreditPeriod", SqlDbType.Int, 4).Value = m_Customer.CreditPeriod; scom.Parameters.Add("@MaxDisc", SqlDbType.Decimal, 9).Value = m_Customer.MaxDisc; scom.Parameters.Add("@MinDisc", SqlDbType.Decimal, 9).Value = m_Customer.MinDisc; scom.Parameters.Add("@ApplyingDisc", SqlDbType.Decimal, 9).Value = m_Customer.ApplyingDisc; scom.Parameters.Add("@CusOpenBal", SqlDbType.Decimal, 9).Value = m_Customer.CusOpenBal; scom.Parameters.Add("@CusCurBal", SqlDbType.Decimal, 9).Value = m_Customer.CusCurBal; scom.Parameters.Add("@customerOS", SqlDbType.Decimal, 9).Value = m_Customer.customerOS; scom.Parameters.Add("@pointsEarned", SqlDbType.Decimal, 9).Value = m_Customer.pointsEarned; scom.Parameters.Add("@controlAccountCode", SqlDbType.VarChar, 15).Value = m_Customer.controlAccountCode; scom.Parameters.Add("@customerAccountCode", SqlDbType.VarChar, 15).Value = m_Customer.customerAccountCode; scom.Parameters.Add("@GLUpdate", SqlDbType.Bit, 1).Value = m_Customer.GLUpdate; scom.Parameters.Add("@triggerVal", SqlDbType.Int, 4).Value = m_Customer.triggerVal; scom.Parameters.Add("@SalesMan", SqlDbType.VarChar, 20).Value = m_Customer.SalesMan; scom.Parameters.Add("@Area", SqlDbType.VarChar, 20).Value = m_Customer.Area; scom.Parameters.Add("@cat", SqlDbType.VarChar, 20).Value = m_Customer.cat; scom.Parameters.Add("@subcat", SqlDbType.VarChar, 20).Value = m_Customer.subcat; scom.Parameters.Add("@InsMode", SqlDbType.Int).Value = formMode; // For insert scom.Parameters.Add("@RtnValue", SqlDbType.Int).Value = 0; u_DBConnection dbcon = new u_DBConnection(); retvalue = dbcon.RunQuery(scom); return(retvalue); } catch (Exception ex) { throw (ex); } }
public List <M_Customers> SelectM_CustomerMulti(string salesman) { List <M_Customers> retval = new List <M_Customers>(); try { strquery = @"SELECT * FROM dbo.M_Customers WHERE SalesMan = '" + salesman.Trim() + "'"; DataTable dtm_Customer = u_DBConnection.ReturnDataTable(strquery, CommandType.Text); foreach (DataRow drType in dtm_Customer.Rows) { if (drType != null) { M_Customers objm_Customer = new M_Customers(); objm_Customer.CusID = drType["CusID"].ToString(); objm_Customer.Compcode = drType["Compcode"].ToString(); objm_Customer.Locacode = drType["Locacode"].ToString(); objm_Customer.CustName = drType["CustName"].ToString(); objm_Customer.TP = drType["TP"].ToString(); objm_Customer.Fax = drType["Fax"].ToString(); objm_Customer.Email = drType["Email"].ToString(); objm_Customer.Address1 = drType["Address1"].ToString(); objm_Customer.Address2 = drType["Address2"].ToString(); objm_Customer.Address3 = drType["Address3"].ToString(); objm_Customer.ContactPerson = drType["ContactPerson"].ToString(); objm_Customer.ContactPersonNo = drType["ContactPersonNo"].ToString(); objm_Customer.CurrentStatus = drType["CurrentStatus"].ToString(); objm_Customer.Gradex = drType["Gradex"].ToString(); objm_Customer.CreditLimit = decimal.Parse(drType["CreditLimit"].ToString()); objm_Customer.CreditPeriod = int.Parse(drType["CreditPeriod"].ToString()); objm_Customer.MaxDisc = decimal.Parse(drType["MaxDisc"].ToString()); objm_Customer.MinDisc = decimal.Parse(drType["MinDisc"].ToString()); objm_Customer.ApplyingDisc = decimal.Parse(drType["ApplyingDisc"].ToString()); objm_Customer.CusOpenBal = decimal.Parse(drType["CusOpenBal"].ToString()); objm_Customer.CusCurBal = decimal.Parse(drType["CusCurBal"].ToString()); objm_Customer.customerOS = decimal.Parse(drType["customerOS"].ToString()); objm_Customer.pointsEarned = decimal.Parse(drType["pointsEarned"].ToString()); objm_Customer.controlAccountCode = drType["controlAccountCode"].ToString(); objm_Customer.customerAccountCode = drType["customerAccountCode"].ToString(); objm_Customer.GLUpdate = bool.Parse(drType["GLUpdate"].ToString()); objm_Customer.triggerVal = int.Parse(drType["triggerVal"].ToString()); objm_Customer.SalesMan = drType["SalesMan"].ToString(); objm_Customer.Area = drType["Area"].ToString(); objm_Customer.cat = drType["cat"].ToString(); objm_Customer.subcat = drType["subcat"].ToString(); retval.Add(objm_Customer); } } return(retval); } catch (Exception ex) { throw ex; } }
private void FillFormForEdit(M_Customers m_Customers) { if (m_Customers != null) { lblCustomerID.Text = Convert.ToString(m_Customers.CustID); txtBoxCustomersName.Text = m_Customers.CustName; txtBoxCustomerMobile.Text = m_Customers.CustMobile; txtBoxCustomerAddress.Text = m_Customers.CustAddress; txtEmail.Text = m_Customers.EmailID; BindCustomerType(); cmbCustomerType.SelectedValue = m_Customers.CustomerType; } }
public M_Customers Selectm_Customer(M_Customers objm_Customer) { try { strquery = @"SELECT * FROM dbo.M_Customers WHERE CusID = '" + objm_Customer.CusID.Trim() + "' "; DataRow drType = u_DBConnection.ReturnDataRow(strquery); if (drType != null) { objm_Customer.CusID = drType["CusID"].ToString(); objm_Customer.Compcode = drType["Compcode"].ToString(); objm_Customer.Locacode = drType["Locacode"].ToString(); objm_Customer.CustName = drType["CustName"].ToString(); objm_Customer.TP = drType["TP"].ToString(); objm_Customer.Fax = drType["Fax"].ToString(); objm_Customer.Email = drType["Email"].ToString(); objm_Customer.Address1 = drType["Address1"].ToString(); objm_Customer.Address2 = drType["Address2"].ToString(); objm_Customer.Address3 = drType["Address3"].ToString(); objm_Customer.ContactPerson = drType["ContactPerson"].ToString(); objm_Customer.ContactPersonNo = drType["ContactPersonNo"].ToString(); objm_Customer.CurrentStatus = drType["CurrentStatus"].ToString(); objm_Customer.Gradex = drType["Gradex"].ToString(); objm_Customer.CreditLimit = decimal.Parse(drType["CreditLimit"].ToString()); objm_Customer.CreditPeriod = drType["CreditPeriod"] == null ? 0: int.Parse(drType["CreditPeriod"].ToString()); objm_Customer.MaxDisc = decimal.Parse(drType["MaxDisc"].ToString()); objm_Customer.MinDisc = decimal.Parse(drType["MinDisc"].ToString()); objm_Customer.ApplyingDisc = decimal.Parse(drType["ApplyingDisc"].ToString()); objm_Customer.CusOpenBal = decimal.Parse(drType["CusOpenBal"].ToString()); objm_Customer.CusCurBal = decimal.Parse(drType["CusCurBal"].ToString()); objm_Customer.customerOS = decimal.Parse(drType["customerOS"].ToString()); objm_Customer.pointsEarned = decimal.Parse(drType["pointsEarned"].ToString()); objm_Customer.controlAccountCode = drType["controlAccountCode"].ToString(); objm_Customer.customerAccountCode = drType["customerAccountCode"].ToString(); objm_Customer.GLUpdate = bool.Parse(drType["GLUpdate"].ToString()); objm_Customer.triggerVal = int.Parse(drType["triggerVal"].ToString()); objm_Customer.SalesMan = drType["SalesMan"].ToString(); objm_Customer.Area = drType["Area"].ToString(); objm_Customer.cat = drType["cat"].ToString(); objm_Customer.subcat = drType["subcat"].ToString(); return(objm_Customer); } return(null); } catch (Exception ex) { throw ex; } }
private void LoadData() { if (dataGridView1.SelectedRows.Count > 0) { codex = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); cat = new T_OrderFormHead(); cat.DocNo = codex.Trim(); T_OrderFormHeadDL dl = new T_OrderFormHeadDL(); cat = dl.Selectt_OrderFormHead(cat); txt_DocNo.Text = cat.DocNo; txt_Locacode.Text = cat.Locacode.Trim(); txt_locationId_name.Text = findExisting.FindExisitingLoca(txt_Locacode.Text); txt_Customer.Text = cat.Customer.Trim(); txt_Customer_name.Text = findExisting.FindExisitingCUstomer(txt_Customer.Text); txt_Remarks.Text = cat.Remarks; //dte_date.Value = cat.Datex.Value; //dte_RecivedDate.Value = cat.RecivedDate.Value; txt_NetTotal.Text = cat.NetTotal.ToString(); txt_Subtotal.Text = cat.Subtotal.ToString(); txt_subtotdiscper.Text = cat.DiscountPer.ToString(); txt_TotalDisc.Text = cat.TotalDisc.ToString(); txt_subtotdisc.Text = cat.SubtotalDisc.ToString(); M_Customers cusx = new M_Customers(); cusx.CusID = cat.Customer.Trim(); cusx = new M_CustomerDL().Selectm_Customer(cusx); txt_os.Text = cusx.customerOS.ToString(); txt_creditlimit.Text = cusx.CreditLimit.ToString(); lbl_creditPeriod.Text = cusx.CreditPeriod.ToString(); dataGridView2.DataSource = T_OrderFormHeadDL.GetCreditNoteItems(cat.Customer.Trim()); dataGridView2.Columns[0].Width = 120; dataGridView2.Columns[1].Width = 120; dataGridView2.Columns[2].Width = 120; dataGridView2.Columns[3].Width = 120; dataGridView2.Refresh(); dataGridView3.DataSource = T_OrderFormHeadDL.GetInvoiceDetails(cat.Customer.Trim()); dataGridView3.Columns[0].Width = 120; dataGridView3.Columns[1].Width = 120; dataGridView3.Columns[2].Width = 120; dataGridView3.Columns[3].Width = 120; dataGridView3.Refresh(); } }
public static string FindExisitingCUstomer(string suppcode) { string str = ""; if (M_CustomerDL.ExistingM_Customer(suppcode.Trim())) { M_Customers cat = new M_Customers(); cat.CusID = suppcode.Trim(); M_CustomerDL dl = new M_CustomerDL(); cat = dl.Selectm_Customer(cat); str = cat.CustName; } else { str = "<Error!!!>"; } return(str); }
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; } }