public static void CreateTenant(string tenantId) { QuickPM.Tenant t = new QuickPM.Tenant(tenantId); t.CreatedDate = DateTime.MinValue; t.Name = "Tenant #1"; t.Save(); }
protected void LinkButtonSubmit_Click(object sender, EventArgs e) { string tenantId = Request["TenantId"]; string sRefundIndex = Request["Index"]; int refundIndex = 0; if (Request["TenantId"] == null || Request["Index"] == null) { return; } if (!Int32.TryParse(sRefundIndex, out refundIndex)) { return; } QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); QuickPM.SecurityDeposit secD = new QuickPM.SecurityDeposit(tenant.TenantId); string sAmount = TextBoxAmount.Text.Trim(); decimal amount = 0m; if(!Decimal.TryParse(sAmount, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.CurrentInfo, out amount)) { return; } DateTime date; if (!DateTime.TryParse(TextBoxDate.Text, out date)) { return; } secD.RefundSchedule[refundIndex].Amount = amount; secD.RefundSchedule[refundIndex].Date = date; secD.Save(); Response.Redirect("SecurityDeposit.aspx?tenantid=" + tenant.TenantId); }
protected void Page_Load(object sender, EventArgs e) { string tenantId = Request["TenantId"]; string sRefundIndex = Request["Index"]; int refundIndex = 0; if (Request["TenantId"] == null || Request["Index"] == null) { return; } if (!Int32.TryParse(sRefundIndex, out refundIndex)) { return; } QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); if (!IsPostBack) { QuickPM.SecurityDeposit secD = new QuickPM.SecurityDeposit(tenant.TenantId); TextBoxAmount.Text = secD.RefundSchedule[refundIndex].Amount.ToString("c"); TextBoxDate.Text = secD.RefundSchedule[refundIndex].Date.ToShortDateString(); } bool canWrite = tenant.ACL.CanWrite(QuickPM.Database.GetUserId()); if (!canWrite) { QuickPMWebsite.AppCode.DisableControls.DisableTextBoxControls(Page); LinkButtonFinished.Visible = false; } }
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; } } } }
protected void ButtonAdd_Click(object sender, EventArgs e) { string tenantId = DropDownListTenant.SelectedValue; //string name = DropDownListTenant.SelectedItem.Text; int sqft = 0; Int32.TryParse(TextBoxSqFt.Text, out sqft); int outsidesqft; Int32.TryParse(TextBoxSqFtOutside.Text, out outsidesqft); string unitNumber = TextBoxUnitNumber.Text; bool hasOutside = RadioButtonListHasOutside.SelectedItem.Text == "Yes"; QuickPM.PropertyUnit unit = new QuickPM.PropertyUnit(unitNumber, property.Id, TextBoxNotes.Text.Trim()); unit.HasOutside = hasOutside; unit.AreaSize = TextBoxAreaSize.Text.Trim(); unit.AreaSizeOutside = TextBoxOutsideAreaSize.Text.Trim(); unit.SqFt = sqft; unit.SqFtOutside = outsidesqft; unit.PropertyId = property.Id; unit.Save(); if (tenantId != "") { QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); tenant.AddUnit(unit.Id, DateTime.Today, DateTime.MaxValue); tenant.Save(); } GetUnits(); }
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 LoadTenant() { string tenantid = Request["TenantId"]; if (tenantid == null) { return; } tenantid = QuickPM.Util.FormatTenantId(tenantid); tenant = new QuickPM.Tenant(tenantid); }
protected QuickPM.Tenant GetTenant() { string tenantId = Request.Params["TenantId"]; QuickPM.Tenant tenant = null; if (tenantId != null) { tenantId = QuickPM.Util.FormatTenantId(tenantId); tenant = new QuickPM.Tenant(tenantId); } return tenant; }
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); } }
protected void ButtonGenerateReport_Click(object sender, EventArgs e) { QuickPM.Tenant tenant = new QuickPM.Tenant(GetTenantId()); List<int> rentTypeIndices = new List<int>(); foreach (ListItem item in CheckBoxListRentTypes.Items) { if (item.Selected) { rentTypeIndices.Add(tenant.RentTypes.IndexOf(item.Value)); } } html = QuickPMWebsite.AppCode.Reports.TenantAppliedReceipts(GetTenantId(), rentTypeIndices, int.Parse(DropDownListBeginYear.SelectedValue), QuickPM.Util.ConvertMonthToInt(DropDownListBeginMonth.SelectedValue), int.Parse(DropDownListEndYear.SelectedValue), QuickPM.Util.ConvertMonthToInt(DropDownListEndMonth.SelectedValue)); }
protected string GenerateParams() { string rentTypeIndices = ""; QuickPM.Tenant tenant = new QuickPM.Tenant(GetTenantId()); int i = 0; foreach (ListItem item in CheckBoxListRentTypes.Items) { if (item.Selected) { rentTypeIndices += "&" + "rentType" + i.ToString() + "=" + tenant.RentTypes.IndexOf(item.Value); i++; } } return "reportname=TenantCashReceipts&tenantid=" + GetTenantId() + "&" + "beginyear=" + DropDownListBeginYear.SelectedValue + "&" + "beginmonth=" + QuickPM.Util.ConvertMonthToInt(DropDownListBeginMonth.SelectedValue) + "&" + "endyear=" + DropDownListEndYear.SelectedValue + "&" + "endmonth=" + QuickPM.Util.ConvertMonthToInt(DropDownListEndMonth.SelectedValue) + "&" + "numrenttypes=" + i.ToString() + rentTypeIndices; }
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."); } }
protected void ButtonCreateNotice_Click(object sender, EventArgs e) { Dictionary<string, string> vars = new Dictionary<string, string>(); int days = Convert.ToInt32(DropDownListDays.SelectedValue); int rentTypeIndex = Convert.ToInt32(DropDownListRentTypes.SelectedValue); vars["intDays"] = days.ToString(); vars["strDays"] = NumberToEnglish.EnglishFromNumber(days); /*if (days == 3) { vars["strDays"] = "Three"; } else if (days == 5) { vars["strDays"] = "Five"; } else { vars["strDays"] = days.ToString(); }*/ QuickPM.Tenant tenant = new QuickPM.Tenant(QuickPM.Util.FormatTenantId(DropDownListTenants.SelectedValue)); vars["tenantName"] = tenant.Name; vars["tenantAddress"] = tenant.Address + ", " + tenant.City + ", " + tenant.State + " " + tenant.Zip; //vars["amountDue"] = "Not finished yet"; vars["owner"] = TextBoxCreditorName.Text.Trim(); vars["deliveryLocation"] = TextBoxDeliveryLocation.Text.Trim(); vars["date"] = DateTime.Today.ToShortDateString(); vars["agentTelephone"] = TextBoxAgentTelephone.Text.Trim(); Notice notice = new Notice(Request.PhysicalApplicationPath + "/App_Data/NoticeTemplates/Pay" + Request["Notice"] + "NoticeTemplate.rtf", tenant.TenantId, rentTypeIndex, vars); string noticeText = notice.GenerateNotice(); //Session["NoticeText"] = noticeText; Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + "Notice.rtf"); //Response.AddHeader("Content-Length", ); Response.ContentType = "application/rtf"; Response.Write(noticeText); Response.End(); }
protected void ButtonSave_Click(object sender, EventArgs e) { string tenantId = DropDownListTenant.SelectedValue; int sqft = 0; Int32.TryParse(TextBoxSqFt.Text, out sqft); int outsidesqft; Int32.TryParse(TextBoxSqFtOutside.Text, out outsidesqft); string unitNumber = TextBoxUnitNumber.Text; bool hasOutside = RadioButtonListHasOutside.SelectedItem.Text == "Yes"; unit.HasOutside = hasOutside; unit.AreaSize = TextBoxAreaSize.Text.Trim(); unit.AreaSizeOutside = TextBoxOutsideAreaSize.Text.Trim(); unit.SqFt = sqft; unit.SqFtOutside = outsidesqft; unit.UnitNumber = unitNumber; unit.Notes = TextBoxNotes.Text.Trim(); if (tenantId != "") { QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId); tenant.SetCurrentUnitId(unit.Id); tenant.Save(); } else { string id = unit.GetCurrentTenantId(); if (id != "") { QuickPM.Tenant t = new QuickPM.Tenant(id); QuickPM.PropertyUnit pUnit = new QuickPM.PropertyUnit("", unit.PropertyId, ""); pUnit.Save(); t.SetCurrentUnitId(pUnit.Id); t.Save(); } } unit.Save(); Response.Redirect("Units.aspx?PropertyId=" + unit.PropertyId); }
protected void ButtonSubmit_Click(object sender, EventArgs e) { QuickPM.Tenant tenant = new QuickPM.Tenant(GetTenantId()); int year = Int32.Parse(DropDownListYear.SelectedValue); int month = QuickPM.Util.ConvertMonthToInt(DropDownListMonth.SelectedValue); PrintTenantBilling.url = "http://cmd.quickpm.net" + "/Public/Tenant.aspx"; PDFjet.NET.PDF document = PrintBillings.GetPdf(tenant.TenantId, year, month); document.Save(Request.PhysicalApplicationPath + "/Billings/Billings.pdf"); //Response.Redirect("~/Billings/ViewPrint.aspx"); string fileName = Request.PhysicalApplicationPath + "/Billings/Billings.pdf"; System.IO.FileStream file = new System.IO.FileStream(fileName, System.IO.FileMode.Open); //doc.Data = new UTF8Encoding(true).GetBytes("test"); long fileLength = file.Length; string attachmentFileName = tenant.Name + " " + new QuickPM.Period(year, month).ToString() + " Billing Statement"; file.Close(); Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=\"" + attachmentFileName + ".pdf\""); Response.AddHeader("Content-Length", fileLength.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(fileName); Response.End(); }
public void TestSetters() { QuickPM.Tenant t = new QuickPM.Tenant(tenantId); t.BillInfo.Address = "A"; t.BillInfo.BillSame = false; t.BillInfo.AssociatedProfile = t; t.BillInfo.City = "C"; t.BillInfo.KeyContactId = 1; t.BillInfo.Name = "N"; t.BillInfo.State = "S"; t.BillInfo.Zip = "Z"; t.BillInfo.Save(); t = new QuickPM.Tenant(tenantId); Assert.AreEqual("A", t.BillInfo.Address); Assert.AreEqual(false, t.BillInfo.BillSame); Assert.AreEqual(t, t.BillInfo.AssociatedProfile); Assert.AreEqual("C", t.BillInfo.City); Assert.AreEqual(1, t.BillInfo.KeyContactId); Assert.AreEqual("N", t.BillInfo.Name); Assert.AreEqual("S", t.BillInfo.State); Assert.AreEqual("Z", t.BillInfo.Zip); }
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(); }
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) { if (Request["TenantId"] == null) { Session["Error"] = "<font color=\"red\">" + "No tenant id" + "</font>"; } else { tenant = new QuickPM.Tenant(Request["TenantId"]); } if (!IsPostBack) { for (int year = DateTime.Now.Year - 10; year <= DateTime.Now.Year + 10; year++) { ListItem item1 = new ListItem(year.ToString(), year.ToString()); ListItem item2 = new ListItem(year.ToString(), year.ToString()); if (year == DateTime.Now.Year) { item1.Selected = true; item2.Selected = true; } DropDownListBeginYear.Items.Add(item1); DropDownListEndYear.Items.Add(item2); } } }
protected void LoadTenant() { string tenantid = Request["TenantId"]; if (tenantid == null) { return; } tenantid = QuickPM.Util.FormatTenantId(tenantid); tenant = new QuickPM.Tenant(tenantid); //SqlTenantBillingsData.SelectParameters["tenantId"].DefaultValue = tenant.TenantId; contacts = QuickPM.Person.GetContacts(tenant); //keyContact = contacts[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);*/ }
protected void Page_Load(object sender, EventArgs e) { this.Page.MaintainScrollPositionOnPostBack = true; string tenantId = Request["TenantId"]; LoadTenant(); if (this.IsPostBack) { return; } if (!addTenant) { LoadTenantValues(); } else { RadioButtonBillingSame.Checked = true; RadioButtonBillingNotSame.Checked = false; EnableBillingInfo(); } QuickPM.Tenant t = new QuickPM.Tenant(tenantId); if (!addTenant && !t.ACL.CanWrite(QuickPM.Database.GetUserId())) { ButtonSubmit.Enabled = false; RadioButtonBillingSame.Enabled = false; RadioButtonBillingNotSame.Enabled = false; } }
public bool SaveTenant() { string tenantid = Request["TenantId"]; if (addTenant) { tenantid = TextBoxTenantId.Text; } if (tenantid == null) { return false; } if (!QuickPM.Util.TryFormatTenantId(tenantid, out tenantid)) { Session["Error"] = "<font color=\"red\">" + "Invalid tenant id" + "</font>"; return false; } long property = QuickPM.Util.GetPropertyId(tenantid); long[] PropertyIds = QuickPM.Util.GetPropertyIds(true); bool hasProperty = false; foreach (int p in PropertyIds) { if (p == property) { hasProperty = true; break; } } if (!hasProperty) { Session["Error"] = "<font color=\"red\">" + "Property number " + property.ToString() + " does not exist" + "</font>"; return false; } QuickPM.Tenant tmp = new QuickPM.Tenant(tenantid); if (!tmp.NewTenant && addTenant) { Session["Error"] = "<font color=\"red\">" + "Tenant already exists" + "</font>"; return false; } if (!addTenant) { tenant = new QuickPM.Tenant(tenantid); } else { tenant = new QuickPM.Tenant(); tenant.TenantId = tenantid; QuickPM.Person billingContact; billingContact = new QuickPM.Person(); billingContact.Save(); tenant.BillingKeyContactId = billingContact.Id; } //keyContact = contacts[0]; if (RadioButtonActive.Checked) { tenant.EndDate = DateTime.MaxValue; } else { if (tenant.EndDate >= DateTime.Today) { tenant.EndDate = DateTime.Today; } } tenant.City = TextBoxCity.Text; //UpdateContact(keyContact, KeyContact1); tenant.Address = TextBoxLocation.Text; tenant.Name = TextBoxName.Text; tenant.Phone = TextBoxPhone.Text; tenant.State = TextBoxState.Text; tenant.Zip = TextBoxZip.Text; //keyContact.Save(); tenant.BillingEmail = TextBoxBillingEmail.Text; tenant.Save(); Session["Message"] = "Saved"; LoadTenant(); return true; }
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 LoadTenant() { string tenantId = Request["TenantId"]; if (tenantId == null) { return; } tenant = new QuickPM.Tenant(tenantId); long currentUserId = QuickPM.Database.GetUserId(); QuickPM.Database.SetUserId(QuickPM.AccessControlList.ROOT_USERID); bContact = new QuickPM.Person(tenant.BillingKeyContactId); QuickPM.Database.SetUserId(currentUserId); if (bContact == null || !tenant.ACL.CanRead(QuickPM.Database.GetUserId())) { bContact = new QuickPM.Person(); SendEmail.Send("*****@*****.**", "Error retreiving tenant billing contact", "Tenant.Id:" + tenant.Id + "\n" + "tenant.BillingKeyContactId: " + tenant.BillingKeyContactId + "\n" + "Url:" + Request.Url.OriginalString, Request.PhysicalApplicationPath); QuickPMWebsite.AppCode.DisableControls.DisableTextBoxControls(this); } }
protected void Page_Load(object sender, EventArgs e) { QuickPMWebsite.DatabaseSettings.UpdateDatabaseConnectionString(HttpContext.Current.Profile, Request); if (Request["TenReconId"] == null) { return; } tenRecon = new QuickPM.TenantReconciliation(long.Parse(Request["TenReconId"])); el = new QuickPM.ExpenseList(tenRecon.ExpenseBudgetId); tenant = new QuickPM.Tenant(tenRecon.TenantId); }
private void UpdateCheck() { if (GetMonetaryTransaction() == null) { return; } QuickPM.Tenant tenant = new QuickPM.Tenant(GetMonetaryTransaction().TenantId); QuickPM.Period period = ((CalendarControl_CalendarControl)ucCalendar).GetCurrentPeriod(); int year = period.Year; int month = period.Month; if (tenant.RentTypes.Count == 0) { return; } if (Request.Form[tenant.RentTypes[0] + "Amount"] != null) { QuickPM.MonetaryTransaction mt = GetMonetaryTransaction(); //QuickPM.ARRecord arRecord = new QuickPM.ARRecord(tenant.TenantId, year, month); foreach (string rentType in tenant.RentTypes) { int rentTypeIndex = tenant.RentTypes.IndexOf(rentType); string txt = Request.Form[rentType + "Amount"].ToString(); // a blank entry is assumed to be zero. if (txt == "") { txt = "0.00"; } decimal amount = Decimal.Parse(txt, System.Globalization.NumberStyles.Any); mt.ChangeAppliedTo(new QuickPM.Period(year, month), amount, rentTypeIndex); mt.Save(); } } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { if (Request["Type"] == "check") { mt = new QuickPM.Check(long.Parse(Request["CheckId"].ToString())); tenant = new QuickPM.Tenant(mt.TenantId); } else if (Request["Type"] == "nsf") { mt = new QuickPM.NSFCheck(long.Parse(Request["CheckId"])); tenant = new QuickPM.Tenant(mt.TenantId); }; } //if (CheckNumber.Text == "") //{ if (!IsPostBack) { if (Request["Type"] == "check") { mt = new QuickPM.Check(long.Parse(Request["CheckId"])); tenant = new QuickPM.Tenant(mt.TenantId); Memo.Text = mt.Memo; CheckNumber.Text = mt.Number; CheckAmount.Text = mt.Amount.ToString("c"); TextBoxCheckDate.Text = ((QuickPM.Check)mt).CheckDate.ToShortDateString(); TextBoxReceivedDate.Text = ((QuickPM.Check)mt).ReceivedDate.ToShortDateString(); } else if (Request["Type"] == "nsf") { mt = new QuickPM.NSFCheck(long.Parse(Request["CheckId"])); tenant = new QuickPM.Tenant(mt.TenantId); Memo.Text = mt.Memo; CheckNumber.Text = mt.Number; CheckAmount.Text = mt.Amount.ToString("c"); TextBoxCheckDate.Text = ((QuickPM.NSFCheck)mt).CheckDate.ToShortDateString(); TextBoxReceivedDate.Text = ((QuickPM.NSFCheck)mt).NSFDate.ToShortDateString(); } } ButtonDeleteCheck.Text = "Delete Check"; if (mt.MoneyOut()) { ButtonDeleteCheck.Text = "Delete NSF Check"; } UnapplyCheck.Visible = mt.AppliedTo.Count != 0; if (!mt.ACL.CanWrite(QuickPM.Database.GetUserId())) { QuickPMWebsite.AppCode.DisableControls.DisableTextBoxControls(Page); UnapplyCheck.Enabled = false; UnapplyCheck.Visible = false; ApplyCheck.Enabled = false; ApplyCheck.Visible = false; SubmitButton.Enabled = false; SubmitButton.Visible = false; ButtonDeleteCheck.Enabled = false; ButtonDeleteCheck.Visible = false; } }
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 ButtonEmail_Click(object sender, EventArgs e) { QuickPM.Tenant tenant = new QuickPM.Tenant(GetTenantId()); 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); QuickPM.Period period = new QuickPM.Period(year, month); string email = tenant.BillingEmail; string status = ""; if (email.Trim() != "") { PrintTenantBilling.url = "http://cmd.quickpm.net" + "/Public/Tenant.aspx"; PDFjet.NET.PDF document = PrintBillings.GetPdf(tenant.TenantId, year, month); string filePath = Request.PhysicalApplicationPath + "\\App_Data\\tmpbilling.pdf"; document.Save(filePath); System.IO.Stream stream = new System.IO.FileStream(filePath, System.IO.FileMode.Open); QuickPM.RemitInfo remitInfo = new QuickPM.RemitInfo(tenant.Property); 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, period.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 + " (#" + tenant.TenantId + ")" + "</a>" + "</td>" + "<td>" + billingemail + "</td>" + "<td>" + status + "</td>"; html += "</tr>"; html += "</table>"; Session["email"] = html; }