Example #1
0
        public static void ChargeMonth(Member m, int month, int year)
        {
            m.Sync();
            DateTime s = PaymentRuler.ComputeStartDate(m, month, year);
            DateTime e = PaymentRuler.ComputeEndDate(m, month, year);

            MonthlyChargeModel mcm = new MonthlyChargeModel();
            if(!mcm.Exists(m, s))
                mcm.Insert(m, s, e);
        }
Example #2
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);
            }
        }