Esempio n. 1
0
        public void UpdateCredit(long pvtlngContactID, long pvtlngTransactionID, string pvtstrTransactionNo, decimal pvtdecAmountPaid, string pvtstrRemarks)
		{
			try 
			{
                string SQL = "CALL procCreditCreditPaymentUpdateCredit(@TransactionID, @TransactionNo, @Amount, @Remarks);";
				  
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
                cmd.Parameters.AddWithValue("@TransactionID", pvtlngTransactionID);
                cmd.Parameters.AddWithValue("@TransactionNo", pvtstrTransactionNo);
                cmd.Parameters.AddWithValue("@Amount", pvtdecAmountPaid);
                cmd.Parameters.AddWithValue("@Remarks", pvtstrRemarks);

				base.ExecuteNonQuery(cmd);

                Contacts clsContact = new Contacts(base.Connection, base.Transaction);
                clsContact.SubtractCredit(pvtlngContactID, pvtdecAmountPaid);
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Esempio n. 2
0
        //public void InsertDebitPayment(DebitPaymentDetails Details)
        //{
        //    try
        //    {
        //        string SQL = "CALL procDebitPaymentInsert(@BranchID, @TerminalNo, @TransactionID, @TransactionNo, @Amount, @ContactID, @Remarks);";

        //        MySqlCommand cmd = new MySqlCommand();
        //        cmd.CommandType = System.Data.CommandType.Text;
        //        cmd.CommandText = SQL;

        //        cmd.Parameters.AddWithValue("@BranchID", Details.BranchDetails.BranchID);
        //        cmd.Parameters.AddWithValue("@TerminalNo", Details.TerminalNo);
        //        cmd.Parameters.AddWithValue("@TransactionID", Details.TransactionID);
        //        cmd.Parameters.AddWithValue("@TransactionNo", Details.TransactionNo);
        //        cmd.Parameters.AddWithValue("@Amount", Details.Amount);
        //        cmd.Parameters.AddWithValue("@ContactID", Details.CustomerDetails.ContactID);
        //        cmd.Parameters.AddWithValue("@Remarks", Details.Remarks);

        //        base.ExecuteNonQuery(cmd);

        //        Contacts clsContact = new Contacts(base.Connection, base.Transaction);
        //        clsContact.SubtractDebit(Details.CustomerDetails.ContactID, Details.Amount);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw base.ThrowException(ex);
        //    }
        //}

        /// <summary>
        /// Update CreditPayment, when paying credits.
        /// Use CreditPaymentID as reference.
        /// </summary>
        /// <param name="BranchID"></param>
        /// <param name="TerminalNo"></param>
        /// <param name="ContactID"></param>
        /// <param name="CreditPaymentID"></param>
        /// <param name="AmountPaid"></param>
        /// <param name="Remarks"></param>
        /// <param name="ActivateSuspendedAccount"></param>
        public void UpdateCredit(Int32 BranchID, string TerminalNo, Int64 ContactID, long CreditPaymentID, decimal AmountPaid, string Remarks, bool ActivateSuspendedAccount = true)
		{
			try 
			{
                string SQL = "CALL procCreditPaymentUpdateCredit(@BranchID, @TerminalNo, @CreditPaymentID, @Amount, @Remarks);";
				  
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@BranchID", BranchID);
                cmd.Parameters.AddWithValue("@TerminalNo", TerminalNo);
                cmd.Parameters.AddWithValue("@CreditPaymentID", CreditPaymentID);
                cmd.Parameters.AddWithValue("@Amount", AmountPaid);
                cmd.Parameters.AddWithValue("@Remarks", Remarks);

				base.ExecuteNonQuery(cmd);

                Contacts clsContact = new Contacts(base.Connection, base.Transaction);
                clsContact.SubtractCredit(ContactID, AmountPaid, ActivateSuspendedAccount);
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}