示例#1
0
 public PerGroupCollection(clsConfig.GroupUpdateRuleCollection groups)
 {
     // Loop through each group and add to the list and the dictionaries.  This is the only way items can be created.
     foreach (clsConfig.GroupUpdateRule ur in groups)
     {
         this.List.Add(new PerGroupInformation(ur));
     }
 }
示例#2
0
            // Class initialisation.  List of groups is also to be passed
            public UnapprovedUpdates(clsConfig configobject, clsConfig.GroupUpdateRuleCollection showgroups)
            {
                // Store the config object for use
                cfg = configobject;

                // Store the groups to be managed, sorting them by display order
                groups = showgroups;
                groups.SortByDisplayOrder();
            }
示例#3
0
 public UnapprovedUpdate(clsConfig.GroupUpdateRuleCollection groups, string updateid, string title, string description, string kbarticle, DateTime arrivaldate)
 {
     _groups      = new PerGroupCollection(groups);
     _updateid    = updateid;
     _title       = title;
     _description = description;
     _kbarticle   = kbarticle;
     _arrivaldate = arrivaldate;
 }
示例#4
0
        public DataTable GetUnapprovedUpdatesNew()
        {
            if (CheckDBConnection())
            {
                // Inject the right parameters into the Unapproved Updates query
                clsConfig.GroupUpdateRuleCollection ur = cfg.GroupUpdateRules;
                string[] parameters = new string[ur.Count];
                cmdUnapprovedUpdates.Parameters.Clear();

                // Build list of parameters
                for (int i = 0; i < ur.Count; i++)
                {
                    parameters[i] = string.Format("@Group{0}", i);
                }

                // Set SQL query
                cmdUnapprovedUpdates.CommandText = string.Format(strUnapprovedUpdates, string.Join(", ", parameters));

                // Build parameters
                for (int i = 0; i < ur.Count; i++)
                {
                    cmdUnapprovedUpdates.Parameters.Add(parameters[i], SqlDbType.NVarChar);
                    cmdUnapprovedUpdates.Parameters[parameters[i]].Value = ur[i].computergroup.Name;
                }

                // Associate with SQL query
                cmdUnapprovedUpdates.Connection = sql;

                // Run query and return results
                cmdUnapprovedUpdates.ExecuteNonQuery();

                SqlDataReader r = cmdUnapprovedUpdates.ExecuteReader();
                DataTable     t = new DataTable();

                // Load the data table
                t.Load(r);
                r.Close();

                return(t);
            }

            // DB Connection not OK - return a null table
            return(null);
        }
        public frmGroupUpdateRules(clsConfig cfgobject, clsWSUS wsusobject)
        {
            // Let the user know something is happening
            Cursor.Current = Cursors.WaitCursor;

            InitializeComponent();

            cfg  = cfgobject;
            wsus = wsusobject;

            // Get list of computer groups and sort it.
            gc         = wsus.ComputerGroups;
            groupnames = new List <string>();

            foreach (IComputerTargetGroup tg in gc)
            {
                groupnames.Add(tg.Name);
            }

            groupnames.Sort();

            // Read existing group rules
            grouprules = cfg.GroupUpdateRules;

            // Update treeview with existing rules
            UpdateGroupUpdateRules();

            // Set default display order (maximum + 1)
            numDisplayOrder.Value = grouprules.MaxDisplayOrder + 1;

            // Set this window to be marginly less wide than the current monitor
            Rectangle scr = Screen.FromControl(this).Bounds;

            // Make this window 20 pixels narrower than the current screen and centre it
            this.Left  = 10;
            this.Width = scr.Width - 20;

            // Note the current height of the form - this will be the minimum height of the form
            minheight = this.Height;

            // Finished - reset cursor to normal
            Cursor.Current = Cursors.Arrow;
        }
        public frmGroupUpdateRules(clsConfig cfgobject, clsWSUS wsusobject)
        {
            // Let the user know something is happening
            Cursor.Current = Cursors.WaitCursor;

            InitializeComponent();

            cfg = cfgobject;
            wsus = wsusobject;

            // Get list of computer groups and sort it.
            gc = wsus.ComputerGroups;
            groupnames = new List<string>();

            foreach (IComputerTargetGroup tg in gc) groupnames.Add(tg.Name);

            groupnames.Sort();

            // Read existing group rules
            grouprules = cfg.GroupUpdateRules;

            // Update treeview with existing rules
            UpdateGroupUpdateRules();

            // Set default display order (maximum + 1)
            numDisplayOrder.Value = grouprules.MaxDisplayOrder + 1;

            // Set this window to be marginly less wide than the current monitor
            Rectangle scr = Screen.FromControl(this).Bounds;

            // Make this window 20 pixels narrower than the current screen and centre it
            this.Left = 10;
            this.Width = scr.Width - 20;

            // Note the current height of the form - this will be the minimum height of the form
            minheight = this.Height;

            // Finished - reset cursor to normal
            Cursor.Current = Cursors.Arrow;
        }
示例#7
0
            // Class initialisation.  List of groups is also to be passed
            public UnapprovedUpdates(clsConfig configobject, clsConfig.GroupUpdateRuleCollection showgroups)
            {
                // Store the config object for use
                cfg = configobject;

                // Store the groups to be managed, sorting them by display order
                groups = showgroups;
                groups.SortByDisplayOrder();
            }