public bool UpdatePayment(long BranchTransferID, decimal PaidAmount, BranchTransferPaymentStatus paymentStatus) { try { MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; string SQL = "UPDATE tblBranchTransfer SET " + "PaidAmount = PaidAmount + @PaidAmount, " + "UnpaidAmount = UnpaidAmount - @PaidAmount, " + "PaymentStatus = @PaymentStatus " + "WHERE BranchTransferID = @BranchTransferID;"; cmd.Parameters.AddWithValue("@PaidAmount", PaidAmount); cmd.Parameters.AddWithValue("@PaymentStatus", paymentStatus.ToString("d")); cmd.Parameters.AddWithValue("@BranchTransferID", BranchTransferID); cmd.CommandText = SQL; base.ExecuteNonQuery(cmd); return true; } catch (Exception ex) { throw base.ThrowException(ex); } }
/********************************** * Lemuel E. Aceron * July 30, 2008 17:21 * Added for Payment **********************************/ public bool UpdatePaymentStatus(BranchTransferPaymentStatus paymentStatus, string IDs) { try { MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; string SQL = "UPDATE tblBranchTransfer SET PaymentStatus = @PaymentStatus WHERE BranchTransferID IN (" + IDs + ");"; cmd.Parameters.AddWithValue("@PaymentStatus", paymentStatus.ToString("d")); cmd.CommandText = SQL; base.ExecuteNonQuery(cmd); return true; } catch (Exception ex) { throw base.ThrowException(ex); } }