using System; using System.Collections; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Globalization; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Activizr.Logic.Financial; using Activizr.Logic.Pirates; using Activizr.Logic.Structure; using Telerik.Web.UI; namespace Activizr.Site.Pages.v4.Activism { public partial class ManageParleys : PageV4Base { protected void Page_Init (object sender, EventArgs e) { } protected void Page_Load(object sender, EventArgs e) { if (ViewState[this.ClientID + "_ParleyId"] != null) { int parleyId = Int32.Parse((string)ViewState[this.ClientID + "_ParleyId"]); _parley = Parley.FromIdentity(parleyId); CreateDynamicControls(); } } private Parley _parley; protected void Page_PreRender(object sender, EventArgs e) { if (!Page.IsPostBack) { PopulateControls(); } } private void PopulateControls() { Parleys parleys = Parleys.ForOwner(_currentUser); this.DropParleys.Items.Clear(); foreach (Parley parley in parleys) { this.DropParleys.Items.Add(new ListItem(parley.Name + " / " + parley.Organization.Name, parley.Identity.ToString())); } bool selectedParley = false; string accountParameterString = Request.QueryString["ParleyId"]; if (!String.IsNullOrEmpty(accountParameterString)) { int parleyId = Int32.Parse(accountParameterString); if (FinancialAccount.FromIdentity(parleyId).OwnerPersonId == _currentUser.Identity) { this.DropParleys.SelectedValue = parleyId.ToString(); } } if (this.DropParleys.SelectedIndex >= 0) { ViewState[this.ClientID + "_ParleyId"] = this.DropParleys.SelectedValue; PopulateParleyData(); } } private void PopulateParleyData() { int parleyId = Int32.Parse(this.DropParleys.SelectedValue); _parley = Parley.FromIdentity(parleyId); Ledger.Accounts = FinancialAccounts.FromSingle(_parley.Budget); int year = DateTime.Today.Year; Ledger.DateStart = _parley.CreatedDateTime.Date; Ledger.DateEnd = new DateTime(year, 12, 31); Ledger.MaxAmount = 1.0e12m; Ledger.Populate(); CreateDynamicControls(); } private void CreateDynamicControls() { this.PlaceHolderSummary.Controls.Clear(); this.PlaceHolderGuests.Controls.Clear(); string tableStart = "