From b3893d223256d742d52bcc4da783262d18652d70 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sat, 14 Jan 2012 05:45:31 +0000 Subject: [PATCH] More work - testing live --- .../v5/Pirates/PersonDetailPopup.ascx.cs | 11 +--- Site5/Pages/v5/Ledgers/SetRootBudgets.aspx | 2 +- Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs | 59 ++++++++++++++++++- 3 files changed, 59 insertions(+), 13 deletions(-) diff --git a/Site5/Controls/v5/Pirates/PersonDetailPopup.ascx.cs b/Site5/Controls/v5/Pirates/PersonDetailPopup.ascx.cs index 222d2833..9a0d4a17 100644 --- a/Site5/Controls/v5/Pirates/PersonDetailPopup.ascx.cs +++ b/Site5/Controls/v5/Pirates/PersonDetailPopup.ascx.cs @@ -30,7 +30,6 @@ public partial class Controls_v5_PersonDetailPopup : ControlV5Base private Person _person; - private Authority _authority; public Person Person @@ -67,15 +66,7 @@ public partial class Controls_v5_PersonDetailPopup : ControlV5Base } } - /* - public Authority Authority - { - set - { - _authority = value; - this.PersonNewOwner.Authority = value; - } - }*/ + public FinancialAccount Account diff --git a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx index 99274232..e428fd45 100644 --- a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx +++ b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx @@ -13,7 +13,7 @@
Budget, Owner [LOC]
-   
diff --git a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs index dc5055e8..3cfd921d 100644 --- a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs +++ b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs @@ -5,7 +5,9 @@ using System.Web.UI; using System.Web.UI.WebControls; using Activizr.Basic.Enums; using Activizr.Logic.Financial; +using Activizr.Logic.Pirates; using Activizr.Logic.Security; +using Telerik.Web.UI; public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base { @@ -86,16 +88,50 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base textBudget.Style[HtmlTextWriterStyle.Width] = "80px"; Label labelOwnerName = (Label) e.Item.FindControl("LabelBudgetOwner"); - if (account.Owner == null) + Person accountOwner = account.Owner; + if (accountOwner == null) { labelOwnerName.Text = "None [LOC]"; } else { - labelOwnerName.Text = account.Owner.Formal; + labelOwnerName.Text = accountOwner.Formal; } + RadToolTip toolTip = (RadToolTip)e.Item.FindControl("ToolTip"); + Controls_v5_PersonDetailPopup personDetail = (Controls_v5_PersonDetailPopup)toolTip.FindControl("PersonDetail"); + personDetail.PersonChanged += new EventHandler(PersonDetail_PersonChanged); + + if (!Page.IsPostBack && _authority != null) + { + personDetail.Person = accountOwner; + personDetail.Account = account; + } + + HiddenField hiddenAccountId = (HiddenField) e.Item.FindControl("HiddenAccountId"); + hiddenAccountId.Value = account.Identity.ToString(); + + // this.TooltipManager.TargetControls.Add(labelBudgetOwner.ClientID, line.AccountIdentity.ToString(), true); + } + + void PersonDetail_PersonChanged(object sender, EventArgs e) + { + // Here, an owner has changed. We need to re-bind the owners column. + + /* + FinancialAccounts accounts = _account.Children; + AccountBudgetLines childData = new AccountBudgetLines(); + + foreach (FinancialAccount account in accounts) + { + childData.Add(new AccountBudgetLine(account, _year)); + } + + this.RepeaterBudgetOwners.DataSource = childData; + this.RepeaterBudgetOwners.DataBind(); + + RebindTooltips();*/ } protected void DropYears_SelectedIndexChanged(object sender, EventArgs e) @@ -104,6 +140,8 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base this.RepeaterAccountBudgets.DataSource = accounts; this.RepeaterAccountBudgets.DataBind(); + + this.RebindTooltips(); } private FinancialAccounts GetRootLevelResultAccounts() @@ -124,4 +162,21 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base return accounts; } + + + protected void RebindTooltips() + { + foreach (RepeaterItem repeaterItem in this.RepeaterAccountBudgets.Items) + { + HiddenField hiddenAccountId = (HiddenField)repeaterItem.FindControl("HiddenAccountId"); + FinancialAccount child = FinancialAccount.FromIdentity(Int32.Parse(hiddenAccountId.Value)); + RadToolTip toolTip = (RadToolTip)repeaterItem.FindControl("ToolTip"); + + Controls_v5_PersonDetailPopup personDetail = (Controls_v5_PersonDetailPopup)toolTip.FindControl("PersonDetail"); + + FinancialAccount account = FinancialAccount.FromIdentity(Int32.Parse(hiddenAccountId.Value)); + personDetail.Person = account.Owner; + personDetail.Account = account; + } + } } \ No newline at end of file