public ARLinkConfigDetails ARLinkDetails() { try { string SQL = "SELECT " + "ChartOfAccountIDARTracking, " + "ChartOfAccountIDARBills, " + "ChartOfAccountIDARFreight, " + "ChartOfAccountIDARVDeposit, " + "ChartOfAccountIDARContra, " + "ChartOfAccountIDARLatePayment " + "FROM tblERPConfig;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; 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); ARLinkConfigDetails Details = new ARLinkConfigDetails(); foreach (System.Data.DataRow dr in dt.Rows) { Details.ChartOfAccountIDARTracking = Int32.Parse(dr["ChartOfAccountIDARTracking"].ToString()); Details.ChartOfAccountIDARBills = Int32.Parse(dr["ChartOfAccountIDARBills"].ToString()); Details.ChartOfAccountIDARFreight = Int32.Parse(dr["ChartOfAccountIDARFreight"].ToString()); Details.ChartOfAccountIDARVDeposit = Int32.Parse(dr["ChartOfAccountIDARVDeposit"].ToString()); Details.ChartOfAccountIDARContra = Int32.Parse(dr["ChartOfAccountIDARContra"].ToString()); Details.ChartOfAccountIDARLatePayment = Int32.Parse(dr["ChartOfAccountIDARLatePayment"].ToString()); } return(Details); } catch (Exception ex) { throw base.ThrowException(ex); } }
public ARLinkConfigDetails ARLinkDetails() { try { string SQL = "SELECT " + "ChartOfAccountIDARTracking, " + "ChartOfAccountIDARBills, " + "ChartOfAccountIDARFreight, " + "ChartOfAccountIDARVDeposit, " + "ChartOfAccountIDARContra, " + "ChartOfAccountIDARLatePayment " + "FROM tblERPConfig;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; 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); ARLinkConfigDetails Details = new ARLinkConfigDetails(); foreach (System.Data.DataRow dr in dt.Rows) { Details.ChartOfAccountIDARTracking = Int32.Parse(dr["ChartOfAccountIDARTracking"].ToString()); Details.ChartOfAccountIDARBills = Int32.Parse(dr["ChartOfAccountIDARBills"].ToString()); Details.ChartOfAccountIDARFreight = Int32.Parse(dr["ChartOfAccountIDARFreight"].ToString()); Details.ChartOfAccountIDARVDeposit = Int32.Parse(dr["ChartOfAccountIDARVDeposit"].ToString()); Details.ChartOfAccountIDARContra = Int32.Parse(dr["ChartOfAccountIDARContra"].ToString()); Details.ChartOfAccountIDARLatePayment = Int32.Parse(dr["ChartOfAccountIDARLatePayment"].ToString()); } return Details; } 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); } }