Пример #1
0
        /// <summary>
        /// Get a dictionary where key is location id and value is district name. Is used for dropdowns.
        /// </summary>
        public static Dictionary <string, string> GetDistrictsOfTown(string town)
        {
            Dictionary <string, string> result = new Dictionary <string, string>();

            foreach (var row in LocationCache.Query(new SqlFieldsQuery($"select _key, District from Locations where Town='{town}';")))
            {
                result[row[0].ToString()] = row[1] as string;
            }
            return(result);
        }
Пример #2
0
        /// <summary>
        /// Get list of towns of metioned region. Is used for dropdowns.
        /// </summary>
        public static ICollection <string> GetTownsOfRegion(string region)
        {
            List <string> result = new List <string>();

            foreach (var row in LocationCache.Query(new SqlFieldsQuery($"select distinct Town from Locations where Region='{region}';")))
            {
                result.Add(row[0] as string);
            }
            return(result);
        }