private void cmbPayTo_SelectedIndexChanged(object sender, EventArgs e) { Supplier MySupplier = new Supplier(); DataType.CustomerDataType _ExCustomer = new DataType.CustomerDataType(); DataType.SupplierDataType _ExSupplier = new DataType.SupplierDataType(); Customer MyCustomer = new Customer(); string PayTo = MyCommon.GetSelectedID(cmbPayFor, true); string PayToID = MyCommon.GetSelectedID(cmbPayTo, true); int CusSupID = 0; bool resp5 = int.TryParse(PayToID, out CusSupID); string respond = ""; switch (PayTo) { case "1": respond = MySupplier.GetSupplier(CusSupID, out _ExSupplier, Program.AccountStatic.LoggingAsLocal); lblAddress.Text = _ExSupplier.Address1 + " " + _ExSupplier.Address2 + " " + _ExSupplier.Address3; lblToID.Text = MyAccount.GetSupplierAccountNumber(CusSupID); txtToAccount.Text = MyAccount.GetAccountName(lblToID.Text); txtToAccount.Enabled = false; HanchyGrid.Visible = false; break; case "2": lblToID.Text = MyAccount.GetCustomerAccountNumber(CusSupID); respond = MyCustomer.GetGetExistCustomer(CusSupID, out _ExCustomer, Program.AccountStatic.LoggingAsLocal); lblAddress.Text = _ExCustomer.Address1 + " " + _ExCustomer.Address2 + " " + _ExCustomer.Address3; txtToAccount.Text = MyAccount.GetAccountName(lblToID.Text); txtToAccount.Enabled = false; HanchyGrid.Visible = false; break; case "5": lblToID.Text = ""; txtToAccount.Text = ""; txtToAccount.Enabled = true; lblAddress.Text = MyAccount.GetOtherPayeeAdd(cmbPayTo.Text); break; default: lblToID.Text = ""; txtToAccount.Text = ""; txtToAccount.Enabled = true; break; } }
public string GetGetExistCustomer(int Sysid, out DataType.CustomerDataType _ExistData, bool IsLocal) { DataService Mycommon = new DataService(IsLocal); _ExistData = new DataType.CustomerDataType(); MySqlCommand oSqlCommand = new MySqlCommand(); string sqlQuery = "Select " + "Sysid," + "Customer," + "Address1," + "Address2," + "Address3," + "TPN," + "Mobile," + "Fax," + "Email," + "CreditLimit," + "CurrentCredit," + "VatRegNumber," + "Status," + "NIC," + "Qualification," + "LastAccUser," + "LastAccDate," + "ContactPerson," + "ContactTPnumber," + "Country," + "CusID," + "Email_OrderAcn," + "Email_Invoice," + "Email_Complain," + "NeedCustomerLogo," + "CurrenyCode" + " from tblsubcontractors" + " Where 1=1 " + " and Sysid=@Sysid"; oSqlCommand.Parameters.AddWithValue("@Sysid", Sysid); DataRow r = Mycommon.GetDataRow(sqlQuery, oSqlCommand, null, "Get Exist data Customer"); if (r != null) { try { bool resp = false; _ExistData.Customer = r["Customer"].ToString(); _ExistData.Address1 = r["Address1"].ToString(); _ExistData.Address2 = r["Address2"].ToString(); _ExistData.Address3 = r["Address3"].ToString(); _ExistData.TPN = r["TPN"].ToString(); _ExistData.Mobile = r["Mobile"].ToString(); _ExistData.Fax = r["Fax"].ToString(); _ExistData.Email = r["Email"].ToString(); decimal deCreditLimit = 0; resp = decimal.TryParse(r["CreditLimit"].ToString(), out deCreditLimit); _ExistData.CreditLimit = deCreditLimit; decimal deCurrentCredit = 0; resp = decimal.TryParse(r["CurrentCredit"].ToString(), out deCurrentCredit); _ExistData.CurrentCredit = deCurrentCredit; _ExistData.VatRegNumber = r["VatRegNumber"].ToString(); int inStatus = 0; resp = int.TryParse(r["Status"].ToString(), out inStatus); _ExistData.Status = inStatus; _ExistData.NIC = r["NIC"].ToString(); _ExistData.Qualification = r["Qualification"].ToString(); _ExistData.LastAccUser = r["LastAccUser"].ToString(); DateTime dtLastAccDate = new DateTime(1900, 1, 1); resp = DateTime.TryParse(r["LastAccDate"].ToString(), out dtLastAccDate); if (resp) _ExistData.LastAccDate = dtLastAccDate; else _ExistData.LastAccDate = new DateTime(1900, 1, 1); _ExistData.ContactPerson = r["ContactPerson"].ToString(); _ExistData.ContactTPnumber = r["ContactTPnumber"].ToString(); _ExistData.Country = r["Country"].ToString(); _ExistData.CusID = r["CusID"].ToString(); _ExistData.Email_OrderAcn = r["Email_OrderAcn"].ToString(); _ExistData.Email_Invoice = r["Email_Invoice"].ToString(); _ExistData.Email_Complain = r["Email_Complain"].ToString(); int inNeedCustomerLogo = 0; resp = int.TryParse(r["NeedCustomerLogo"].ToString(), out inNeedCustomerLogo); _ExistData.NeedCustomerLogo = inNeedCustomerLogo; _ExistData.CurrenyCode = r["CurrenyCode"].ToString(); return "True"; } catch (Exception ex) { return ex.Message; } } else return "data not found "; }
private void cmbPayTo_SelectedIndexChanged(object sender, EventArgs e) { //Added by Manjula string SupName = ""; if (cmbPayTo.SelectedValue != null) { SupName = cmbPayTo.SelectedValue.ToString(); } LINKPayment objLink = new LINKPayment(); objLink.SupName = SupName; LINKPayment[] objSuppID = objService.GetCreditorFinalSupplier(objLink); if (objSuppID.Length > 0) { SuppID = objSuppID[0].SupplierID.ToString(); } BusinessLayer.Supplier.Supplier MySupplier = new BusinessLayer.Supplier.Supplier(); DataType.CustomerDataType _ExCustomer = new DataType.CustomerDataType(); DataType.SupplierDataType _ExSupplier = new DataType.SupplierDataType(); Customer MyCustomer = new Customer(); string PayTo = MyCommon.GetSelectedID(cmbPayFor, true); string PayToID = MyCommon.GetSelectedID(cmbPayTo, true); int CusSupID = 0; bool resp5 = int.TryParse(PayToID, out CusSupID); string respond = ""; switch (PayTo) { case "1": // respond = MySupplier.GetSupplier(CusSupID, out _ExSupplier, Program.AccountStatic.LoggingAsLocal); lblAddress.Text = _ExSupplier.Address1 + " " + _ExSupplier.Address2 + " " + _ExSupplier.Address3; lblToID.Text = MyAccount.GetSupplierAccountNumber(CusSupID); txtToAccount.Text = MyAccount.GetAccountName(lblToID.Text); txtToAccount.Enabled = false; HanchyGrid.Visible = false; break; case "2": lblToID.Text = MyAccount.GetCustomerAccountNumber(CusSupID); respond = MyCustomer.GetGetExistCustomer(CusSupID, out _ExCustomer, Program.AccountStatic.LoggingAsLocal); lblAddress.Text = _ExCustomer.Address1 + " " + _ExCustomer.Address2 + " " + _ExCustomer.Address3; txtToAccount.Text = MyAccount.GetAccountName(lblToID.Text); txtToAccount.Enabled = false; HanchyGrid.Visible = false; break; case "5": lblToID.Text = ""; txtToAccount.Text = ""; txtToAccount.Enabled = true; lblAddress.Text = MyAccount.GetOtherPayeeAdd(cmbPayTo.Text); break; default: lblToID.Text = ""; txtToAccount.Text = ""; txtToAccount.Enabled = true; break; } }
public string GetGetExistCustomer(int Sysid, out DataType.CustomerDataType _ExistData, bool IsLocal) { DataService Mycommon = new DataService(IsLocal); _ExistData = new DataType.CustomerDataType(); MySqlCommand oSqlCommand = new MySqlCommand(); string sqlQuery = "Select " + "Sysid," + "Customer," + "Address1," + "Address2," + "Address3," + "TPN," + "Mobile," + "Fax," + "Email," + "CreditLimit," + "CurrentCredit," + "VatRegNumber," + "Status," + "NIC," + "Qualification," + "LastAccUser," + "LastAccDate," + "ContactPerson," + "ContactTPnumber," + "Country," + "CusID," + "Email_OrderAcn," + "Email_Invoice," + "Email_Complain," + "NeedCustomerLogo," + "CurrenyCode" + " from tblsubcontractors" + " Where 1=1 " + " and Sysid=@Sysid"; oSqlCommand.Parameters.AddWithValue("@Sysid", Sysid); DataRow r = Mycommon.GetDataRow(sqlQuery, oSqlCommand, null, "Get Exist data Customer"); if (r != null) { try { bool resp = false; _ExistData.Customer = r["Customer"].ToString(); _ExistData.Address1 = r["Address1"].ToString(); _ExistData.Address2 = r["Address2"].ToString(); _ExistData.Address3 = r["Address3"].ToString(); _ExistData.TPN = r["TPN"].ToString(); _ExistData.Mobile = r["Mobile"].ToString(); _ExistData.Fax = r["Fax"].ToString(); _ExistData.Email = r["Email"].ToString(); decimal deCreditLimit = 0; resp = decimal.TryParse(r["CreditLimit"].ToString(), out deCreditLimit); _ExistData.CreditLimit = deCreditLimit; decimal deCurrentCredit = 0; resp = decimal.TryParse(r["CurrentCredit"].ToString(), out deCurrentCredit); _ExistData.CurrentCredit = deCurrentCredit; _ExistData.VatRegNumber = r["VatRegNumber"].ToString(); int inStatus = 0; resp = int.TryParse(r["Status"].ToString(), out inStatus); _ExistData.Status = inStatus; _ExistData.NIC = r["NIC"].ToString(); _ExistData.Qualification = r["Qualification"].ToString(); _ExistData.LastAccUser = r["LastAccUser"].ToString(); DateTime dtLastAccDate = new DateTime(1900, 1, 1); resp = DateTime.TryParse(r["LastAccDate"].ToString(), out dtLastAccDate); if (resp) { _ExistData.LastAccDate = dtLastAccDate; } else { _ExistData.LastAccDate = new DateTime(1900, 1, 1); } _ExistData.ContactPerson = r["ContactPerson"].ToString(); _ExistData.ContactTPnumber = r["ContactTPnumber"].ToString(); _ExistData.Country = r["Country"].ToString(); _ExistData.CusID = r["CusID"].ToString(); _ExistData.Email_OrderAcn = r["Email_OrderAcn"].ToString(); _ExistData.Email_Invoice = r["Email_Invoice"].ToString(); _ExistData.Email_Complain = r["Email_Complain"].ToString(); int inNeedCustomerLogo = 0; resp = int.TryParse(r["NeedCustomerLogo"].ToString(), out inNeedCustomerLogo); _ExistData.NeedCustomerLogo = inNeedCustomerLogo; _ExistData.CurrenyCode = r["CurrenyCode"].ToString(); return("True"); } catch (Exception ex) { return(ex.Message); } } else { return("data not found "); } }