public long Insert(SODetails Details) { try { ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ARLinkConfigDetails clsARLinkConfigDetails = clsERPConfig.ARLinkDetails(); string SQL = "INSERT INTO tblSO (" + "SONo, " + "SODate, " + "CustomerID, " + "CustomerCode, " + "CustomerContact, " + "CustomerAddress, " + "CustomerTelephoneNo, " + "CustomerModeOfTerms, " + "CustomerTerms, " + "RequiredDeliveryDate, " + "BranchID, " + "SellerID, " + "SellerName, " + "Status, " + "Remarks, " + "ChartOfAccountIDARTracking, " + "ChartOfAccountIDARBills, " + "ChartOfAccountIDARFreight, " + "ChartOfAccountIDARVDeposit, " + "ChartOfAccountIDARContra, " + "ChartOfAccountIDARLatePayment" + ") VALUES (" + "@SONo, " + "@SODate, " + "@CustomerID, " + "@CustomerCode, " + "@CustomerContact, " + "@CustomerAddress, " + "@CustomerTelephoneNo, " + "@CustomerModeOfTerms, " + "@CustomerTerms, " + "@RequiredDeliveryDate, " + "@BranchID, " + "@SellerID, " + "@SellerName, " + "@Status, " + "@Remarks, " + "@ChartOfAccountIDARTracking, " + "@ChartOfAccountIDARBills, " + "@ChartOfAccountIDARFreight, " + "@ChartOfAccountIDARVDeposit, " + "@ChartOfAccountIDARContra, " + "@ChartOfAccountIDARLatePayment" + ");"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmSONo = new MySqlParameter("@SONo",MySqlDbType.String); prmSONo.Value = Details.SONo; cmd.Parameters.Add(prmSONo); MySqlParameter prmSODate = new MySqlParameter("@SODate",MySqlDbType.DateTime); prmSODate.Value = Details.SODate.ToString("yyyy-MM-dd HH:mm:ss"); cmd.Parameters.Add(prmSODate); MySqlParameter prmCustomerID = new MySqlParameter("@CustomerID",MySqlDbType.Int64); prmCustomerID.Value = Details.CustomerID; cmd.Parameters.Add(prmCustomerID); MySqlParameter prmCustomerCode = new MySqlParameter("@CustomerCode",MySqlDbType.String); prmCustomerCode.Value = Details.CustomerCode; cmd.Parameters.Add(prmCustomerCode); MySqlParameter prmCustomerContact = new MySqlParameter("@CustomerContact",MySqlDbType.String); prmCustomerContact.Value = Details.CustomerContact; cmd.Parameters.Add(prmCustomerContact); MySqlParameter prmCustomerAddress = new MySqlParameter("@CustomerAddress",MySqlDbType.String); prmCustomerAddress.Value = Details.CustomerAddress; cmd.Parameters.Add(prmCustomerAddress); MySqlParameter prmCustomerTelephoneNo = new MySqlParameter("@CustomerTelephoneNo",MySqlDbType.String); prmCustomerTelephoneNo.Value = Details.CustomerTelephoneNo; cmd.Parameters.Add(prmCustomerTelephoneNo); MySqlParameter prmCustomerModeOfTerms = new MySqlParameter("@CustomerModeOfTerms",MySqlDbType.Int16); prmCustomerModeOfTerms.Value = Details.CustomerModeOfTerms; cmd.Parameters.Add(prmCustomerModeOfTerms); MySqlParameter prmCustomerTerms = new MySqlParameter("@CustomerTerms",MySqlDbType.Int16); prmCustomerTerms.Value = Details.CustomerTerms; cmd.Parameters.Add(prmCustomerTerms); MySqlParameter prmRequiredDeliveryDate = new MySqlParameter("@RequiredDeliveryDate",MySqlDbType.DateTime); prmRequiredDeliveryDate.Value = Details.RequiredDeliveryDate.ToString("yyyy-MM-dd HH:mm:ss"); cmd.Parameters.Add(prmRequiredDeliveryDate); MySqlParameter prmBranchID = new MySqlParameter("@BranchID",MySqlDbType.Int16); prmBranchID.Value = Details.BranchID; cmd.Parameters.Add(prmBranchID); MySqlParameter prmSellerID = new MySqlParameter("@SellerID",MySqlDbType.Int64); prmSellerID.Value = Details.SellerID; cmd.Parameters.Add(prmSellerID); MySqlParameter prmSellerName = new MySqlParameter("@SellerName",MySqlDbType.String); prmSellerName.Value = Details.SellerName; cmd.Parameters.Add(prmSellerName); MySqlParameter prmStatus = new MySqlParameter("@Status",MySqlDbType.Int16); prmStatus.Value = Details.Status.ToString("d"); cmd.Parameters.Add(prmStatus); MySqlParameter prmRemarks = new MySqlParameter("@Remarks",MySqlDbType.String); prmRemarks.Value = Details.Remarks; cmd.Parameters.Add(prmRemarks); MySqlParameter prmChartOfAccountIDARTracking = new MySqlParameter("@ChartOfAccountIDARTracking",MySqlDbType.Int32); prmChartOfAccountIDARTracking.Value = clsARLinkConfigDetails.ChartOfAccountIDARTracking; cmd.Parameters.Add(prmChartOfAccountIDARTracking); MySqlParameter prmChartOfAccountIDARBills = new MySqlParameter("@ChartOfAccountIDARBills",MySqlDbType.Int32); prmChartOfAccountIDARBills.Value = clsARLinkConfigDetails.ChartOfAccountIDARBills; cmd.Parameters.Add(prmChartOfAccountIDARBills); MySqlParameter prmChartOfAccountIDARFreight = new MySqlParameter("@ChartOfAccountIDARFreight",MySqlDbType.Int32); prmChartOfAccountIDARFreight.Value = clsARLinkConfigDetails.ChartOfAccountIDARFreight; cmd.Parameters.Add(prmChartOfAccountIDARFreight); MySqlParameter prmChartOfAccountIDARVDeposit = new MySqlParameter("@ChartOfAccountIDARVDeposit",MySqlDbType.Int32); prmChartOfAccountIDARVDeposit.Value = clsARLinkConfigDetails.ChartOfAccountIDARVDeposit; cmd.Parameters.Add(prmChartOfAccountIDARVDeposit); MySqlParameter prmChartOfAccountIDARContra = new MySqlParameter("@ChartOfAccountIDARContra",MySqlDbType.Int32); prmChartOfAccountIDARContra.Value = clsARLinkConfigDetails.ChartOfAccountIDARContra; cmd.Parameters.Add(prmChartOfAccountIDARContra); MySqlParameter prmChartOfAccountIDARLatePayment = new MySqlParameter("@ChartOfAccountIDARLatePayment",MySqlDbType.Int32); prmChartOfAccountIDARLatePayment.Value = clsARLinkConfigDetails.ChartOfAccountIDARLatePayment; cmd.Parameters.Add(prmChartOfAccountIDARLatePayment); base.ExecuteNonQuery(cmd); SQL = "SELECT LAST_INSERT_ID();"; cmd.Parameters.Clear(); cmd.CommandText = SQL; string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName); base.MySqlDataAdapterFill(cmd, dt); Int64 iID = 0; foreach (System.Data.DataRow dr in dt.Rows) { iID = Int64.Parse(dr[0].ToString()); } return iID; } catch (Exception ex) { throw base.ThrowException(ex); } }
public void Update(SODetails Details) { try { ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ARLinkConfigDetails clsARLinkConfigDetails = clsERPConfig.ARLinkDetails(); string SQL = "UPDATE tblSO SET " + "SONo = @SONo, " + "SODate = @SODate, " + "CustomerID = @CustomerID, " + "CustomerCode = @CustomerCode, " + "CustomerContact = @CustomerContact, " + "CustomerAddress = @CustomerAddress, " + "CustomerTelephoneNo = @CustomerTelephoneNo, " + "CustomerModeOfTerms = @CustomerModeOfTerms, " + "CustomerTerms = @CustomerTerms, " + "RequiredDeliveryDate = @RequiredDeliveryDate, " + "BranchID = @BranchID, " + "SellerID = @SellerID, " + "SellerName = @SellerName, " + "Remarks = @Remarks, " + "ChartOfAccountIDARTracking = @ChartOfAccountIDARTracking, " + "ChartOfAccountIDARBills = @ChartOfAccountIDARBills, " + "ChartOfAccountIDARFreight = @ChartOfAccountIDARFreight, " + "ChartOfAccountIDARVDeposit = @ChartOfAccountIDARVDeposit, " + "ChartOfAccountIDARContra = @ChartOfAccountIDARContra, " + "ChartOfAccountIDARLatePayment = @ChartOfAccountIDARLatePayment " + "WHERE SOID = @SOID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmSONo = new MySqlParameter("@SONo",MySqlDbType.String); prmSONo.Value = Details.SONo; cmd.Parameters.Add(prmSONo); MySqlParameter prmSODate = new MySqlParameter("@SODate",MySqlDbType.DateTime); prmSODate.Value = Details.SODate.ToString("yyyy-MM-dd HH:mm:ss"); cmd.Parameters.Add(prmSODate); MySqlParameter prmCustomerID = new MySqlParameter("@CustomerID",MySqlDbType.Int64); prmCustomerID.Value = Details.CustomerID; cmd.Parameters.Add(prmCustomerID); MySqlParameter prmCustomerCode = new MySqlParameter("@CustomerCode",MySqlDbType.String); prmCustomerCode.Value = Details.CustomerCode; cmd.Parameters.Add(prmCustomerCode); MySqlParameter prmCustomerContact = new MySqlParameter("@CustomerContact",MySqlDbType.String); prmCustomerContact.Value = Details.CustomerContact; cmd.Parameters.Add(prmCustomerContact); MySqlParameter prmCustomerAddress = new MySqlParameter("@CustomerAddress",MySqlDbType.String); prmCustomerAddress.Value = Details.CustomerAddress; cmd.Parameters.Add(prmCustomerAddress); MySqlParameter prmCustomerTelephoneNo = new MySqlParameter("@CustomerTelephoneNo",MySqlDbType.String); prmCustomerTelephoneNo.Value = Details.CustomerTelephoneNo; cmd.Parameters.Add(prmCustomerTelephoneNo); MySqlParameter prmCustomerModeOfTerms = new MySqlParameter("@CustomerModeOfTerms",MySqlDbType.Int16); prmCustomerModeOfTerms.Value = Details.CustomerModeOfTerms; cmd.Parameters.Add(prmCustomerModeOfTerms); MySqlParameter prmCustomerTerms = new MySqlParameter("@CustomerTerms",MySqlDbType.Int16); prmCustomerTerms.Value = Details.CustomerTerms; cmd.Parameters.Add(prmCustomerTerms); MySqlParameter prmRequiredDeliveryDate = new MySqlParameter("@RequiredDeliveryDate",MySqlDbType.DateTime); prmRequiredDeliveryDate.Value = Details.RequiredDeliveryDate.ToString("yyyy-MM-dd HH:mm:ss"); cmd.Parameters.Add(prmRequiredDeliveryDate); MySqlParameter prmBranchID = new MySqlParameter("@BranchID",MySqlDbType.Int16); prmBranchID.Value = Details.BranchID; cmd.Parameters.Add(prmBranchID); MySqlParameter prmSellerID = new MySqlParameter("@SellerID",MySqlDbType.Int64); prmSellerID.Value = Details.SellerID; cmd.Parameters.Add(prmSellerID); MySqlParameter prmSellerName = new MySqlParameter("@SellerName",MySqlDbType.String); prmSellerName.Value = Details.SellerName; cmd.Parameters.Add(prmSellerName); MySqlParameter prmRemarks = new MySqlParameter("@Remarks",MySqlDbType.String); prmRemarks.Value = Details.Remarks; cmd.Parameters.Add(prmRemarks); MySqlParameter prmChartOfAccountIDARTracking = new MySqlParameter("@ChartOfAccountIDARTracking",MySqlDbType.Int32); prmChartOfAccountIDARTracking.Value = clsARLinkConfigDetails.ChartOfAccountIDARTracking; cmd.Parameters.Add(prmChartOfAccountIDARTracking); MySqlParameter prmChartOfAccountIDARBills = new MySqlParameter("@ChartOfAccountIDARBills",MySqlDbType.Int32); prmChartOfAccountIDARBills.Value = clsARLinkConfigDetails.ChartOfAccountIDARBills; cmd.Parameters.Add(prmChartOfAccountIDARBills); MySqlParameter prmChartOfAccountIDARFreight = new MySqlParameter("@ChartOfAccountIDARFreight",MySqlDbType.Int32); prmChartOfAccountIDARFreight.Value = clsARLinkConfigDetails.ChartOfAccountIDARFreight; cmd.Parameters.Add(prmChartOfAccountIDARFreight); MySqlParameter prmChartOfAccountIDARVDeposit = new MySqlParameter("@ChartOfAccountIDARVDeposit",MySqlDbType.Int32); prmChartOfAccountIDARVDeposit.Value = clsARLinkConfigDetails.ChartOfAccountIDARVDeposit; cmd.Parameters.Add(prmChartOfAccountIDARVDeposit); MySqlParameter prmChartOfAccountIDARContra = new MySqlParameter("@ChartOfAccountIDARContra",MySqlDbType.Int32); prmChartOfAccountIDARContra.Value = clsARLinkConfigDetails.ChartOfAccountIDARContra; cmd.Parameters.Add(prmChartOfAccountIDARContra); MySqlParameter prmChartOfAccountIDARLatePayment = new MySqlParameter("@ChartOfAccountIDARLatePayment",MySqlDbType.Int32); prmChartOfAccountIDARLatePayment.Value = clsARLinkConfigDetails.ChartOfAccountIDARLatePayment; cmd.Parameters.Add(prmChartOfAccountIDARLatePayment); MySqlParameter prmSOID = new MySqlParameter("@SOID",MySqlDbType.Int64); prmSOID.Value = Details.SOID; cmd.Parameters.Add(prmSOID); base.ExecuteNonQuery(cmd); } catch (Exception ex) { throw base.ThrowException(ex); } }
public long Insert(CreditMemoDetails Details) { try { ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ARLinkConfigDetails clsARLinkConfigDetails = clsERPConfig.ARLinkDetails(); string SQL = "INSERT INTO tblSOCreditMemo (" + "CNNo, " + "CNDate, " + "CustomerID, " + "CustomerCode, " + "CustomerContact, " + "CustomerAddress, " + "CustomerTelephoneNo, " + "CustomerModeOfTerms, " + "CustomerTerms, " + "RequiredPostingDate, " + "BranchID, " + "SellerID, " + "SellerName, " + "SOReturnStatus, " + "CreditMemoStatus, " + "Remarks, " + "ChartOfAccountIDARTracking, " + "ChartOfAccountIDARBills, " + "ChartOfAccountIDARFreight, " + "ChartOfAccountIDARVDeposit, " + "ChartOfAccountIDARContra, " + "ChartOfAccountIDARLatePayment" + ") VALUES (" + "@CNNo, " + "@CNDate, " + "@CustomerID, " + "@CustomerCode, " + "@CustomerContact, " + "@CustomerAddress, " + "@CustomerTelephoneNo, " + "@CustomerModeOfTerms, " + "@CustomerTerms, " + "@RequiredPostingDate, " + "@BranchID, " + "@SellerID, " + "@SellerName, " + "@SOReturnStatus, " + "@CreditMemoStatus, " + "@Remarks, " + "@ChartOfAccountIDARTracking, " + "@ChartOfAccountIDARBills, " + "@ChartOfAccountIDARFreight, " + "@ChartOfAccountIDARVDeposit, " + "@ChartOfAccountIDARContra, " + "@ChartOfAccountIDARLatePayment" + ");"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@CNNo", Details.CNNo); cmd.Parameters.AddWithValue("@CNDate", Details.CNDate.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@CustomerID", Details.CustomerID); cmd.Parameters.AddWithValue("@CustomerCode", Details.CustomerCode); cmd.Parameters.AddWithValue("@CustomerContact", Details.CustomerContact); cmd.Parameters.AddWithValue("@CustomerAddress", Details.CustomerAddress); cmd.Parameters.AddWithValue("@CustomerTelephoneNo", Details.CustomerTelephoneNo); cmd.Parameters.AddWithValue("@CustomerModeOfTerms", Details.CustomerModeOfTerms); cmd.Parameters.AddWithValue("@CustomerTerms", Details.CustomerTerms); cmd.Parameters.AddWithValue("@RequiredPostingDate", Details.RequiredPostingDate.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@BranchID", Details.BranchID); cmd.Parameters.AddWithValue("@SellerID", Details.SellerID); cmd.Parameters.AddWithValue("@SellerName", Details.SellerName); cmd.Parameters.AddWithValue("@SOReturnStatus", SOReturnStatus.Posted.ToString("d")); cmd.Parameters.AddWithValue("@CreditMemoStatus", Details.CreditMemoStatus.ToString("d")); cmd.Parameters.AddWithValue("@Remarks", Details.Remarks); cmd.Parameters.AddWithValue("@ChartOfAccountIDARTracking", clsARLinkConfigDetails.ChartOfAccountIDARTracking); cmd.Parameters.AddWithValue("@ChartOfAccountIDARBills", clsARLinkConfigDetails.ChartOfAccountIDARBills); cmd.Parameters.AddWithValue("@ChartOfAccountIDARFreight", clsARLinkConfigDetails.ChartOfAccountIDARFreight); cmd.Parameters.AddWithValue("@ChartOfAccountIDARVDeposit", clsARLinkConfigDetails.ChartOfAccountIDARVDeposit); cmd.Parameters.AddWithValue("@ChartOfAccountIDARContra", clsARLinkConfigDetails.ChartOfAccountIDARContra); cmd.Parameters.AddWithValue("@ChartOfAccountIDARLatePayment", clsARLinkConfigDetails.ChartOfAccountIDARLatePayment); base.ExecuteNonQuery(cmd); SQL = "SELECT LAST_INSERT_ID();"; cmd.Parameters.Clear(); cmd.CommandText = SQL; MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); Int64 iID = 0; while (myReader.Read()) { iID = myReader.GetInt64(0); } myReader.Close(); return(iID); } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public void Update(CreditMemoDetails Details) { try { ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ARLinkConfigDetails clsARLinkConfigDetails = clsERPConfig.ARLinkDetails(); string SQL = "UPDATE tblSOCreditMemo SET " + "CNNo = @CNNo, "+ "CNDate = @CNDate, "+ "CustomerID = @CustomerID, "+ "CustomerCode = @CustomerCode, "+ "CustomerContact = @CustomerContact, "+ "CustomerAddress = @CustomerAddress, "+ "CustomerTelephoneNo = @CustomerTelephoneNo, "+ "CustomerModeOfTerms = @CustomerModeOfTerms, "+ "CustomerTerms = @CustomerTerms, "+ "RequiredPostingDate = @RequiredPostingDate, "+ "BranchID = @BranchID, "+ "SellerID = @SellerID, "+ "SellerName = @SellerName, " + "Remarks = @Remarks, " + "ChartOfAccountIDARTracking = @ChartOfAccountIDARTracking, " + "ChartOfAccountIDARBills = @ChartOfAccountIDARBills, " + "ChartOfAccountIDARFreight = @ChartOfAccountIDARFreight, " + "ChartOfAccountIDARVDeposit = @ChartOfAccountIDARVDeposit, " + "ChartOfAccountIDARContra = @ChartOfAccountIDARContra, " + "ChartOfAccountIDARLatePayment = @ChartOfAccountIDARLatePayment " + "WHERE CreditMemoID = @CreditMemoID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@CNNo", Details.CNNo); cmd.Parameters.AddWithValue("@CNDate", Details.CNDate.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@CustomerID", Details.CustomerID); cmd.Parameters.AddWithValue("@CustomerCode", Details.CustomerCode); cmd.Parameters.AddWithValue("@CustomerContact", Details.CustomerContact); cmd.Parameters.AddWithValue("@CustomerAddress", Details.CustomerAddress); cmd.Parameters.AddWithValue("@CustomerTelephoneNo", Details.CustomerTelephoneNo); cmd.Parameters.AddWithValue("@CustomerModeOfTerms", Details.CustomerModeOfTerms); cmd.Parameters.AddWithValue("@CustomerTerms", Details.CustomerTerms); cmd.Parameters.AddWithValue("@RequiredPostingDate", Details.RequiredPostingDate.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@BranchID", Details.BranchID); cmd.Parameters.AddWithValue("@SellerID", Details.SellerID); cmd.Parameters.AddWithValue("@SellerName", Details.SellerName); cmd.Parameters.AddWithValue("@SOReturnStatus", SOReturnStatus.Posted.ToString("d")); cmd.Parameters.AddWithValue("@CreditMemoStatus", Details.CreditMemoStatus.ToString("d")); cmd.Parameters.AddWithValue("@Remarks", Details.Remarks); cmd.Parameters.AddWithValue("@ChartOfAccountIDARTracking", clsARLinkConfigDetails.ChartOfAccountIDARTracking); cmd.Parameters.AddWithValue("@ChartOfAccountIDARBills", clsARLinkConfigDetails.ChartOfAccountIDARBills); cmd.Parameters.AddWithValue("@ChartOfAccountIDARFreight", clsARLinkConfigDetails.ChartOfAccountIDARFreight); cmd.Parameters.AddWithValue("@ChartOfAccountIDARVDeposit", clsARLinkConfigDetails.ChartOfAccountIDARVDeposit); cmd.Parameters.AddWithValue("@ChartOfAccountIDARContra", clsARLinkConfigDetails.ChartOfAccountIDARContra); cmd.Parameters.AddWithValue("@ChartOfAccountIDARLatePayment", clsARLinkConfigDetails.ChartOfAccountIDARLatePayment); cmd.Parameters.AddWithValue("@CreditMemoID", Details.CreditMemoID); base.ExecuteNonQuery(cmd); } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public long Insert(SOReturnDetails Details) { try { ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ARLinkConfigDetails clsARLinkConfigDetails = clsERPConfig.ARLinkDetails(); string SQL = "INSERT INTO tblSOCreditMemo (" + "CNNo, " + "CNDate, " + "CustomerID, " + "CustomerCode, " + "CustomerContact, " + "CustomerAddress, " + "CustomerTelephoneNo, " + "CustomerModeOfTerms, " + "CustomerTerms, " + "RequiredPostingDate, " + "BranchID, " + "SellerID, " + "SellerName, " + "SOReturnStatus, " + "CreditMemoStatus, " + "Remarks, " + "ChartOfAccountIDARTracking, " + "ChartOfAccountIDARBills, " + "ChartOfAccountIDARFreight, " + "ChartOfAccountIDARVDeposit, " + "ChartOfAccountIDARContra, " + "ChartOfAccountIDARLatePayment" + ") VALUES (" + "@CNNo, " + "@CNDate, " + "@CustomerID, " + "@CustomerCode, " + "@CustomerContact, " + "@CustomerAddress, " + "@CustomerTelephoneNo, " + "@CustomerModeOfTerms, " + "@CustomerTerms, " + "@RequiredPostingDate, " + "@BranchID, " + "@SellerID, " + "@SellerName, " + "@SOReturnStatus, " + "@CreditMemoStatus, " + "@Remarks, " + "@ChartOfAccountIDARTracking, " + "@ChartOfAccountIDARBills, " + "@ChartOfAccountIDARFreight, " + "@ChartOfAccountIDARVDeposit, " + "@ChartOfAccountIDARContra, " + "@ChartOfAccountIDARLatePayment" + ");"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@CNNo", Details.CNNo); cmd.Parameters.AddWithValue("@CNDate", Details.CNDate.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@CustomerID", Details.CustomerID); cmd.Parameters.AddWithValue("@CustomerCode", Details.CustomerCode); cmd.Parameters.AddWithValue("@CustomerContact", Details.CustomerContact); cmd.Parameters.AddWithValue("@CustomerAddress", Details.CustomerAddress); cmd.Parameters.AddWithValue("@CustomerTelephoneNo", Details.CustomerTelephoneNo); cmd.Parameters.AddWithValue("@CustomerModeOfTerms", Details.CustomerModeOfTerms); cmd.Parameters.AddWithValue("@CustomerTerms", Details.CustomerTerms); cmd.Parameters.AddWithValue("@RequiredPostingDate", Details.RequiredPostingDate.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@BranchID", Details.BranchID); cmd.Parameters.AddWithValue("@SellerID", Details.SellerID); cmd.Parameters.AddWithValue("@SellerName", Details.SellerName); cmd.Parameters.AddWithValue("@SOReturnStatus", Details.ReturnStatus.ToString("d")); cmd.Parameters.AddWithValue("@CreditMemoStatus", CreditMemoStatus.Posted.ToString("d")); cmd.Parameters.AddWithValue("@Remarks", Details.Remarks); cmd.Parameters.AddWithValue("@ChartOfAccountIDARTracking", clsARLinkConfigDetails.ChartOfAccountIDARTracking); cmd.Parameters.AddWithValue("@ChartOfAccountIDARBills", clsARLinkConfigDetails.ChartOfAccountIDARBills); cmd.Parameters.AddWithValue("@ChartOfAccountIDARFreight", clsARLinkConfigDetails.ChartOfAccountIDARFreight); cmd.Parameters.AddWithValue("@ChartOfAccountIDARVDeposit", clsARLinkConfigDetails.ChartOfAccountIDARVDeposit); cmd.Parameters.AddWithValue("@ChartOfAccountIDARContra", clsARLinkConfigDetails.ChartOfAccountIDARContra); cmd.Parameters.AddWithValue("@ChartOfAccountIDARLatePayment", clsARLinkConfigDetails.ChartOfAccountIDARLatePayment); base.ExecuteNonQuery(cmd); SQL = "SELECT LAST_INSERT_ID();"; cmd.Parameters.Clear(); cmd.CommandText = SQL; MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); Int64 iID = 0; while (myReader.Read()) { iID = myReader.GetInt64(0); } myReader.Close(); return iID; } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public void Update(SOReturnDetails Details) { try { ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ARLinkConfigDetails clsARLinkConfigDetails = clsERPConfig.ARLinkDetails(); string SQL= "UPDATE tblSOCreditMemo SET " + "CNNo = @CNNo, " + "CNDate = @CNDate, " + "CustomerID = @CustomerID, " + "CustomerCode = @CustomerCode, " + "CustomerContact = @CustomerContact, " + "CustomerAddress = @CustomerAddress, " + "CustomerTelephoneNo = @CustomerTelephoneNo, " + "CustomerModeOfTerms = @CustomerModeOfTerms, " + "CustomerTerms = @CustomerTerms, " + "RequiredPostingDate = @RequiredPostingDate, " + "BranchID = @BranchID, " + "SellerID = @SellerID, " + "SellerName = @SellerName, " + "Remarks = @Remarks, " + "ChartOfAccountIDARTracking = @ChartOfAccountIDARTracking, " + "ChartOfAccountIDARBills = @ChartOfAccountIDARBills, " + "ChartOfAccountIDARFreight = @ChartOfAccountIDARFreight, " + "ChartOfAccountIDARVDeposit = @ChartOfAccountIDARVDeposit, " + "ChartOfAccountIDARContra = @ChartOfAccountIDARContra, " + "ChartOfAccountIDARLatePayment = @ChartOfAccountIDARLatePayment " + "WHERE CreditMemoID = @CreditMemoID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@CNNo", Details.CNNo); cmd.Parameters.AddWithValue("@CNDate", Details.CNDate.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@CustomerID", Details.CustomerID); cmd.Parameters.AddWithValue("@CustomerCode", Details.CustomerCode); cmd.Parameters.AddWithValue("@CustomerContact", Details.CustomerContact); cmd.Parameters.AddWithValue("@CustomerAddress", Details.CustomerAddress); cmd.Parameters.AddWithValue("@CustomerTelephoneNo", Details.CustomerTelephoneNo); cmd.Parameters.AddWithValue("@CustomerModeOfTerms", Details.CustomerModeOfTerms); cmd.Parameters.AddWithValue("@CustomerTerms", Details.CustomerTerms); cmd.Parameters.AddWithValue("@RequiredPostingDate", Details.RequiredPostingDate.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@BranchID", Details.BranchID); cmd.Parameters.AddWithValue("@SellerID", Details.SellerID); cmd.Parameters.AddWithValue("@SellerName", Details.SellerName); cmd.Parameters.AddWithValue("@SOReturnStatus", Details.ReturnStatus.ToString("d")); cmd.Parameters.AddWithValue("@CreditMemoStatus", CreditMemoStatus.Posted.ToString("d")); cmd.Parameters.AddWithValue("@Remarks", Details.Remarks); cmd.Parameters.AddWithValue("@ChartOfAccountIDARTracking", clsARLinkConfigDetails.ChartOfAccountIDARTracking); cmd.Parameters.AddWithValue("@ChartOfAccountIDARBills", clsARLinkConfigDetails.ChartOfAccountIDARBills); cmd.Parameters.AddWithValue("@ChartOfAccountIDARFreight", clsARLinkConfigDetails.ChartOfAccountIDARFreight); cmd.Parameters.AddWithValue("@ChartOfAccountIDARVDeposit", clsARLinkConfigDetails.ChartOfAccountIDARVDeposit); cmd.Parameters.AddWithValue("@ChartOfAccountIDARContra", clsARLinkConfigDetails.ChartOfAccountIDARContra); cmd.Parameters.AddWithValue("@ChartOfAccountIDARLatePayment", clsARLinkConfigDetails.ChartOfAccountIDARLatePayment); cmd.Parameters.AddWithValue("@CreditMemoID", Details.CreditMemoID); base.ExecuteNonQuery(cmd); } catch (Exception ex) { { } throw base.ThrowException(ex); } }