private void LoadItems(object pContext) { HierarchyParallelContext context = pContext as HierarchyParallelContext; if (context == null) { return; } if (DbHelper.GetString(context.Reader, ProvisioningPlanExtraDbTable.TYPE_COLUMN) != context.Filter) { return; } string description = DbHelper.GetString(context.Reader, ProvisioningPlanExtraDbTable.DESCRIPTION_COLUMN); PlanActionLookup item = new PlanActionLookup() { Code = DbHelper.GetString(context.Reader, ProvisioningPlanExtraDbTable.CODE_COLUMN), Name = DbHelper.GetString(context.Reader, ProvisioningPlanExtraDbTable.NAME_COLUMN), Description = (description != null)? description.Replace('\'', ' ') : string.Empty, DefaultValue = DbHelper.GetString(context.Reader, ProvisioningPlanExtraDbTable.DEFAULL_VALUE_COLUMN), RunOrder = DbHelper.GetNullableDecimal(context.Reader, ProvisioningPlanExtraDbTable.RUN_ORDER_COLUMN), IsLoaded = true }; try { item.IsSelected = Convert.ToBoolean(SqlHelper.GetString(context.Reader, ProvisioningPlanExtraDbTable.IS_SELECTED_BY_DEFAULT_COLUMN)); } catch { item.IsSelected = false; } try { item.IsTextBox = Convert.ToBoolean(SqlHelper.GetString(context.Reader, ProvisioningPlanExtraDbTable.IS_TEXTBOX_COLUMN)); } catch { item.IsTextBox = false; } context.Items.Add(item); }
public void Load(ICollection <PlanActionLookup> pInitialWorkflows, ICollection <PlanActionLookup> pCommonPlanActions, ICollection <PlanActionLookup> pFinalWorkflows) { if (pInitialWorkflows == null || pCommonPlanActions == null || pFinalWorkflows == null) { return; } DbQueryBase <ProvisioningPlanExtraDbTable> query = new OracleDbQuery <ProvisioningPlanExtraDbTable>(); using (IDataReader reader = DbHelper.ExecuteReader(_transaction, query.SelectAllQuery)) { while (reader.Read()) { using (EventWaitHandle synchronizer = new AutoResetEvent(false)) { Task iTask = Task.Factory.StartNew(LoadItems, new HierarchyParallelContext(reader, pInitialWorkflows, ProvisioningPlanExtraDbTable.FILTER_INITIAL_VALUE)); Task lTask = Task.Factory.StartNew(LoadItems, new HierarchyParallelContext(reader, pFinalWorkflows, ProvisioningPlanExtraDbTable.FILTER_FINAL_VALUE)); Task.Factory.ContinueWhenAll(new Task[] { iTask, lTask }, (obj) => { synchronizer.Set(); }); synchronizer.WaitOne(); } } } PlanActionLookup item = new PlanActionLookup() { Code = "Tivoli Provisioning Manager Inventory Discovery", Name = "Tivoli Provisioning Manager Inventory Discovery", Description = "HELP: Perform Full Inventory Scan", IsLoaded = true, IsSelected = true }; pCommonPlanActions.Add(item); }
private void UpdateCheckBoxList(IEnumerable <CheckBox> pCheckBoxes, ICollection <PlanActionLookup> pItems) { if (pCheckBoxes == null || pItems == null) { return; } IEnumerator <CheckBox> en = pCheckBoxes.GetEnumerator(); while (en.MoveNext()) { PlanActionLookup lookup = pItems.FirstOrDefault((item) => item.Name == en.Current.Text); en.Current.Checked = (lookup != null) ? lookup.IsSelected : false; } }
protected void Page_Load(object sender, EventArgs e) { if (this.CurrentProfile == null) { Navigator.RedirectToDefaultPage(this.Response); } if (_exception != null) { UIHelper.SetMessage(MessageImage, MessageLabel, MessageType.Error, _exception.Message); return; } if (!this.IsPostBack) { // Init Controls ITICLabel.Text = this.CurrentProfile.ITICCode.Code; InfrastructureLabel.Text = this.CurrentProfile.ITICCode.Infrastructure.Name; CapabilityLabel.Text = this.CurrentProfile.ITICCode.Capability.Name; LogicalSystemGroupLabel.Text = this.CurrentProfile.ITICCode.LogicalSystemGroup.Name; FilenameLabel.Text = this.CurrentProfile.Context.Name; // Bindings WorkflowsRepeater.DataSource = _items; WorkflowsRepeater.DataBind(); // Check CheckBoxes foreach (RepeaterItem item in WorkflowsRepeater.Items) { string code = item.Controls.OfType <HiddenField>().First().Value; PlanActionLookup lookup = this.CurrentProfile.ActiveProvisioningPlan.AdvancedConfigurationActions.FirstOrDefault((a) => a.Code == code); if (lookup != null) { if (lookup.IsTextBox) { item.Controls.OfType <TextBox>().First().Text = lookup.Value; item.Controls.OfType <CheckBox>().First().Checked = true; } else // if(lookup.IsCheckBox) { item.Controls.OfType <CheckBox>().First().Checked = lookup.IsSelected; } } } // Set initial State UIHelper.SetMessage(MessageImage, MessageLabel, MessageType.None, null); } }
private void AddItems(IEnumerable <CheckBox> pCheckBoxes, ICollection <PlanActionLookup> pItems, ICollection <PlanActionLookup> pLookups) { if (pCheckBoxes == null || pItems == null || pLookups == null) { return; } pItems.Clear(); IEnumerator <CheckBox> en = pCheckBoxes.GetEnumerator(); while (en.MoveNext()) { if (en.Current.Checked) { PlanActionLookup lookup = pLookups.First((item) => item.Name == en.Current.Text); lookup.IsSelected = true; pItems.Add(lookup); } } }
private Domain.Profile CreateTestProfile() { Domain.Profile result = new Domain.Profile(); result.ProvisioningPlans = new List <ProvisioningPlan> { new ProvisioningPlan() }; result.ActiveProvisioningPlan = result.ProvisioningPlans[0]; // ITIC InfrastructureLookup inf = new InfrastructureLookup("III", "Test Infrastructure"); CapabilityLookup cap = new CapabilityLookup("SSS", "Test Capability"); LogicalSystemGroupLookup lsg = new LogicalSystemGroupLookup("LSG8", "Test LSG"); result.ITICCode = new ITIC(inf, cap, lsg); // Platform Stack FilterLookup mjf = new FilterLookup("MjF"); FilterLookup mnf = new FilterLookup("MiF"); StackLookup ps = new StackLookup("WIN_x86_2008R_64_2.7.0_GREEN_SK", "Test Windows 2008 64bit Build 2.7.0", "Test descr"); result.ActiveProvisioningPlan.PlatformStack = new PlatformStack(mjf, mnf, new FilterLookup("64bit"), new FilterLookup("2.7.0"), ps); // Application Stacks mjf = new FilterLookup("MjF2"); mnf = new FilterLookup("MiF2"); ps = new StackLookup("TEST_APP_STACK", "Test 2", "Test descr 2"); result.ActiveProvisioningPlan.ApplicationStacks.Add(new Stack(mjf, mnf, ps)); mjf = new FilterLookup("MjF3"); mnf = new FilterLookup("MiF3"); ps = new StackLookup("TEST_APP_STACK_3", "Test 3", "Test descr 3"); result.ActiveProvisioningPlan.ApplicationStacks.Add(new Stack(mjf, mnf, ps)); // Provisioning Plan Extras PlanActionLookup p = new PlanActionLookup() { Code = "CODE1", Name = "NAME1", Description = "DESc1", IsSelected = true }; result.ActiveProvisioningPlan.InitialWorkflows.Add(p); p = new PlanActionLookup() { Code = "CODE2", Name = "NAME2", Description = "DESc2", IsSelected = true }; result.ActiveProvisioningPlan.CommonPlanActions.Add(p); p = new PlanActionLookup() { Code = "CODE3", Name = "NAME3", Description = "DESc3", IsSelected = true }; result.ActiveProvisioningPlan.FinalWorkflows.Add(p); // Post Configuration Actions PlanActionLookup pca = new PlanActionLookup() { Code = "PCA1", Name = "PCA1_NAME1", Description = "PCA1_DESc1", IsSelected = true, IsTextBox = true, DefaultValue = "TEST VALUE" }; result.ActiveProvisioningPlan.AdvancedConfigurationActions.Add(pca); return(result); }