private void metaGroupItem_Click(object sender, EventArgs e) { Logger.EnteringMethod(); string metaGroupName = sender.ToString(); MetaGroup selectedMetaGroup = null; mnuStripUpdateListViewer.Hide(); this.Cursor = Cursors.WaitCursor; foreach (MetaGroup metaGroup in _metaGroups) { if (metaGroup.Name == metaGroupName) { selectedMetaGroup = metaGroup; break; } } if (dgvUpdateList.SelectedRows.Count != 0) { UpdateCollection updates = new UpdateCollection(); foreach (DataGridViewRow row in dgvUpdateList.SelectedRows) { updates.Add((IUpdate)row.Cells["UpdateId"].Value); } if (QuicklyApproveUpdate != null) { QuicklyApproveUpdate(updates, selectedMetaGroup); } } }
private MetaGroup GetMetaGroupFromXml(System.Xml.XmlNode node) { Logger.EnteringMethod(node.InnerText); MetaGroup newMetaGroup = new MetaGroup(); foreach (System.Xml.XmlNode childNode in node.ChildNodes) { switch (childNode.Name) { case "Name": newMetaGroup.Name = childNode.InnerText; Logger.Write("Name : " + newMetaGroup.Name); break; case "InnerMetaGroup": MetaGroup innerMetaGroup = new MetaGroup(); innerMetaGroup.Name = childNode.InnerText; newMetaGroup.InnerMetaGroups.Add(innerMetaGroup); Logger.Write("InnerMetaGroups : " + innerMetaGroup.Name); break; case "InnerComputerGroup": newMetaGroup.InnerComputerGroups.Add(new ComputerGroup(childNode.InnerText, Guid.NewGuid())); Logger.Write("InnerComputerGroups : " + childNode.InnerText); break; default: break; } } return(newMetaGroup); }
internal frmMetaGroupCreation(List <MetaGroup> metaGroups, ComputerGroup computerGroups) { Logger.EnteringMethod("frmMetaGroupCreation"); CommonInitialization(metaGroups, computerGroups); newMetaGroup = new MetaGroup(); Editing = false; }
internal frmMetaGroupCreation(List <MetaGroup> metaGroups, ComputerGroup computerGroups, MetaGroup metaGroupToEdit) { Logger.EnteringMethod("frmMetaGroupCreation"); metaGroups.Remove(metaGroupToEdit); CommonInitialization(metaGroups, computerGroups); txtBxMetaGroupName.Text = metaGroupToEdit.Name; SelectMetaGroup(metaGroupToEdit); SelectComputersGroups(metaGroupToEdit); newMetaGroup = metaGroupToEdit; Editing = true; }
private void btnEdit_Click(object sender, EventArgs e) { Logger.EnteringMethod(); MetaGroup metaGroupToEdit = (MetaGroup)cmbBxMetaGroups.SelectedItem; frmMetaGroupCreation metaGroupCreation = new frmMetaGroupCreation(_metaGroups, _computerGroups, metaGroupToEdit); if (metaGroupCreation.ShowDialog() == System.Windows.Forms.DialogResult.OK) { _metaGroups = metaGroupCreation.MetaGroupList; FillMetaGroups(); } metaGroupCreation.Dispose(); metaGroupCreation = null; }
private void dtGrdVwMetaGroup_CellClick(object sender, DataGridViewCellEventArgs e) { Logger.EnteringMethod(); if (e.RowIndex != -1) { DataGridViewRow clickedRow = dtGrdVwMetaGroup.Rows[e.RowIndex]; MetaGroup clickedMetaGroup = (MetaGroup)clickedRow.Cells["MetaGroup"].Value; bool selected = (bool)clickedRow.Cells["Selected"].Value; clickedRow.Selected = !selected; clickedRow.Cells["Selected"].Value = !selected; AdjustComputerGroupState(clickedMetaGroup, !selected); } }
private void btnDelete_Click(object sender, EventArgs e) { Logger.EnteringMethod(); MetaGroup metaGroupToDelete = (MetaGroup)cmbBxMetaGroups.SelectedItem; _metaGroups.Remove(metaGroupToDelete); foreach (MetaGroup metaGroup in _metaGroups) { if (metaGroup.InnerMetaGroups.Contains(metaGroupToDelete)) { metaGroup.InnerMetaGroups.Remove(metaGroupToDelete); } } FillMetaGroups(); }
private void SelectComputersGroups(MetaGroup metaGroupToEdit) { Logger.EnteringMethod(metaGroupToEdit.Name); foreach (ComputerGroup group in metaGroupToEdit.InnerComputerGroups) { foreach (object obj in chkCmbBxComputerGroups.Items) { if (group.Name == (obj as ComputerGroup).Name) { chkCmbBxComputerGroups.SelectItem(obj, true); break; } } } }
private void SelectMetaGroup(MetaGroup selectedMetaGroup) { Logger.EnteringMethod(selectedMetaGroup.Name); foreach (DataGridViewRow row in dtGrdVwMetaGroups.Rows) { row.Selected = false; foreach (MetaGroup innerMetaGroup in selectedMetaGroup.InnerMetaGroups) { if ((row.Cells["MetaGroupName"].Value as MetaGroup).Name == innerMetaGroup.Name) { row.Selected = true; break; } } } }
private void ShowComputersGroup(MetaGroup selectedMetaGroup) { Logger.EnteringMethod(selectedMetaGroup.Name); foreach (DataGridViewRow row in dtGrdVwComputerGroups.Rows) { row.Selected = false; foreach (ComputerGroup group in selectedMetaGroup.InnerComputerGroups) { if ((row.Cells["ComputerGroupName"].Value as ComputerGroup).Name == group.Name) { row.Selected = true; break; } } } }
internal void QuicklyApprove(MetaGroup selectedMetaGroup) { Logger.EnteringMethod(); foreach (DataGridViewRow row in dgvTargetGroup.Rows) { row.Selected = false; row.Cells["Approval"].Value = resMan.GetString(ApprovalObject.Approvals.Unchanged.ToString()); row.Cells["DeadLine"].Value = null; } AdjustComputerGroupState(selectedMetaGroup, true); foreach (DataGridViewRow row in dgvTargetGroup.Rows) { if (row.Selected) { row.Cells["Approval"].Value = resMan.GetString(ApprovalObject.Approvals.ApproveForInstallation.ToString()); } } SetApprovals(); }
private void AdjustComputerGroupState(MetaGroup clickedMetaGroup, bool state) { Logger.EnteringMethod(); foreach (ComputerGroup computerGroupToSelect in clickedMetaGroup.InnerComputerGroups) { foreach (DataGridViewRow row in dgvTargetGroup.Rows) { if ((ComputerGroup)row.Cells["Group"].Value == computerGroupToSelect) { row.Selected = state; break; } } } foreach (MetaGroup metaGroup in clickedMetaGroup.InnerMetaGroups) { AdjustComputerGroupState(metaGroup, state); } }
private void updateListViewer1_QuicklyApproveUpdate(UpdateCollection udpatesToApprove, MetaGroup metaGroup) { FrmApprovalSet approvalForm = new FrmApprovalSet(_metaGroups, _computerGroups, udpatesToApprove); approvalForm.QuicklyApprove(metaGroup); updateDetailViewer1.RunningLongOperation(true); updateListViewer1.RunningLongOperation(true); foreach (IUpdate updateToApprove in updateDetailViewer1.ViewedUpdates) { foreach (ApprovalObject approval in approvalForm.Approvals) { _wsus.ApproveUpdateForInstallation(approval.GroupId, updateToApprove); updateDetailViewer1.Refresh(); updateListViewer1.Refresh(); this.Refresh(); System.Threading.Thread.Sleep(50); } } updateDetailViewer1.RunningLongOperation(false); updateListViewer1.RunningLongOperation(false); }