Example #1
0
        /// <summary>
        /// Establishes an association between a check and a project.
        /// </summary>
        /// <param name="checkName">Check to enable on project.</param>
        /// <param name="project">Project to enable check on.</param>
        public void EnableCheckForProject(string checkName, string project)
        {
            var checkRow   = Checks.Single(c => c.Name.Equals(checkName));
            var projectRow = Projects.Single(p => p.Name.Equals(project));

            if (ProjectChecks.Any(row => row.CheckID == checkRow.ID && row.ProjectID == projectRow.ID))
            {
                return;
            }
            ProjectChecks.AddProjectChecksRow(checkRow, projectRow);
        }
Example #2
0
        /// <summary>
        /// Establishes or removes an association between a check and all projects.
        /// </summary>
        /// <param name="checkName">Check to enable or disable on all projects.</param>
        /// <param name="enable">If true, an association will be established. If false, the association will be removed if any.</param>
        public void EnableCheckForAllProjects(object checkName, bool enable)
        {
            var checkRow = Checks.Single(c => c.Name.Equals(checkName));

            if (enable)
            {
                //Add any missing entries for this check
                foreach (var projectRow in Projects)
                {
                    if (ProjectChecks.Any(row => row.CheckID == checkRow.ID && row.ProjectID == projectRow.ID))
                    {
                        continue;
                    }
                    ProjectChecks.AddProjectChecksRow(checkRow, projectRow);
                }
            }
            else
            {
                //Remove existing entries for this check
                ProjectChecks.Where(c => c.ChecksRow.Name.Equals(checkName)).ToList().ForEach(ProjectChecks.RemoveProjectChecksRow);
            }
        }