//список стран, в которых есть экскурсии private KeyValuePair <string, string>[] GetCountriesList() { var selectQuery = "select name, lname, inc from state where inc in (select state from region where inc in (select region from excurs))"; //текущий язык DataSet set = DatabaseOperationProvider.Query(selectQuery, "regions", new { }); var countries = new List <KeyValuePair <string, string> >(); foreach (DataRow row in set.Tables["regions"].Rows) { var slug = StringsHelper.GenerateSlug(row["lname"].ToString()); if (slug == "") { continue; } if (UrlLanguage.CurrentLanguage == "ru") { countries.Add(new KeyValuePair <string, string>(slug, row["name"].ToString())); } else { countries.Add(new KeyValuePair <string, string>(slug, row["lname"].ToString())); } } return(countries.ToArray()); }
//по слагу определяем регион public static int?GetRegionBySlug(string slug) { var selectQuery = "select name, lname, inc from region where inc in (select region from excurs)"; //текущий язык DataSet set = DatabaseOperationProvider.Query(selectQuery, "regions", new { }); var regions = new List <KeyValuePair <string, string> >(); foreach (DataRow row in set.Tables["regions"].Rows) { var regionslug = StringsHelper.GenerateSlug(row["lname"].ToString()); if (regionslug == slug) { return(row.ReadInt("inc")); } } return(null); }