Example #1
0
        public void DeductCredit(long ContactID, decimal Amount)
        {
            try
            {
                Contacts clsContact = new Contacts(base.Connection, base.Transaction);
                clsContact.AddCredit(ContactID, -Amount);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
Example #2
0
        public Int32 Save(CreditPaymentDetails Details)
        {
            try
            {
                // [04/03/2012] Added creditcard information as requested by HP

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

                string SQL = "CALL procCreditPaymentInsert(@BranchID, @TerminalNo, @TransactionID, @CustomerID, @CreditCardPaymentID, @CreditCardTypeID, @CurrentCredit, @Amount, @TransactionDate, @TransactionNo, @CashierName, @Remarks, @CreditReason, @CreditReasonID, @CreatedOn, @LastModified);";

                cmd.Parameters.AddWithValue("@BranchID", Details.BranchDetails.BranchID);
                cmd.Parameters.AddWithValue("@TerminalNo", Details.TerminalNo);
                cmd.Parameters.AddWithValue("@TransactionID", Details.TransactionID);
                cmd.Parameters.AddWithValue("@CustomerID", Details.CustomerDetails.ContactID);
                cmd.Parameters.AddWithValue("@CreditCardPaymentID", Details.CreditCardPaymentID);
                cmd.Parameters.AddWithValue("@CreditCardTypeID", Details.CreditCardTypeID);
                cmd.Parameters.AddWithValue("@CurrentCredit", Details.CustomerDetails.Credit);
                cmd.Parameters.AddWithValue("@Amount", Details.IsRefund ? -(Details.Amount) : Details.Amount);
                cmd.Parameters.AddWithValue("@TransactionDate", Details.TransactionDate.ToString("yyyy-MM-dd HH:mm:ss"));
                cmd.Parameters.AddWithValue("@TransactionNo", Details.TransactionNo);
                cmd.Parameters.AddWithValue("@CashierName", Details.CashierName);
                cmd.Parameters.AddWithValue("@Remarks", Details.Remarks);
                cmd.Parameters.AddWithValue("@CreditReason", Details.CreditReason);
                cmd.Parameters.AddWithValue("@CreditReasonID", Details.CreditReasonID);
                cmd.Parameters.AddWithValue("@CreatedOn", Details.CreatedOn);
                cmd.Parameters.AddWithValue("@LastModified", Details.LastModified);

                cmd.CommandText = SQL;
                base.ExecuteNonQuery(cmd);

                //add credit to masterfile
                Contacts clsContact = new Contacts(base.Connection, base.Transaction);
                clsContact.AddCredit(Details.CustomerDetails.ContactID, Details.IsRefund ? -(Details.Amount) : Details.Amount);

                return(0);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }