public bool UpdatePaymentOf(Member m, DateTime sd, Payment p) { string sql = "update " + this.TableName; sql += " set Payment = @p0"; sql += " where Member = @p1 and StartDate = @p2"; return (long) this.DoNonQuery(sql, p.Id, m.Id, sd.ToString("yyyy-MM-dd")) > 0; }
public static void ChargeFirstMonth(Member m) { m.Sync(); int month = DateTime.Now.Month; int year = DateTime.Now.Year; DateTime s = PaymentRuler.ComputeStartDate(m, month, year); DateTime e = PaymentRuler.ComputeEndDate(m, month, year); MonthlyChargeModel mcm = new MonthlyChargeModel(); mcm.Insert(m, s, e); if(!m.ChargeFirstMonth) { Payment p = new Payment(); p.Amount = 0; p.Discount = 0; PaymentModel pm = new PaymentModel(); pm.Insert(p); p.Id = pm.LastInsertId; mcm.UpdatePaymentOf(m, s, p); } }
public bool Insert(Payment p) { return this.Insert(p.Amount, p.Discount); }