diff --git a/Site5/Controls/v5/Pirates/PersonDetailPopup.ascx b/Site5/Controls/v5/Pirates/PersonDetailPopup.ascx new file mode 100644 index 00000000..094269ad --- /dev/null +++ b/Site5/Controls/v5/Pirates/PersonDetailPopup.ascx @@ -0,0 +1,27 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PersonDetailPopup.ascx.cs" Inherits="Controls_v5_PersonDetailPopup" %> +<%@ Register Src="~/Controls/v5/Pirates/ComboPerson.ascx" TagName="ComboPerson" TagPrefix="act5" %> + + + +
+ +
+ +


+
+ + +

+
+ +
+
+ +
+ + + + + + +
diff --git a/Site5/Controls/v5/Pirates/PersonDetailPopup.ascx.cs b/Site5/Controls/v5/Pirates/PersonDetailPopup.ascx.cs new file mode 100644 index 00000000..222d2833 --- /dev/null +++ b/Site5/Controls/v5/Pirates/PersonDetailPopup.ascx.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections; +using System.Configuration; +using System.Data; +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.Security; +using Telerik.Web.UI; + +public partial class Controls_v5_PersonDetailPopup : ControlV5Base +{ + protected void Page_Load(object sender, EventArgs e) + { + object personId = ViewState[this.ClientID + "_PersonId"]; + + if (personId != null) + { + _person = Person.FromIdentity((int) personId); + } + + this.LabelPersonName.Style[HtmlTextWriterStyle.FontSize] = "20px"; + this.PersonNewOwner.Width = 167; + } + + + private Person _person; + private Authority _authority; + + + public Person Person + { + get + { + if (_person == null) + { + return this.PersonNewOwner.SelectedPerson; + } + + return _person; + } + set + { + _person = value; + // this.PersonNewOwner.SelectedPerson = _person; + + if (value != null) + { + ViewState[this.ClientID + "_PersonId"] = value.Identity; + + this.ImageAvatar.ImageUrl = _person.GetSecureAvatarLink(96); + this.LabelPersonName.Text = _person.Name; + this.LabelPersonIdentity.Text = "#" + _person.Identity.ToString(); + } + else + { + ViewState[this.ClientID + "_PersonId"] = null; + this.ImageAvatar.ImageUrl = "https://pirateweb.net/Images/Public/Fugue/icons-shadowless/cross.png"; + this.LabelPersonIdentity.Text = "#"; + this.LabelPersonName.Text = "Nobody"; + } + + } + } + /* + public Authority Authority + { + set + { + _authority = value; + this.PersonNewOwner.Authority = value; + } + }*/ + + + public FinancialAccount Account + { + set + { + _account = value; + } + } + + + private FinancialAccount _account; + + protected void ButtonSetNewOwner_Click(object sender, EventArgs e) + { + this.PanelRead.Visible = false; + this.PanelWrite.Visible = true; + this.PersonNewOwner.Focus(); + } + + public void Reset() + { + this.PanelWrite.Visible = false; + this.PanelRead.Visible = true; + this.ButtonConfirmPerson.Visible = false; + this.PersonNewOwner.SelectedPerson = null; + + if (ViewState[this.ClientID + "_PersonId"] == null) + { + this.ImageAvatar.ImageUrl = "https://pirateweb.net/Images/Public/Fugue/icons-shadowless/cross.png"; + } + else + { + this.ImageAvatar.ImageUrl = Person.FromIdentity((int) ViewState[this.ClientID + "_PersonId"]).GetSecureAvatarLink(96); + } + } + + + protected void PersonNewOwner_SelectedPersonChanged(object sender, EventArgs e) + { + this.ImageAvatar.ImageUrl = this.PersonNewOwner.SelectedPerson.GetSecureAvatarLink(96); + this.ButtonConfirmPerson.Visible = true; + } + + protected void ButtonConfirmPerson_Click(object sender, EventArgs e) + { + if (this._account == null) + { + throw new InvalidOperationException("Can't set owner for null account"); + } + + this._account.Owner = this.PersonNewOwner.SelectedPerson; + this._person = this.PersonNewOwner.SelectedPerson; + + if (PersonChanged != null) + { + PersonChanged(this, new EventArgs()); + } + + this.LabelPersonName.Text = _person.Name; + this.LabelPersonIdentity.Text = "#" + _person.Identity.ToString(); + Reset(); + } + + protected void ButtonCancel_Click(object sender, EventArgs e) + { + Reset(); + } + + public event EventHandler PersonChanged; + +} diff --git a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx index 6949f74e..99274232 100644 --- a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx +++ b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx @@ -1,18 +1,22 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="SetRootBudgets.aspx.cs" Inherits="Pages_v5_Ledgers_SetRootBudgets" %> +<%@ Register src="~/Controls/v5/Pirates/PersonDetailPopup.ascx" tagName="PersonDetailPopup" tagPrefix="act5" %> -

+

-
+
()
-  
-  
+ Budget, Owner [LOC]
+  
diff --git a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs index 9ca5f3c8..dc5055e8 100644 --- a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs +++ b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs @@ -18,7 +18,7 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base if (!Page.IsPostBack) { - FinancialAccounts accounts = GetRootLevelAccounts(); + FinancialAccounts accounts = GetRootLevelResultAccounts(); int currentYear = DateTime.Today.Year; _year = currentYear; @@ -83,19 +83,30 @@ public partial class Pages_v5_Ledgers_SetRootBudgets : PageV5Base textBudget.Text = String.Format("{0:N0}", account.GetBudgetCents(_year)/100); textBudget.Style[HtmlTextWriterStyle.TextAlign] = "right"; - textBudget.Style[HtmlTextWriterStyle.Width] = "150px"; + textBudget.Style[HtmlTextWriterStyle.Width] = "80px"; + + Label labelOwnerName = (Label) e.Item.FindControl("LabelBudgetOwner"); + if (account.Owner == null) + { + labelOwnerName.Text = "None [LOC]"; + } + else + { + labelOwnerName.Text = account.Owner.Formal; + } + } protected void DropYears_SelectedIndexChanged(object sender, EventArgs e) { - FinancialAccounts accounts = GetRootLevelAccounts(); + FinancialAccounts accounts = GetRootLevelResultAccounts(); this.RepeaterAccountBudgets.DataSource = accounts; this.RepeaterAccountBudgets.DataBind(); } - private FinancialAccounts GetRootLevelAccounts() + private FinancialAccounts GetRootLevelResultAccounts() { FinancialAccounts allAccounts = FinancialAccounts.ForOrganization(_currentOrganization, FinancialAccountType.Result);