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."); } }
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(); }
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); }
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); }
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); }