Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request["Id"] == null)
     {
         return;
     }
     unit = new QuickPM.PropertyUnit(long.Parse(Request["Id"]));
     if (!IsPostBack)
     {
         ListItem it = new ListItem("None", "");
         it.Selected = "" == unit.GetCurrentTenantId();
         DropDownListTenant.Items.Add(it);
         QuickPM.Property property = new QuickPM.Property(unit.PropertyId);
         foreach (string tenantId in property.GetTenantIds())
         {
             QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId);
             ListItem item = new ListItem(tenant.GetShortName(), tenant.TenantId);
             item.Selected = tenantId == unit.GetCurrentTenantId();
             DropDownListTenant.Items.Add(item);
         }
         TextBoxAreaSize.Text = unit.AreaSize;
         TextBoxNotes.Text = unit.Notes;
         TextBoxOutsideAreaSize.Text = unit.AreaSizeOutside;
         TextBoxSqFt.Text = unit.SqFt.ToString();
         TextBoxSqFtOutside.Text = unit.SqFtOutside.ToString();
         TextBoxUnitNumber.Text = unit.UnitNumber;
         RadioButtonListHasOutside.Items[0].Selected = unit.HasOutside;
         RadioButtonListHasOutside.Items[1].Selected = !unit.HasOutside;
     }
 }
Example #2
0
    protected void ButtonGenerateChart_Click(object sender, EventArgs e)
    {
        moneyReceived = new List<decimal>();
        tenantPaid = new Dictionary<string, decimal>();
        months = new List<long>();
        int beginYear = Convert.ToInt32(DropDownListBeginYear.SelectedValue);
        int beginMonth = QuickPM.Util.ConvertMonthToInt(DropDownListBeginMonth.SelectedValue);
        int endYear = Convert.ToInt32(DropDownListEndYear.SelectedValue);
        int endMonth = QuickPM.Util.ConvertMonthToInt(DropDownListEndMonth.SelectedValue);
        QuickPM.Period beginPeriod = new QuickPM.Period(beginYear, beginMonth);
        QuickPM.Period endPeriod = new QuickPM.Period(endYear, endMonth);
        if (endMonth == beginMonth && endYear == beginYear)
        {
            endPeriod = endPeriod.AddMonth();
        }
        int property;
        if (Request["PropertyId"] == null)
        {
            string selectedValue = this.PropertyList.SelectedValue;
            string[] tmp = selectedValue.Split(new char[] { ' ' });
            property = Convert.ToInt32(tmp[0]);
        }
        else
        {
            property = Convert.ToInt32(Request["PropertyId"]);
        }
        this.property = new QuickPM.Property(property);

        for (QuickPM.Period p = beginPeriod; p <= endPeriod; p = p.AddMonth())
        {
            months.Add((new DateTime(p.Year, p.Month, 1).Ticks) - (new DateTime(1970, 1, 1).Ticks));
            decimal received = 0;

            List<string> profileIds = new List<string>(QuickPM.Database.GetPropertyTenantIds(this.property.Id, p));
            foreach (string profileId in profileIds)
            {
                QuickPM.Tenant tenant = new QuickPM.Tenant(profileId);
                string shortName = tenant.GetShortName();
                List<QuickPM.Check> checks = QuickPM.Database.GetChecks(profileId, p);
                List<QuickPM.NSFCheck> nsfChecks = QuickPM.Database.GetNSFChecks(profileId, p);
                foreach (QuickPM.Check c in checks)
                {
                    received += c.Amount;
                    if (!tenantPaid.ContainsKey(shortName))
                    {
                        tenantPaid[shortName] = 0m;
                    }
                    tenantPaid[shortName] += c.Amount;
                }
                foreach (QuickPM.NSFCheck n in nsfChecks)
                {
                    received += n.Amount;
                    if (!tenantPaid.ContainsKey(shortName))
                    {
                        tenantPaid[shortName] = 0m;
                    }
                    tenantPaid[shortName] += n.Amount;
                }

            }
            moneyReceived.Add(received);
        }
        CreateTenantList();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        QuickPMWebsite.DatabaseSettings.UpdateDatabaseConnectionString(HttpContext.Current.Profile, Request);

        if (QuickPM.Util.GetPropertyIds().Length == 0)
        {
            return;
        }

        long iPropertyId = QuickPM.Util.GetPropertyIds()[0];
        this.PropertyId = iPropertyId;

        if (Request["PropertyId"] != null)
        {
            if(long.TryParse(Request["PropertyId"], out iPropertyId)){
                this.PropertyId = iPropertyId;
            }

        }

        if (!IsPostBack)
        {
            foreach (int PropertyId in QuickPM.Util.GetPropertyIds())
            {
                QuickPM.Property p = new QuickPM.Property(PropertyId);
                ListItem item = new ListItem(p.Name + " (#" + PropertyId + ")", p.Id.ToString());
                if (p.Id == iPropertyId)
                {
                    item.Selected = true;
                }
                DropDownListProperty.Items.Add(item);
            }
        }
        period = null;
        period = GetCurrentPeriod();
            QuickPM.Property pp = new QuickPM.Property(this.PropertyId);
            if (DropDownListTenant.Items.Count == 0 || QuickPM.Util.GetPropertyId(DropDownListTenant.Items[0].Value) != pp.Id)
            {
                DropDownListTenant.Items.Clear();
                foreach (string tenantId in pp.GetTenantIds())
                {
                    QuickPM.Tenant t = new QuickPM.Tenant(tenantId);
                    string PropertyId = QuickPM.Util.GetPropertyId(t.TenantId).ToString();
                    PropertyId = PropertyId.Length < 2 ? "0" + PropertyId : PropertyId;
                    string tenantNumber = t.TenantId.Split(new char[] { '-' })[1];

                    DropDownListTenant.Items.Add(new ListItem(t.GetShortName() + " (#" + PropertyId + "-" + tenantNumber + ")", t.TenantId));
                }
                DropDownListTenant.Items.Add(new ListItem("(" + pp.Name + ")", pp.Id.ToString()));

            }

            if (Request.Form["__EVENTTARGET"] == "DepositDateChanged")
            {
                DepositDateChanged(Request.Form["__EVENTARGUMENT"]);
            }

            if (Request.Form["__EVENTTARGET"] == "AddDepositEntry")
            {
                AddDepositEntry(Request.Form["__EVENTARGUMENT"]);
            }

            if (Request.Form["__EVENTTARGET"] == "DeleteDeposit")
            {
                DeleteDeposit(Request.Form["__EVENTARGUMENT"]);
            }

            if (Request.Form["__EVENTTARGET"] == "DeleteDepositEntry")
            {
                DeleteDepositEntry(Request.Form["__EVENTARGUMENT"]);
            }

            if (Request.Form["__EVENTTARGET"] == "ChangeQuickBooksImported")
            {
                ChangeQuickBooksImported(Request.Form["__EVENTARGUMENT"]);
            }

            deposits = QuickPM.Deposit.GetDeposits(this.PropertyId, period.Year, period.Month);

            if (Request.Form["__EVENTTARGET"] == "FinishDeposit")
            {
                FinishDeposit(Request.Form["__EVENTARGUMENT"]);
            }

        //if(IsPostBack && period != null)
    }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string[] tenantIds = QuickPM.Database.GetTenantIds();
            foreach (string tenantId in tenantIds)
            {
                QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId);
                DropDownListTenants.Items.Add(new ListItem(tenantId + " (" + tenant.GetShortName() + ")", tenant.TenantId));
            }
            if (DropDownListTenants.Items.Count > 0)
            {
                DropDownListTenants.Items[0].Selected = true;
                string id = DropDownListTenants.Items[0].Value;
                QuickPM.Tenant tenant = new QuickPM.Tenant(id);
                List<string> rentTypes = tenant.RentTypes;
                for (int i = 0; i < rentTypes.Count; i++)
                {
                    DropDownListRentTypes.Items.Add(new ListItem(rentTypes[i], i.ToString()));
                }

                if (DropDownListRentTypes.Items.Count > 0)
                {
                    DropDownListRentTypes.Items[0].Selected = true;
                }
            }

        }
    }