private clsConfig.ComputerGroupRegexCollection CollateForm() { clsConfig.ComputerGroupRegexCollection c = new clsConfig.ComputerGroupRegexCollection(); // Resort grid SortByPriority(); // Loop through each line in the form and add it if it's valid. foreach (DataGridViewRow r in grdRegEx.Rows) { if (ValidateRow(r) == "OK" && !r.IsNewRow) { clsConfig.ComputerGroupRegEx rx = new clsConfig.ComputerGroupRegEx(); rx.Priority = int.Parse(r.Cells["rxPriority"].Value.ToString()); rx.ComputerNameRegex = (string)r.Cells["rxComputerRegEx"].Value; rx.IPRegex = (string)r.Cells["rxIPRegEx"].Value; rx.ComputerGroup = (string)r.Cells["rxComputerGroup"].Value; rx.Comment = (string)r.Cells["rxComment"].Value; if (r.Cells["rxEnabled"].Value == null) { rx.Enabled = false; } else { rx.Enabled = (bool)r.Cells["rxEnabled"].Value; } c.Add(rx); } } return(c); }
private clsConfig.ComputerGroupRegexCollection CollateForm() { clsConfig.ComputerGroupRegexCollection c = new clsConfig.ComputerGroupRegexCollection(); // Resort grid SortByPriority(); // Loop through each line in the form and add it if it's valid. foreach (DataGridViewRow r in grdRegEx.Rows) { if (ValidateRow(r) == "OK" && !r.IsNewRow) { clsConfig.ComputerGroupRegEx rx = new clsConfig.ComputerGroupRegEx(); rx.Priority = int.Parse(r.Cells["rxPriority"].Value.ToString()); rx.ComputerNameRegex = (string)r.Cells["rxComputerRegEx"].Value; rx.IPRegex = (string)r.Cells["rxIPRegEx"].Value; rx.ComputerGroup = (string)r.Cells["rxComputerGroup"].Value; rx.Comment = (string)r.Cells["rxComment"].Value; if (r.Cells["rxEnabled"].Value == null) rx.Enabled = false; else rx.Enabled = (bool)r.Cells["rxEnabled"].Value; c.Add(rx); } } return c; }