///// <summary>
        ///// Retrieves source code of the check specified by check name.
        ///// This source code can be later compiled into binary assembly by OSLEBot.
        ///// </summary>
        ///// <param name="checkName">Name of the check whose source code needs to be retrieved.</param>
        ///// <returns>Source code string. This should be written into a temporary *.cs file if you want to have OSLEBot compile it.</returns>
        ///// <exception cref="ArgumentOutOfRangeException">Thrown when a check with the specified name is not found.</exception>
        ///// <exception cref="ArgumentException">Thrown when more than 1 check matches the specified name. This indicates data inconsistency.</exception>
        //public string GetCheckSourceCode(string checkName)
        //{
        //    var matches = from check in Checks
        //                  where check.Name == checkName
        //                  select check;
        //    if (matches.Count() == 0)
        //        throw new ArgumentOutOfRangeException("checkName", "The specified check not found");
        //    if (matches.Count() > 1)
        //        throw new ArgumentException("Data inconsistency. Found more than 1 check with the same name.",
        //                                    "checkName");
        //    return matches.Single().SourceCode;
        //}

        /// <summary>
        /// Fills this data set with test (sample) data.
        /// </summary>
        public void FillWithTestData()
        {
            Clear();
            var check1 = Checks.AddChecksRow("FedericaTest.cs", "Test for Federica", "");
            var check2 = Checks.AddChecksRow("Branding.cs", "This is check 2", "");
            var check3 = Checks.AddChecksRow("PseudoLoc.cs", "This is check 3", "");
            var check4 = Checks.AddChecksRow("InvalidLocVer.cs", "This is global check for testing globality detection", "");
            var check5 = Checks.AddChecksRow("EACheck.cs", "This is a check that is global for all languages", "");
            var check6 = Checks.AddChecksRow("WordTemplatesMailMerge.cs", "This is a second check that is global for all languages", "");

            var enUS   = Languages.AddLanguagesRow("en-us");
            var frFR   = Languages.AddLanguagesRow("fr-fr");
            var deDE   = Languages.AddLanguagesRow("de-de");
            var pseudo = Languages.AddLanguagesRow("ja-jp.pseudo");
            var plPL   = Languages.AddLanguagesRow("pl-pl");
            var jaJP   = Languages.AddLanguagesRow("ja-jp");
            var brBR   = Languages.AddLanguagesRow("br-BR");

            var msoProject    = Projects.AddProjectsRow("mso");
            var wordProject   = Projects.AddProjectsRow("word");
            var excelProject  = Projects.AddProjectsRow("excel");
            var accessProject = Projects.AddProjectsRow("access");

            LocGroups.AddLocGroupsRow("main_dll", msoProject);
            LocGroups.AddLocGroupsRow("main_dll", wordProject);
            LocGroups.AddLocGroupsRow("main_dll", excelProject);
            var wordTemplates = LocGroups.AddLocGroupsRow("wordtemplates", wordProject);
            var xlintl        = LocGroups.AddLocGroupsRow("xlintl", excelProject);
            var accintl       = LocGroups.AddLocGroupsRow("acc_intl", accessProject);

            ConfigItems.AddConfigItemsRow(pseudo, check1, wordTemplates);
            ConfigItems.AddConfigItemsRow(pseudo, check1, xlintl);
            ConfigItems.AddConfigItemsRow(plPL, check1, wordTemplates);
            ConfigItems.AddConfigItemsRow(enUS, check2, xlintl);
            ConfigItems.AddConfigItemsRow(frFR, check3, accintl);
            ConfigItems.AddConfigItemsRow(frFR, check2, wordTemplates);

            foreach (var lg in LocGroups)
            {
                ConfigItems.AddConfigItemsRow(plPL, check4, lg);
                ConfigItems.AddConfigItemsRow(brBR, check4, lg);
                ConfigItems.AddConfigItemsRow(jaJP, check1, lg);
            }
            SetCheckGlobalForAllLanguages(check5);
            SetCheckGlobalForAllLanguages(check6);

            var allChecksTag = Tags.AddTagsRow("All checks");

            Checks.ToList().ForEach(check => CheckTags.AddCheckTagsRow(check, allChecksTag));

            var eaLanguagesTag = Tags.AddTagsRow("EA languages");

            Languages.ToList().ForEach(language => LanguageTags.AddLanguageTagsRow(language, eaLanguagesTag));

            var allProjectsTag = Tags.AddTagsRow("All projects");

            Projects.ToList().ForEach(project => ProjectTags.AddProjectTagsRow(project, allProjectsTag));
        }
 /// <summary>
 /// Fills this data set with sample testable in a dataset. Dataset can be then modified.
 /// </summary>
 public void SetCheckGlobalForAllLanguages(CheckConfiguration.ChecksRow checkRow)
 {
     foreach (var language in Languages)
     {
         foreach (var lg in LocGroups)
         {
             ConfigItems.AddConfigItemsRow(language, checkRow, lg);
         }
     }
 }
        public void OldEnableCheckForLanguage(string checkName, string languageName)
        {
            var languageRow = (from language in Languages
                               where language.Name == languageName
                               select language).Single();
            var checkRow = (from check in Checks
                            where check.Name == checkName
                            select check).Single();

            foreach (var lg in LocGroups)
            {
                try
                {
                    ConfigItems.AddConfigItemsRow(languageRow, checkRow, lg);
                }
                catch (ConstraintException ex)
                {
                    LoggerSAP.Trace(ex.Message);
                }
            }
        }