Beispiel #1
0
 internal frmMetaGroupCreation(List <MetaGroup> metaGroups, ComputerGroup computerGroups)
 {
     Logger.EnteringMethod("frmMetaGroupCreation");
     CommonInitialization(metaGroups, computerGroups);
     newMetaGroup = new MetaGroup();
     Editing      = false;
 }
Beispiel #2
0
 internal void SetComputerGroups(ComputerGroup computerGroups, TreeNode allComputersNode)
 {
     Logger.EnteringMethod();
     _computerGroups   = computerGroups;
     _allComputersNode = allComputersNode;
     updateDetailViewer1.SetComputerGroups(computerGroups, allComputersNode);
 }
Beispiel #3
0
 private void FillComputerGroup(ComputerGroup group)
 {
     Logger.EnteringMethod();
     dgvTargetGroup.Rows.Add(group);
     foreach (ComputerGroup innerGroup in group.InnerComputerGroup)
     {
         FillComputerGroup(innerGroup);
     }
 }
Beispiel #4
0
 private void FillComputerGroups(ComputerGroup computerGroups)
 {
     Logger.EnteringMethod(computerGroups.Name);
     chkCmbBxComputerGroups.AddItem(computerGroups);
     foreach (ComputerGroup group in computerGroups.InnerComputerGroup)
     {
         FillComputerGroups(group);
     }
 }
Beispiel #5
0
 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;
 }
Beispiel #6
0
        private void FillComputerGroup(ComputerGroup group)
        {
            Logger.EnteringMethod(group.Name);
            int index = dtGrdVwComputerGroups.Rows.Add();

            dtGrdVwComputerGroups.Rows[index].Cells["ComputerGroupName"].Value = group;

            foreach (ComputerGroup innerGroup in group.InnerComputerGroup)
            {
                FillComputerGroup(innerGroup);
            }
        }
Beispiel #7
0
        internal frmMetaGroups(List <MetaGroup> metaGroups, ComputerGroup computerGroups)
        {
            Logger.EnteringMethod("frmMetaGroups");
            InitializeComponent();

            _metaGroups = metaGroups;
            FillMetaGroups();
            _computerGroups = computerGroups;
            FillComputerGroup(computerGroups);
            Localize();
            AdjustSplitterDistance();
        }
Beispiel #8
0
        internal FrmApprovalSet(List <MetaGroup> metaGroups, ComputerGroup computersGroup, UpdateCollection updatesToApprove)
        {
            Logger.EnteringMethod("FrmApprovalSet");
            InitializeComponent();

            _wsus             = WsusWrapper.GetInstance();
            _allComputerGroup = _wsus.GetAllComputerTargetGroup();
            _metaGroups       = metaGroups;
            _computersGroup   = computersGroup;
            dtDeadLine.Value  = DateTime.Now.AddDays(_wsus.CurrentServer.DeadLineDaysSpan);
            nupHour.Value     = _wsus.CurrentServer.DeadLineHour;
            nupMinute.Value   = _wsus.CurrentServer.DeadLineMinute;
            FillDataGridView(updatesToApprove, metaGroups, computersGroup);
        }
Beispiel #9
0
        private void CommonInitialization(List <MetaGroup> metaGroups, ComputerGroup computerGroups)
        {
            Logger.EnteringMethod();
            InitializeComponent();
            _metaGroups     = metaGroups;
            _computerGroups = computerGroups;

            foreach (MetaGroup metaGroup in metaGroups)
            {
                chkCmbBxMetaGroups.AddItem(metaGroup);
            }

            FillComputerGroups(computerGroups);
        }
Beispiel #10
0
        internal frmMetaGroups(List <MetaGroup> metaGroups, ComputerGroup computerGroups, string metaGroupToEdit)
        {
            Logger.EnteringMethod("frmMetaGroups");
            InitializeComponent();

            _metaGroups = metaGroups;
            FillMetaGroups();
            _computerGroups = computerGroups;
            FillComputerGroup(computerGroups);
            Localize();
            foreach (MetaGroup item in cmbBxMetaGroups.Items)
            {
                if (item.Name == metaGroupToEdit)
                {
                    cmbBxMetaGroups.SelectedItem = item;
                    break;
                }
            }
            AdjustSplitterDistance();
        }
Beispiel #11
0
        private void FillDataGridView(UpdateCollection updatesToApprove, List <MetaGroup> metaGroups, ComputerGroup computersGroup)
        {
            Logger.EnteringMethod();
            bool uninstallAllowed = IsUninstallationAllowed(updatesToApprove);

            object[] approvalsObj;

            if (uninstallAllowed)
            {
                lblUninstallationAllowed.Text = resMan.GetString("UninstallationAllowed");
                approvalsObj = new object[]
                { resMan.GetString(ApprovalObject.Approvals.Unchanged.ToString()),
                  resMan.GetString(ApprovalObject.Approvals.ApproveForInstallation.ToString()),
                  resMan.GetString(ApprovalObject.Approvals.ApproveForOptionalInstallation.ToString()),
                  resMan.GetString(ApprovalObject.Approvals.ApproveForUninstallation.ToString()),
                  resMan.GetString(ApprovalObject.Approvals.NotApproved.ToString()) };
            }
            else
            {
                lblUninstallationAllowed.Text = resMan.GetString("UninstallationDisallowed");
                approvalsObj = new object[]
                { resMan.GetString(ApprovalObject.Approvals.Unchanged.ToString()),
                  resMan.GetString(ApprovalObject.Approvals.ApproveForInstallation.ToString()),
                  resMan.GetString(ApprovalObject.Approvals.ApproveForOptionalInstallation.ToString()),
                  resMan.GetString(ApprovalObject.Approvals.NotApproved.ToString()) };
            }
            DateTime noDeadLineSet = DateTime.MaxValue;

            dgvTargetGroup.SuspendLayout();
            DataGridViewComboBoxColumn approvalColumn = (DataGridViewComboBoxColumn)dgvTargetGroup.Columns["Approval"];

            approvalColumn.Items.AddRange(approvalsObj);
            cmbBxApproval.Items.AddRange(approvalsObj);
            cmbBxApproval.SelectedIndex = 0;

            FillMetaGroup(metaGroups);
            FillComputerGroup(computersGroup);

            foreach (DataGridViewRow row in dgvTargetGroup.Rows)
            {
                if ((row.Cells["Group"].Value as ComputerGroup).ComputerGroupId == _allComputerGroup.Id)
                {
                    (row.Cells["Approval"] as DataGridViewComboBoxCell).Items.Remove(resMan.GetString(ApprovalObject.Approvals.NotApproved.ToString()));
                }
                if (updatesToApprove.Count == 1)
                {
                    UpdateApprovalCollection approvals = _wsus.GetUpdateApprovalStatus((row.Cells["Group"].Value as ComputerGroup).ComputerGroupId, updatesToApprove[0]);
                    if (approvals.Count != 0)
                    {
                        switch (approvals[0].Action)
                        {
                        case UpdateApprovalAction.All:
                            row.Cells["Approval"].Value = resMan.GetString(ApprovalObject.Approvals.Unchanged.ToString());
                            break;

                        case UpdateApprovalAction.Install:
                            if (approvals[0].IsOptional)
                            {
                                row.Cells["Approval"].Value = resMan.GetString(ApprovalObject.Approvals.ApproveForOptionalInstallation.ToString());
                            }
                            else
                            {
                                row.Cells["Approval"].Value = resMan.GetString(ApprovalObject.Approvals.ApproveForInstallation.ToString());
                            }
                            if (approvals[0].Deadline != noDeadLineSet)
                            {
                                row.Cells["DeadLine"].Value = approvals[0].Deadline.ToLocalTime();
                            }
                            break;

                        case UpdateApprovalAction.NotApproved:
                            row.Cells["Approval"].Value = resMan.GetString(ApprovalObject.Approvals.NotApproved.ToString());
                            break;

                        case UpdateApprovalAction.Uninstall:
                            row.Cells["Approval"].Value = resMan.GetString(ApprovalObject.Approvals.ApproveForUninstallation.ToString());
                            if (approvals[0].Deadline != noDeadLineSet)
                            {
                                row.Cells["DeadLine"].Value = approvals[0].Deadline.ToLocalTime();
                            }
                            break;

                        default:
                            row.Cells["Approval"].Value = resMan.GetString(ApprovalObject.Approvals.Unchanged.ToString());
                            break;
                        }
                    }
                    else
                    {
                        row.Cells["Approval"].Value = resMan.GetString(ApprovalObject.Approvals.Unchanged.ToString());
                    }
                }
                else
                {
                    row.Cells["Approval"].Value = resMan.GetString(ApprovalObject.Approvals.Unchanged.ToString());
                }
            }
            dgvTargetGroup.ResumeLayout();
        }