示例#1
0
        public void CreateProperty()
        {
            string address = "add1";
            int rentindex1 = 0;
            string rent1 = "Min Rent";
            int rentindex2 = 1;
            string rent2 = "Addl Rent";
            string legalName = "Legal Name";
            string name = "Name";
            int chartOfAccount = 1001;
            bool active = false;
            //Create a new Property.
            QuickPM.Property p = new QuickPM.Property(2);
            p.Active = active;
            p.Address = address;
            p.ChartOfAccounts = new Dictionary<int, int>();
            p.ChartOfAccounts[rentindex1] = 1001;
            p.RentTypes.Add(rent1);
            p.LegalName = legalName;
            p.Name = name;
            p.AddRentType(rent2);

            p.Save();

            //Load the property from the database;
            p = new QuickPM.Property(2);
            Assert.AreEqual(address, p.Address);
            Assert.AreEqual(active, p.Active);
            Assert.AreEqual(p.ChartOfAccounts[rentindex1], chartOfAccount);
            Assert.AreEqual(p.RentTypes[0], rent1);
            Assert.AreEqual(legalName, p.LegalName);
            Assert.AreEqual(name, p.Name);
        }
示例#2
0
 protected void ButtonSubmit_Click(object sender, EventArgs e)
 {
     string rentTypeName = TextBoxName.Text.Trim();
     int rentTypeIndex = Int32.Parse(Request["RentNum"]);
     int chartOfAccount = 0;
     if (TextBoxChartOfAccount.Text.Trim() != "")
     {
         if (!Int32.TryParse(TextBoxChartOfAccount.Text, out chartOfAccount))
         {
             Session["Error"] = "<font color=\"red\"> Please enter a number for the chart of account</font>";
             return;
         }
     }
     QuickPM.Property property = new QuickPM.Property(Int32.Parse(Request["PropertyId"]));
     if (property.RentTypes.IndexOf(rentTypeName) != -1 && rentTypeName != property.RentTypes[rentTypeIndex])
     {
         Session["Error"] = "<font color=\"red\"> That name is already taken</font>";
         return;
     }
     if (!QuickPM.Property.ValidRentType(rentTypeName))
     {
         Session["Error"] = "<font color=\"red\">Please only use letters, numbers, and % for the name</font>";
         return;
     }
     property.RentTypes[rentTypeIndex] = rentTypeName;
     property.ChartOfAccounts[rentTypeIndex] = chartOfAccount;
     property.Save();
     Response.Redirect("PropertyPage.aspx?PropertyId=" + property.Id);
 }
示例#3
0
        public static void CreateProperty(int number)
        {
            QuickPM.Property p = new QuickPM.Property(number);
            p.Active = true;
            p.RentTypes.Add("Rent");

            p.ChartOfAccounts.Add(p.RentTypes.IndexOf("Rent"), 1);
            p.Name = "Property #1";
            p.Save();
        }
示例#4
0
        public void AddDocument()
        {
            QuickPM.Property p = new QuickPM.Property(propertyNumber);

            QuickPM.Document doc = new QuickPM.Document();
            doc.Save();
            p.AddDocumentId(doc.Id);
            p.Save();
            p = new QuickPM.Property(propertyNumber);
            Assert.AreEqual(p.DocumentIds[0], doc.Id);
        }
示例#5
0
        public void GetDocumentIds()
        {
            QuickPM.Property p = new QuickPM.Property(propertyNumber);
            Assert.AreEqual(0, p.DocumentIds.Count);

            QuickPM.Document doc = new QuickPM.Document();

            doc.Save();
            p.DocumentIds.Add(doc.Id);
            p.Save();
            p = new QuickPM.Property(p.Number);
            Assert.AreEqual(1, p.DocumentIds.Count);
            Assert.AreEqual(doc.Id, p.DocumentIds[0]);
            Assert.AreEqual(doc.Id, p.GetDocumentIds()[0]);

            p.RemoveDocumentId(doc.Id);
            p.Save();
            p = new QuickPM.Property(p.Number);
            Assert.AreEqual(0, p.DocumentIds.Count);
        }
示例#6
0
        public void FindDelinquentTenants()
        {
            string rent1 = "Rent";
            QuickPM.Property p = new QuickPM.Property(propertyNumber);
            p.AddRentType(rent1);
            p.Save();
            QuickPM.Tenant tenant = new QuickPM.Tenant(QuickPM.Util.FormatTenantId(propertyNumber.ToString() + "-01"));
            tenant.CreatedDate = DateTime.MinValue;
            tenant.Save();
            Dictionary<string, decimal> rents = new Dictionary<string,decimal>();
            rents.Add(rent1, 100);
            QuickPM.Util.AddBillingAndARRecords(tenant.Id, 1, 1, new DateTime(DateTime.Today.Year - 1, DateTime.Today.Month, 1), new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1), rents);
            p.FindDelinquentTenants((float)1.0);
            return;
            /*Assert.AreEqual(1, p.FindDelinquentTenants((float)1.0).Count);
            Assert.AreEqual(1, p.FindDelinquentTenants((int)60).Count);
            Assert.AreEqual(0, p.FindDelinquentTenants((float)10000).Count);
            QuickPM.Check check = new QuickPM.Check();
            check.TenantId = tenant.Id;
            check.ARRecordDate = new DateTime(DateTime.Today.Year - 1, 1, 1);
            check.CheckDate = DateTime.Today;
            check.Number = "1";
            check.ReceivedDate = DateTime.Today;
            check.Amount = 100;
            check.AutoApply(new QuickPM.Period(check.ARRecordDate.Year, check.ARRecordDate.Month));
            check.Save();

            Assert.AreEqual(0, p.FindDelinquentTenants((int)600).Count);*/
        }