示例#1
0
 public void CompareBillingRecordsByStartDate()
 {
     QuickPM.BillingRecord b1 = new QuickPM.BillingRecord();
     b1.StartDate = DateTime.Today;
     QuickPM.BillingRecord b2 = new QuickPM.BillingRecord();
     b2.StartDate = b1.StartDate.AddDays(1);
     Assert.Less(QuickPM.BillingRecord.CompareBillingRecordsByStartDate(b1, b2), 0);
     b2.StartDate = b1.StartDate;
     Assert.AreEqual(QuickPM.BillingRecord.CompareBillingRecordsByStartDate(b1, b2), 0);
     b2.StartDate = b1.StartDate.AddMonths(-1);
     Assert.Greater(QuickPM.BillingRecord.CompareBillingRecordsByStartDate(b1, b2), 0);
 }
 public ActionResult BillingAJAX(long id)
 {
     QuickPM.BillingRecord record = new QuickPM.BillingRecord(id);
     DateTime startDate = DateTime.Parse(Request["StartDate"]);
     DateTime endDate = DateTime.Parse(Request["EndDate"]);
     decimal amount = decimal.Parse(Request["Amount"]);
     string notes = Request["Notes"];
     record.StartDate = startDate;
     record.EndDate = endDate;
     record.Amount = amount;
     record.Notes = notes;
     record.Save();
     ViewData["Message"] = "Saved";
     return View();
 }
示例#3
0
 public void GetBill()
 {
     /*QuickPM.Bill b = QuickPM.Bill.GetBill(tenantId, "Rent", 2008, 5);
     b.BillingType = QuickPM.TypeOfBill.OneTime;
     b.Amount = 100m;
     b.Save();
     b = QuickPM.Bill.GetBill(tenantId, "Rent", 2008, 5);
     Assert.AreEqual(QuickPM.TypeOfBill.OneTime, b.BillingType);
     Assert.AreEqual(100m, b.Amount);*/
     QuickPM.BillingRecord bRecord = new QuickPM.BillingRecord();
     bRecord.TenantId = tenantId;
     bRecord.StartDate = new DateTime(2008, 5, 1);
     bRecord.EndDate = new DateTime(2008, 5, 14);
     bRecord.Amount = 100m;
     bRecord.RentTypeIndex = 0;
     bRecord.Save();
     QuickPM.Bill b = QuickPM.Bill.GetBill(tenantId, "Rent", 2008, 5);
     Assert.Less(b.Amount, 100m);
 }
示例#4
0
        public void CreateBillingRecord()
        {
            QuickPM.BillingRecord b1 = new QuickPM.BillingRecord();
            b1.StartDate = new DateTime(2008, 1, 1);
            b1.EndDate = new DateTime(2008, 2, 1);
            b1.RentTypeIndex = 0;
            b1.Amount = 100m;
            b1.TenantId = tenantId;
            b1.Save();

            b1 = QuickPM.BillingRecord.CreateBillingRecord(b1.Id);
            Assert.AreEqual(b1.StartDate, new DateTime(2008, 1, 1));
            Assert.AreEqual(b1.Amount, 100m);
            Assert.AreEqual(b1.RentTypeIndex, 0);
            Assert.AreEqual(b1.TenantId, tenantId);

            b1.StartDate = DateTime.MinValue;
            QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId);
            tenant.CreatedDate = DateTime.Today;
            tenant.Save();
            bool exceptionThrown = false;
            try
            {
                b1.Save();
            }
            catch (Exception e)
            {
                if (e.Message.Contains("billing record start before the tenant was created"))
                {
                    exceptionThrown = true;
                }
                else
                {
                    throw e;
                }
            }
            if (!exceptionThrown)
            {
                throw new Exception("Should have had exception when saving billing record.");
            }
        }
示例#5
0
        public void GetBillingRecord()
        {
            QuickPM.BillingRecord b1 = new QuickPM.BillingRecord();
            b1.StartDate = new DateTime(2008, 3, 1);
            b1.EndDate = new DateTime(2008, 4, 1);
            b1.RentTypeIndex = 0;
            b1.Amount = 100m;
            b1.TenantId = tenantId;
            b1.Save();

            b1 = QuickPM.BillingRecord.GetBillingRecord(tenantId, "Rent", b1.StartDate, new QuickPM.DatabaseAccess(QuickPM.Database.ConnectionString));
            Assert.AreEqual(b1.StartDate, new DateTime(2008, 3, 1));
            Assert.AreEqual(b1.Amount, 100m);
            Assert.AreEqual(b1.RentTypeIndex, 0);
            Assert.AreEqual(b1.TenantId, tenantId);
        }
示例#6
0
        public void MergeBillingRecords()
        {
            QuickPM.BillingRecord b1 = new QuickPM.BillingRecord();
            b1.StartDate = new DateTime(2007, 1, 1);
            b1.EndDate = new DateTime(2007, 4, 1);
            b1.RentTypeIndex = 0;
            b1.Amount = 100m;
            b1.TenantId = tenantId;
            b1.Save();

            QuickPM.BillingRecord b2 = new QuickPM.BillingRecord();
            b2.StartDate = new DateTime(2007, 4, 2);
            b2.EndDate = new DateTime(2007, 4, 20);
            b2.RentTypeIndex = 0;
            b2.Amount = 100m;
            b2.TenantId = tenantId;
            b2.Save();

            QuickPM.BillingRecord.MergeBillingRecords(tenantId, "Rent");

            List<QuickPM.BillingRecord> billingRecords = QuickPM.BillingRecord.GetBillingRecords(tenantId);
            Assert.AreEqual(1, billingRecords.Count);
        }