public void Post(long PaymentID, DateTime PostingDate) { try { string SQL = "UPDATE tblPayment SET " + "PostingDate = @PostingDate, "+ "Status = @Status "+ "WHERE PaymentID = @PaymentID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmPostingDate = new MySqlParameter("@PostingDate", MySqlDbType.Date); prmPostingDate.Value = PostingDate.ToString("yyyy-MM-dd HH:mm:ss"); cmd.Parameters.Add(prmPostingDate); MySqlParameter prmStatus = new MySqlParameter("@Status", MySqlDbType.Int16); prmStatus.Value = AccountPaymentsStatus.Posted.ToString("d"); cmd.Parameters.Add(prmStatus); MySqlParameter prmPaymentID = new MySqlParameter("@PaymentID", MySqlDbType.Int64); prmPaymentID.Value = PaymentID; cmd.Parameters.Add(prmPaymentID); base.ExecuteNonQuery(cmd); PaymentsDebit clsPaymentsDebit = new PaymentsDebit(Connection, Transaction); clsPaymentsDebit.Post(PaymentID); PaymentsCredit clsPaymentsCredit = new PaymentsCredit(Connection, Transaction); clsPaymentsCredit.Post(PaymentID); } catch (Exception ex) { throw base.ThrowException(ex); } }
public void Post(long PaymentID, DateTime PostingDate) { try { string SQL = "UPDATE tblPayment SET " + "PostingDate = @PostingDate, " + "Status = @Status " + "WHERE PaymentID = @PaymentID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmPostingDate = new MySqlParameter("@PostingDate",MySqlDbType.Date); prmPostingDate.Value = PostingDate.ToString("yyyy-MM-dd HH:mm:ss"); cmd.Parameters.Add(prmPostingDate); MySqlParameter prmStatus = new MySqlParameter("@Status",MySqlDbType.Int16); prmStatus.Value = AccountPaymentsStatus.Posted.ToString("d"); cmd.Parameters.Add(prmStatus); MySqlParameter prmPaymentID = new MySqlParameter("@PaymentID",MySqlDbType.Int64); prmPaymentID.Value = PaymentID; cmd.Parameters.Add(prmPaymentID); base.ExecuteNonQuery(cmd); PaymentsDebit clsPaymentsDebit = new PaymentsDebit(Connection, Transaction); clsPaymentsDebit.Post(PaymentID); PaymentsCredit clsPaymentsCredit = new PaymentsCredit(Connection, Transaction); clsPaymentsCredit.Post(PaymentID); } catch (Exception ex) { throw base.ThrowException(ex); } }
private bool DeleteItems() { bool boRetValueDebit = false; string stIDs = ""; foreach(DataListItem item in lstPaymentsDebit.Items) { HtmlInputCheckBox chkListDebit = (HtmlInputCheckBox) item.FindControl("chkListDebit"); if (chkListDebit!=null) { if (chkListDebit.Checked == true) { stIDs += chkListDebit.Value + ","; boRetValueDebit = true; } } } if (boRetValueDebit) { PaymentsDebit clsPaymentsDebit = new PaymentsDebit(); clsPaymentsDebit.Delete( stIDs.Substring(0,stIDs.Length-1)); clsPaymentsDebit.CommitAndDispose(); } bool boRetValueCredit = false; stIDs = ""; foreach(DataListItem item in lstPaymentsCredit.Items) { HtmlInputCheckBox chkListCredit = (HtmlInputCheckBox) item.FindControl("chkListCredit"); if (chkListCredit!=null) { if (chkListCredit.Checked == true) { stIDs += chkListCredit.Value + ","; boRetValueCredit = true; } } } if (boRetValueCredit) { PaymentsCredit clsPaymentsCredit = new PaymentsCredit(); clsPaymentsCredit.Delete( stIDs.Substring(0,stIDs.Length-1)); clsPaymentsCredit.CommitAndDispose(); } bool boRetValue = false; if (boRetValueDebit) return true; if (boRetValueCredit) return true; return boRetValue; }
private void LoadItems() { long PaymentID = Convert.ToInt64(lblPaymentID.Text); DataClass clsDataClass = new DataClass(); PaymentsDebit clsPaymentsDebit = new PaymentsDebit(); lstPaymentsDebit.DataSource = clsDataClass.DataReaderToDataTable(clsPaymentsDebit.List(PaymentID, "PaymentDebitID", SortOption.Ascending)).DefaultView; lstPaymentsDebit.DataBind(); PaymentsCredit clsPaymentsCredit = new PaymentsCredit(clsPaymentsDebit.Connection, clsPaymentsDebit.Transaction); lstPaymentsCredit.DataSource = clsDataClass.DataReaderToDataTable(clsPaymentsCredit.List(PaymentID, "PaymentCreditID", SortOption.Ascending)).DefaultView; lstPaymentsCredit.DataBind(); clsPaymentsDebit.CommitAndDispose(); }
private void SaveDebit() { PaymentsDebitDetails clsDetails = new PaymentsDebitDetails(); clsDetails.PaymentID = Convert.ToInt64(lblPaymentID.Text); clsDetails.ChartOfAccountID = Convert.ToInt32(cboAccount.SelectedItem.Value); clsDetails.Amount = Convert.ToDecimal(txtAmount.Text); PaymentsDebit clsPaymentsDebit = new PaymentsDebit(); clsPaymentsDebit.Insert(clsDetails); clsPaymentsDebit.CommitAndDispose(); }