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; } }
protected void Page_Load(object sender, EventArgs e) { string sProp = Request["PropertyId"]; if (sProp == null) { return; } int pNum; if (!Int32.TryParse(sProp, out pNum)) { return; } property = new QuickPM.Property(pNum); GetUnits(); if (Request.Form["__EVENTTARGET"] == "DeleteUnit") { DeleteUnit(Request.Form["__EVENTARGUMENT"]); } if (!IsPostBack) { DropDownListTenant.Items.Add(new ListItem("None", "")); foreach (string tenantId in property.GetTenantIds()) { QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); string text = "" + tenant.TenantId + " " + tenant.Name; //text = tenant.Name; text = text.Length > 20 ? text.Substring(0, 20) : text; DropDownListTenant.Items.Add(new ListItem(text, tenant.TenantId)); } } bool canWrite = property.ACL.CanWrite(QuickPM.Database.GetUserId()); ButtonAdd.Visible = canWrite; ButtonAdd.Enabled = canWrite; DropDownListTenant.Visible = canWrite; TextBoxUnitNumber.Visible = canWrite; TextBoxSqFt.Visible = canWrite; TextBoxAreaSize.Visible = canWrite; RadioButtonListHasOutside.Visible = canWrite; TextBoxSqFtOutside.Visible = canWrite; TextBoxOutsideAreaSize.Visible = canWrite; TextBoxNotes.Visible = canWrite; if (!canWrite) { QuickPMWebsite.AppCode.DisableControls.DisableTextBoxControls(Page); } }
public void GetTenantIds() { QuickPM.Property p = new QuickPM.Property(propertyNumber); QuickPM.Tenant tenant = new QuickPM.Tenant(QuickPM.Util.FormatTenantId(propertyNumber.ToString() + "-01")); tenant.Save(); Assert.AreEqual(1, p.GetTenantIds().Count); Assert.AreEqual(1, p.GetTenantIds(true).Count); Assert.AreEqual(tenant.Id, p.GetTenantIds()[0]); Assert.AreEqual(tenant.Id, p.GetTenantIds(true)[0]); tenant.EndDate = new DateTime(DateTime.Today.Year - 1, 1, 1); tenant.CreatedDate = tenant.EndDate; tenant.Save(); Assert.AreEqual(0, p.GetTenantIds().Count); Assert.AreEqual(1, p.GetTenantIds(true).Count); }
protected void Page_Load(object sender, EventArgs e) { QuickPMWebsite.DatabaseSettings.UpdateDatabaseConnectionString(HttpContext.Current.Profile, Request); if (Request["ebid"] != null) { eb = new QuickPM.ExpenseList(new Guid(Request["ebid"])); } else { return; } property = new QuickPM.Property(eb.PropertyId); units = QuickPM.PropertyUnit.FindUnits(eb.PropertyId); List<string> tenantIds = property.GetTenantIds(); units = QuickPM.PropertyUnit.FindUnits(property.Id); foreach (string tenantId in tenantIds) { QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); bool needToAdd = true; foreach (QuickPM.PropertyUnit unit in units) { if (unit.GetCurrentTenantId() == tenant.TenantId) { needToAdd = false; break; } } if (needToAdd) { QuickPM.PropertyUnit unit = new QuickPM.PropertyUnit("", tenant.Property, ""); unit.Save(); //tenant.Prop //tenant.PropertyUnitId = unit.Id; tenant.Save(); units.Add(unit); } } if (Request.Form["__EVENTTARGET"] == "ExpenseSelectionChanged") { ExpenseSelectionChanged(Request.Form["__EVENTARGUMENT"]); } }
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) }
protected void ButtonEmail_Click(object sender, EventArgs e) { QuickPM.Property property = new QuickPM.Property(GetPropertyId()); List<string> tenantIds = property.GetTenantIds(); string html = "<table id=\"email\" cellspacing=\"0px\" cellpadding=\"10px\">" + @" <tr> <th>Tenant Name/Id</th><th>Email</th><th>Status</th> </tr> "; int year = Int32.Parse(DropDownListYear.SelectedValue); int month = QuickPM.Util.ConvertMonthToInt(DropDownListMonth.SelectedValue); foreach (string tenantId in tenantIds) { QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); string email = tenant.BillingEmail; string status = ""; if (email.Trim() != "") { PrintTenantBilling.url = "http://cmd.quickpm.net" + "/Public/Tenant.aspx"; PDFjet.NET.PDF document = PrintBillings.GetPdf(tenantId, year, month); QuickPM.RemitInfo remitInfo = new QuickPM.RemitInfo(tenant.Property); string filePath = Request.PhysicalApplicationPath + "\\App_Data\\tmpbilling.pdf"; document.Save(filePath); System.IO.Stream stream = new System.IO.FileStream(filePath, System.IO.FileMode.Open); status = "Sent"; string questions = remitInfo.Email.Trim() != "" ? "\r\nIf you have a question about your billing statement please email " + remitInfo.Email : ""; string message = "Please see the attached pdf for your billing statement.\r\nThis is an automated message, do not respond. " + questions; try { SendEmail.Send(email, new QuickPM.Period(year, month).ToString() + " " + "Billing Statement", message, Request.PhysicalApplicationPath, stream, "BillingStatement.pdf"); } catch (Exception ex) { if (ex is System.Net.Mail.SmtpFailedRecipientException) { status = "Failed to send email"; } else if (ex is System.Net.Mail.SmtpFailedRecipientsException) { status = "Failed to send email"; } else { status = "Unknown error"; } }finally { stream.Close(); System.IO.File.Delete(filePath); } } html += "<tr>"; string billingemail = tenant.BillingEmail.Trim() != "" ? tenant.BillingEmail.Trim() : "No Email"; html += "<td>" + "<a href=" + QuickPMWebsite.AppCode.Link.LinkTo(tenant, this, HttpContext.Current.Profile.IsAnonymous) + ">" + tenant.Name + " (#" + tenantId + ")" + "</a>" + "</td>" + "<td>" + billingemail + "</td>" + "<td>" + status + "</td>"; html += "</tr>"; } html += "</table>"; Session["email"] = html; }
protected void Page_Load(object sender, EventArgs e) { string depositId = Request["DepositId"]; if(Request["DepositId"] == null || Request["Entry_Index"] == null) { return; } if (!Int32.TryParse(Request["Entry_Index"], out depositEntryIndex)) { return; } deposit = new QuickPM.Deposit(long.Parse(depositId)); if (deposit.DepositEntries.Count <= depositEntryIndex) { return; } if (!IsPostBack) { QuickPM.DepositEntry de = deposit.DepositEntries[depositEntryIndex]; TextBoxCheckDate.Text = de.TransactionDate.ToShortDateString(); TextBoxCheckNumber.Text = de.TransactionId; TextBoxNotes.Text = de.Notes; TextBoxReceivedDate.Text = de.ReceivedDate.ToShortDateString(); TextBoxAmount.Text = de.Amount.ToString("c"); QuickPM.Property p = new QuickPM.Property(deposit.PropertyId); foreach (string tenantId in p.GetTenantIds()) { QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); ListItem item = new ListItem(tenant.Name + " (" + tenant.TenantId + ")", tenant.TenantId); if (tenant.TenantId == de.TenantId && de.HasTenantId) { item.Selected = true; } DropDownListTenant.Items.Add(item); } ListItem it = new ListItem("(" + p.Name + ")", p.Id.ToString()); if (!de.HasTenantId) { it.Selected = true; } DropDownListTenant.Items.Add(it); } }