示例#1
0
文件: SO.cs 项目: marioricci/erp-luma
		public bool UpdatePayment(long SOID, decimal PaidAmount, SOPaymentStatus paymentStatus)
		{
			try
			{
				string SQL = "UPDATE tblSO SET " +
								"PaidAmount     = PaidAmount + @PaidAmount, " +
								"UnpaidAmount   = UnpaidAmount - @PaidAmount, " +
								"PaymentStatus  = @PaymentStatus " +
							 "WHERE SOID = @SOID;";

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

				MySqlParameter prmPaidAmount = new MySqlParameter("@PaidAmount",MySqlDbType.Decimal);
				prmPaidAmount.Value = PaidAmount;
				cmd.Parameters.Add(prmPaidAmount);

				MySqlParameter prmPaymentStatus = new MySqlParameter("@PaymentStatus",MySqlDbType.Int16);
				prmPaymentStatus.Value = paymentStatus.ToString("d");
				cmd.Parameters.Add(prmPaymentStatus);

				MySqlParameter prmSOID = new MySqlParameter("@SOID",MySqlDbType.Int64);
				prmSOID.Value = SOID;
				cmd.Parameters.Add(prmSOID);

				base.ExecuteNonQuery(cmd);

				return true;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}
		}
示例#2
0
文件: SO.cs 项目: marioricci/erp-luma
		/**********************************
		 * Lemuel E. Aceron
		 * July 30, 2008 17:21
		 * Added for Payment
		 **********************************/
		public bool UpdatePaymentStatus(SOPaymentStatus paymentStatus, string IDs)
		{
			try
			{
				string SQL = "UPDATE tblSO SET PaymentStatus = @PaymentStatus WHERE SOID IN (" + IDs + ");";

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

				MySqlParameter prmPaymentStatus = new MySqlParameter("@PaymentStatus",MySqlDbType.Int16);
				prmPaymentStatus.Value = paymentStatus.ToString("d");
				cmd.Parameters.Add(prmPaymentStatus);

				base.ExecuteNonQuery(cmd);

				return true;
			}

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