/// <summary> /// Sets the selection. /// </summary> /// <param name="controls">The controls.</param> /// <param name="selection">The selection.</param> public override void SetSelection(System.Web.UI.Control[] controls, string selection) { string[] selections = selection.Split('|'); if (controls.Count() > 0) { AccountPicker accountPicker = controls[0] as AccountPicker; if (accountPicker != null) { string[] selectionAccountGuidValues = selections[0].Split(','); var accountList = new List <FinancialAccount>(); foreach (string accountGuid in selectionAccountGuidValues) { var account = new FinancialAccountService(new RockContext()).Get(accountGuid.AsGuid()); if (account != null) { accountList.Add(account); } } accountPicker.SetValues(accountList); } } if (controls.Count() > 1) { RockCheckBox cbUseSundayDate = controls[1] as RockCheckBox; if (cbUseSundayDate != null && selections.Count() > 1) { cbUseSundayDate.Checked = selections[1].AsBooleanOrNull() ?? false; } } }
/// <summary> /// Sets the selection. /// </summary> /// <param name="controls">The controls.</param> /// <param name="selection">The selection.</param> public override void SetSelection(System.Web.UI.Control[] controls, string selection) { if (controls.Count() == 1) { AccountPicker accountPicker = controls[0] as AccountPicker; if (accountPicker != null) { string[] selectionAccountGuidValues = selection.Split(','); var accountList = new List <FinancialAccount>(); foreach (string accountGuid in selectionAccountGuidValues) { var account = new FinancialAccountService(new RockContext()).Get(accountGuid.AsGuid()); if (account != null) { accountList.Add(account); } } accountPicker.SetValues(accountList); } } }