public BasePaymentsDetails Details(Int64 BasePaymentsID) { try { string SQL = "SELECT " + "BasePaymentsID, " + "TransactionID, " + "SubTotal, " + "Discount, " + "AmountPaid, " + "Balance, " + "Change, " + "DatePaid " + "FROM tblBasePayments " + "WHERE BasePaymentsID = @BasePaymentsID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmBasePaymentsID = new MySqlParameter("@BasePaymentsID", MySqlDbType.Int16); prmBasePaymentsID.Value = BasePaymentsID; cmd.Parameters.Add(prmBasePaymentsID); MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); BasePaymentsDetails Details = new BasePaymentsDetails(); while (myReader.Read()) { Details.BasePaymentsID = BasePaymentsID; Details.TransactionID = myReader.GetInt64("TransactionID"); Details.SubTotal = myReader.GetDecimal("SubTotal"); Details.Discount = myReader.GetDecimal("Discount"); Details.AmountPaid = myReader.GetDecimal("AmountPaid"); Details.Balance = myReader.GetDecimal("Balance"); Details.Change = myReader.GetDecimal("Change"); Details.DatePaid = myReader.GetDateTime("DatePaid"); } myReader.Close(); return(Details); } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public Int64 Insert(BasePaymentsDetails Details) { try { string SQL="INSERT INTO tblBasePayments (" + "TransactionID, SubTotal, Discount, AmountPaid," + "Balance, Change, DatePaid) VALUES (" + "@TransactionID, @SubTotal, @Discount, @AmountPaid," + "@Balance, @Change, @DatePaid);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmTransactionID = new MySqlParameter("@TransactionID",MySqlDbType.Int64); prmTransactionID.Value = Details.TransactionID; cmd.Parameters.Add(prmTransactionID); MySqlParameter prmSubTotal = new MySqlParameter("@SubTotal",MySqlDbType.Decimal); prmSubTotal.Value = Details.SubTotal; cmd.Parameters.Add(prmSubTotal); MySqlParameter prmDiscount = new MySqlParameter("@Discount",MySqlDbType.Decimal); prmDiscount.Value = Details.Discount; cmd.Parameters.Add(prmDiscount); MySqlParameter prmAmountPaid = new MySqlParameter("@AmountPaid",MySqlDbType.Decimal); prmAmountPaid.Value = Details.AmountPaid; cmd.Parameters.Add(prmAmountPaid); MySqlParameter prmBalance = new MySqlParameter("@Balance",MySqlDbType.Decimal); prmBalance.Value = Details.Balance; cmd.Parameters.Add(prmBalance); MySqlParameter prmChange = new MySqlParameter("@Change",MySqlDbType.Decimal); prmChange.Value = Details.Change; cmd.Parameters.Add(prmChange); MySqlParameter prmDatePaid = new MySqlParameter("@DatePaid",MySqlDbType.DateTime); prmDatePaid.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); cmd.Parameters.Add(prmDatePaid); 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 BasePaymentsDetails Details(Int64 BasePaymentsID) { try { string SQL = "SELECT " + "BasePaymentsID, " + "TransactionID, " + "SubTotal, " + "Discount, " + "AmountPaid, " + "Balance, " + "Change, " + "DatePaid " + "FROM tblBasePayments " + "WHERE BasePaymentsID = @BasePaymentsID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmBasePaymentsID = new MySqlParameter("@BasePaymentsID",MySqlDbType.Int16); prmBasePaymentsID.Value = BasePaymentsID; cmd.Parameters.Add(prmBasePaymentsID); MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); BasePaymentsDetails Details = new BasePaymentsDetails(); while (myReader.Read()) { Details.BasePaymentsID = BasePaymentsID; Details.TransactionID = myReader.GetInt64("TransactionID"); Details.SubTotal = myReader.GetDecimal("SubTotal"); Details.Discount = myReader.GetDecimal("Discount"); Details.AmountPaid = myReader.GetDecimal("AmountPaid"); Details.Balance = myReader.GetDecimal("Balance"); Details.Change = myReader.GetDecimal("Change"); Details.DatePaid = myReader.GetDateTime("DatePaid"); } myReader.Close(); return Details; } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public void Update(BasePaymentsDetails Details) { try { string SQL= "UPDATE tblBasePayments SET " + "TransactionID = @TransactionID, " + "SubTotal = @SubTotal, "+ "Discount = @Discount, "+ "AmountPaid = @AmountPaid," + "Balance = @Balance, " + "Change = @Change, " + "DatePaid = @DatePaid " + "WHERE BasePaymentsID = @BasePaymentsID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmTransactionID = new MySqlParameter("@TransactionID",MySqlDbType.Int64); prmTransactionID.Value = Details.TransactionID; cmd.Parameters.Add(prmTransactionID); MySqlParameter prmSubTotal = new MySqlParameter("@SubTotal",MySqlDbType.Decimal); prmSubTotal.Value = Details.SubTotal; cmd.Parameters.Add(prmSubTotal); MySqlParameter prmDiscount = new MySqlParameter("@Discount",MySqlDbType.Decimal); prmDiscount.Value = Details.Discount; cmd.Parameters.Add(prmDiscount); MySqlParameter prmAmountPaid = new MySqlParameter("@AmountPaid",MySqlDbType.Decimal); prmAmountPaid.Value = Details.AmountPaid; cmd.Parameters.Add(prmAmountPaid); MySqlParameter prmBalance = new MySqlParameter("@Balance",MySqlDbType.Decimal); prmBalance.Value = Details.Balance; cmd.Parameters.Add(prmBalance); MySqlParameter prmChange = new MySqlParameter("@Change",MySqlDbType.Decimal); prmChange.Value = Details.Change; cmd.Parameters.Add(prmChange); MySqlParameter prmDatePaid = new MySqlParameter("@DatePaid",MySqlDbType.DateTime); prmDatePaid.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); cmd.Parameters.Add(prmDatePaid); MySqlParameter prmBasePaymentsID = new MySqlParameter("@BasePaymentsID",MySqlDbType.Int64); prmBasePaymentsID.Value = Details.BasePaymentsID; cmd.Parameters.Add(prmBasePaymentsID); base.ExecuteNonQuery(cmd); } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public Int64 Insert(BasePaymentsDetails Details) { try { string SQL = "INSERT INTO tblBasePayments (" + "TransactionID, SubTotal, Discount, AmountPaid," + "Balance, Change, DatePaid) VALUES (" + "@TransactionID, @SubTotal, @Discount, @AmountPaid," + "@Balance, @Change, @DatePaid);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmTransactionID = new MySqlParameter("@TransactionID", MySqlDbType.Int64); prmTransactionID.Value = Details.TransactionID; cmd.Parameters.Add(prmTransactionID); MySqlParameter prmSubTotal = new MySqlParameter("@SubTotal", MySqlDbType.Decimal); prmSubTotal.Value = Details.SubTotal; cmd.Parameters.Add(prmSubTotal); MySqlParameter prmDiscount = new MySqlParameter("@Discount", MySqlDbType.Decimal); prmDiscount.Value = Details.Discount; cmd.Parameters.Add(prmDiscount); MySqlParameter prmAmountPaid = new MySqlParameter("@AmountPaid", MySqlDbType.Decimal); prmAmountPaid.Value = Details.AmountPaid; cmd.Parameters.Add(prmAmountPaid); MySqlParameter prmBalance = new MySqlParameter("@Balance", MySqlDbType.Decimal); prmBalance.Value = Details.Balance; cmd.Parameters.Add(prmBalance); MySqlParameter prmChange = new MySqlParameter("@Change", MySqlDbType.Decimal); prmChange.Value = Details.Change; cmd.Parameters.Add(prmChange); MySqlParameter prmDatePaid = new MySqlParameter("@DatePaid", MySqlDbType.DateTime); prmDatePaid.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); cmd.Parameters.Add(prmDatePaid); 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(BasePaymentsDetails Details) { try { string SQL = "UPDATE tblBasePayments SET " + "TransactionID = @TransactionID, "+ "SubTotal = @SubTotal, "+ "Discount = @Discount, "+ "AmountPaid = @AmountPaid,"+ "Balance = @Balance, "+ "Change = @Change, "+ "DatePaid = @DatePaid "+ "WHERE BasePaymentsID = @BasePaymentsID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmTransactionID = new MySqlParameter("@TransactionID", MySqlDbType.Int64); prmTransactionID.Value = Details.TransactionID; cmd.Parameters.Add(prmTransactionID); MySqlParameter prmSubTotal = new MySqlParameter("@SubTotal", MySqlDbType.Decimal); prmSubTotal.Value = Details.SubTotal; cmd.Parameters.Add(prmSubTotal); MySqlParameter prmDiscount = new MySqlParameter("@Discount", MySqlDbType.Decimal); prmDiscount.Value = Details.Discount; cmd.Parameters.Add(prmDiscount); MySqlParameter prmAmountPaid = new MySqlParameter("@AmountPaid", MySqlDbType.Decimal); prmAmountPaid.Value = Details.AmountPaid; cmd.Parameters.Add(prmAmountPaid); MySqlParameter prmBalance = new MySqlParameter("@Balance", MySqlDbType.Decimal); prmBalance.Value = Details.Balance; cmd.Parameters.Add(prmBalance); MySqlParameter prmChange = new MySqlParameter("@Change", MySqlDbType.Decimal); prmChange.Value = Details.Change; cmd.Parameters.Add(prmChange); MySqlParameter prmDatePaid = new MySqlParameter("@DatePaid", MySqlDbType.DateTime); prmDatePaid.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); cmd.Parameters.Add(prmDatePaid); MySqlParameter prmBasePaymentsID = new MySqlParameter("@BasePaymentsID", MySqlDbType.Int64); prmBasePaymentsID.Value = Details.BasePaymentsID; cmd.Parameters.Add(prmBasePaymentsID); base.ExecuteNonQuery(cmd); } catch (Exception ex) { { } throw base.ThrowException(ex); } }