protected void Page_Load(object sender, EventArgs e) { QuickPMWebsite.DatabaseSettings.UpdateDatabaseConnectionString(Context.Profile, Request); index = GetDepositEntryIndex(); deposit = GetDeposit(); if (deposit.Id == -1) { Response.Redirect("CashJournal.aspx?month=" + DateTime.Today.Month + "&year=" + DateTime.Today.Year); } if (index == deposit.DepositEntries.Count || deposit.Id == -1) { deposit.Deposited = true; if(deposit.DepositDate.Year == DateTime.Now.Year && deposit.DepositDate.Month == DateTime.Now.Month) { deposit.DepositDate = new DateTime(deposit.DepositDate.Year, deposit.DepositDate.Month, DateTime.Now.Day); } deposit.Save(); Response.Redirect("CashJournal.aspx?month=" + deposit.DepositDate.Month + "&year=" + deposit.DepositDate.Year + "&PropertyId=" + deposit.PropertyId); } else if(index < deposit.DepositEntries.Count) { if(!deposit.AddToAR(deposit.DepositEntries[index])) { Session["ErrorMessage"] = "Could not add check#" + deposit.DepositEntries[index].TransactionId + ", it has already been added!"; } deposit.Save(); //index = index + 1; } }
protected void AddDepositEntry(string arg) { QuickPM.Deposit d = new QuickPM.Deposit(long.Parse(arg)); QuickPM.DepositEntry de = new QuickPM.DepositEntry(); de.HasTenantId = false; de.ReceivedDate = DateTime.Today; de.TransactionDate = DateTime.Today; d.DepositEntries.Add(de); d.Save(); Response.Redirect(ResolveUrl("~/CashJournal/EditDepositEntry.aspx?depositId=" + d.Id.ToString() + "&entry_index=" + d.DepositEntries.IndexOf(de))); }
protected long? AddEntry() { string tenantId = DropDownListTenant.SelectedValue; string cDate = TextBoxCheckDate.Text; string sAmount = TextBoxAmount.Text; string checkNumber = TextBoxCheckNumber.Text; string rDate = TextBoxReceivedDate.Text; string notes = TextBoxNotes.Text; int tmp = 0; string tmp3 = ""; bool t2 = Int32.TryParse(tenantId, out tmp); if (!QuickPM.Util.TryFormatTenantId(tenantId, out tmp3) && !t2) { return null; } DateTime checkDate; if (!DateTime.TryParse(cDate, out checkDate)) { return null; } decimal amount; if (!decimal.TryParse(sAmount, out amount)) { return null; } DateTime receivedDate; if (!DateTime.TryParse(rDate, out receivedDate)) { return null; } if (period == null) { return null; } QuickPM.Deposit deposit = new QuickPM.Deposit(); deposit.PropertyId = PropertyId; deposit.DepositDate = DateTime.Today; if (period.Year != DateTime.Today.Year || period.Month != DateTime.Today.Month) { deposit.DepositDate = new DateTime(period.Year, period.Month, 1); } if (deposits.Count > 0) { foreach (QuickPM.Deposit d in deposits) { if (!d.Deposited) { deposit = d; break; } } } QuickPM.DepositEntry de = new QuickPM.DepositEntry(); de.Amount = amount; de.Notes = notes; de.ReceivedDate = receivedDate; de.TenantId = tenantId; string result = ""; de.HasTenantId = QuickPM.Util.TryFormatTenantId(tenantId, out result); de.TransactionDate = checkDate; de.TransactionId = checkNumber; deposit.DepositEntries.Add(de); deposit.Save(); deposits = QuickPM.Deposit.GetDeposits(PropertyId, period.Year, period.Month); return deposit.Id; }
protected void DepositDateChanged(string arg) { string[] val = arg.Split(new char[] { '|' }); QuickPM.Deposit d = new QuickPM.Deposit(long.Parse(val[0])); d.DepositDate = new DateTime(d.DepositDate.Year, d.DepositDate.Month, Int32.Parse(val[1])); d.Save(); }
protected void DeleteDepositEntry(string arg) { string[] vals = arg.Split(new char[] { ';' }); int depositEntryIndex; if (!int.TryParse(vals[1], out depositEntryIndex)) { return; } QuickPM.Deposit deposit = new QuickPM.Deposit(long.Parse(vals[0])); deposit.DeleteFromAR(deposit.DepositEntries[depositEntryIndex]); deposit.DepositEntries.RemoveAt(depositEntryIndex); deposit.Save(); }
protected void ChangeQuickBooksImported(string par) { string[] values = par.Split(new char[] { '|' }); bool imported = Boolean.Parse(values[0]); long id = long.Parse(values[1]); QuickPM.Deposit d = new QuickPM.Deposit(id); d.ImportedToQuickBooks = imported; d.Save(); }