Beispiel #1
0
        /// <summary>
        /// Получение данных регионов
        /// </summary>
        /// <param name="db">БД</param>
        public IQueryable <Regions> RegionsFiltered(AddressSystemContext db)
        {
            var regions = from m in db.Regions
                          select m;

            return(regions);
        }
Beispiel #2
0
        /// <summary>
        /// Получение списка районов исходя из региона
        /// </summary>
        /// <param name="db">БД</param>
        /// <param name="regions">Список регионов</param>
        public SelectList AreasList(AddressSystemContext db, SelectList regions)
        {
            IQueryable <Areas> FilterAreas = db.Areas.Where(c => c.RegionId == Convert.ToInt32(regions.SelectedValue));
            int        AreaNum             = FilterAreas.Count() == 0 ? 0 : FilterAreas.First().AreaId;
            SelectList areas = new SelectList(FilterAreas, "AreaId", "AreaName", AreaNum);

            return(areas);
        }
Beispiel #3
0
        /// <summary>
        /// Получение списка ЭПС пунктов исходя из населенных пунктов
        /// </summary>
        /// <param name="db">БД</param>
        /// <param name="localities">Список населенных пунктов</param>
        public SelectList DistrictsList(AddressSystemContext db, SelectList localities)
        {
            IQueryable <Districts> FilterDistricts = db.Districts.Where(c => c.LocalityId == Convert.ToInt32(localities.SelectedValue));
            int        DistrictsNum = FilterDistricts.Count() == 0 ? 0 : FilterDistricts.First().DistrictId;
            SelectList districts    = new SelectList(FilterDistricts, "DistrictId", "DistrictName", DistrictsNum);

            return(districts);
        }
Beispiel #4
0
        /// <summary>
        /// Получение списка населенных пунктов исходя из районов
        /// </summary>
        /// <param name="db">БД</param>
        /// <param name="areas">Список районов</param>
        public SelectList LocalitiesList(AddressSystemContext db, SelectList areas)
        {
            IQueryable <Localities> FilterLocalities = db.Localities.Where(c => c.AreaId == Convert.ToInt32(areas.SelectedValue));
            int        LocalitiesNum = FilterLocalities.Count() == 0 ? 0 : FilterLocalities.First().LocalityId;
            SelectList localities    = new SelectList(FilterLocalities, "LocalityId", "LocalityName", LocalitiesNum);

            return(localities);
        }
Beispiel #5
0
        /// <summary>
        /// Получение списка домов исходя из улиц
        /// </summary>
        /// <param name="db">БД</param>
        /// <param name="streets">Список улиц</param>
        public SelectList HousesList(AddressSystemContext db, SelectList streets)
        {
            IQueryable <Houses> FilterHouses = db.Houses.Where(c => c.StreetId == Convert.ToInt32(streets.SelectedValue));
            int        HousesNum             = FilterHouses.Count() == 0 ? 0 : FilterHouses.First().HouseId;
            SelectList houses = new SelectList(FilterHouses, "HouseId", "HouseNum", HousesNum);

            return(houses);
        }
Beispiel #6
0
        /// <summary>
        /// Получение списка улиц исходя из ЭПС
        /// </summary>
        /// <param name="db">БД</param>
        /// <param name="districts">Список ЭПС</param>
        public SelectList StreetsList(AddressSystemContext db, SelectList districts)
        {
            IQueryable <Streets> FilterStreets = db.Streets.Where(c => c.DistrictId == Convert.ToInt32(districts.SelectedValue));
            int        StreetsNum = FilterStreets.Count() == 0 ? 0 : FilterStreets.First().StreetId;
            SelectList streets    = new SelectList(FilterStreets, "StreetId", "StreetName", StreetsNum);

            return(streets);
        }
Beispiel #7
0
        /// <summary>
        /// Получение данных районов
        /// </summary>
        /// <param name="db">БД</param>
        public IQueryable <DataAreas> AreasFiltered(AddressSystemContext db)
        {
            var areas = from p in db.Areas
                        join c in db.Regions on p.RegionId equals c.RegionId
                        orderby p.AreaId
                        select new DataAreas {
                AreaId = p.AreaId, AreaName = p.AreaName, RegionName = c.RegionName, RegionId = c.RegionId
            };

            return(areas);
        }
Beispiel #8
0
        /// <summary>
        /// Получение данных населенных пунктов
        /// </summary>
        /// <param name="db">БД</param>
        public IQueryable <DataLocalities> LocalitiesFiltered(AddressSystemContext db)
        {
            var localities = from p in db.Localities
                             join b in db.Areas on p.AreaId equals b.AreaId
                             join c in db.Regions on b.RegionId equals c.RegionId
                             orderby p.LocalityId
                             select new DataLocalities {
                LocalityId = p.LocalityId, LocalityName = p.LocalityName, AreaId = p.AreaId, AreaName = b.AreaName, RegionName = c.RegionName, RegionId = c.RegionId
            };

            return(localities);
        }
Beispiel #9
0
        /// <summary>
        /// Получение данных ЭПС
        /// </summary>
        /// <param name="db">БД</param>
        public IQueryable <DataDistricts> DistrictsFiltered(AddressSystemContext db)
        {
            var districts = from p in db.Districts
                            join a in db.Localities on p.LocalityId equals a.LocalityId
                            join b in db.Areas on a.AreaId equals b.AreaId
                            join c in db.Regions on b.RegionId equals c.RegionId
                            orderby p.DistrictId
                            select new DataDistricts {
                DistrictId = p.DistrictId, DistrictName = p.DistrictName, LocalityId = a.LocalityId, LocalityName = a.LocalityName, AreaId = b.AreaId, AreaName = b.AreaName, RegionName = c.RegionName, RegionId = c.RegionId
            };

            return(districts);
        }
Beispiel #10
0
        /// <summary>
        /// Получение данных улиц
        /// </summary>
        /// <param name="db">БД</param>
        public IQueryable <DataStreets> StreetsFiltered(AddressSystemContext db)
        {
            var streets = from d in db.Streets
                          join p in db.Districts on d.DistrictId equals p.DistrictId
                          join a in db.Localities on p.LocalityId equals a.LocalityId
                          join b in db.Areas on a.AreaId equals b.AreaId
                          join c in db.Regions on b.RegionId equals c.RegionId
                          orderby d.StreetId
                          select new DataStreets {
                StreetId = d.StreetId, StreetName = d.StreetName, DistrictId = p.DistrictId, DistrictName = p.DistrictName, LocalityId = a.LocalityId, LocalityName = a.LocalityName, AreaId = b.AreaId, AreaName = b.AreaName, RegionName = c.RegionName, RegionId = c.RegionId
            };

            return(streets);
        }
Beispiel #11
0
        /// <summary>
        /// Получение данных домов
        /// </summary>
        /// <param name="db">БД</param>
        public IQueryable <DataHouses> HousesFiltered(AddressSystemContext db)
        {
            var houses = from e in db.Houses
                         join d in db.Streets on e.StreetId equals d.StreetId
                         join p in db.Districts on d.DistrictId equals p.DistrictId
                         join a in db.Localities on p.LocalityId equals a.LocalityId
                         join b in db.Areas on a.AreaId equals b.AreaId
                         join c in db.Regions on b.RegionId equals c.RegionId
                         orderby e.HouseId
                         select new DataHouses {
                HouseId = e.HouseId, HouseNum = e.HouseNum, Index = e.Index, Floors = e.Floors, Entrances = e.Entrances, Flats = e.Flats, StreetId = d.StreetId, StreetName = d.StreetName, DistrictId = p.DistrictId, DistrictName = p.DistrictName, LocalityId = a.LocalityId, LocalityName = a.LocalityName, AreaId = b.AreaId, AreaName = b.AreaName, RegionName = c.RegionName, RegionId = c.RegionId
            };

            return(houses);
        }
Beispiel #12
0
        /// <summary>
        /// Получение списка ЭПС пунктов исходя из населенных пунктов
        /// </summary>
        /// <param name="db">БД</param>
        /// <param name="OurLocalityId">Выбранный населенный пункт</param>
        /// <param name="OuDistrictId">Выбранный ЭПС по умолчанию</param>
        public SelectList DistrictsList(AddressSystemContext db, int OurLocalityId, int OuDistrictId)
        {
            SelectList districts = new SelectList(db.Districts.Where(c => c.LocalityId == OurLocalityId), "DistrictId", "DistrictName", OuDistrictId);

            return(districts);
        }
Beispiel #13
0
        /// <summary>
        /// Получение списка населенных пунктов исходя из районов
        /// </summary>
        /// <param name="db">БД</param>
        /// <param name="OurAreaId">Выбранный район</param>
        /// <param name="OurLocalityId">Выбранный населенный пункт по умолчанию</param>
        public SelectList LocalitiesList(AddressSystemContext db, int OurAreaId, int OurLocalityId)
        {
            SelectList localities = new SelectList(db.Localities.Where(c => c.AreaId == OurAreaId), "LocalityId", "LocalityName", OurLocalityId);

            return(localities);
        }
Beispiel #14
0
        /// <summary>
        /// Получение списка районов исходя из региона
        /// </summary>
        /// <param name="db">БД</param>
        /// <param name="OurRegId">Выбранный регион</param>
        /// <param name="OurAreaId">Выбранный район по умолчанию</param>
        public SelectList AreasList(AddressSystemContext db, int OurRegId, int OurAreaId)
        {
            SelectList areas = new SelectList(db.Areas.Where(c => c.RegionId == OurRegId), "AreaId", "AreaName", OurAreaId);

            return(areas);
        }
Beispiel #15
0
        /// <summary>
        /// Получение списка регионов
        /// </summary>
        /// <param name="db">БД</param>
        /// <param name="RegionNum">Выбранный регион по умолчанию</param>
        public SelectList RegionsList(AddressSystemContext db, int RegionNum)
        {
            SelectList regions = new SelectList(db.Regions, "RegionId", "RegionName", RegionNum);

            return(regions);
        }
Beispiel #16
0
        /// <summary>
        /// Получение списка улиц исходя из ЭПС
        /// </summary>
        /// <param name="db">БД</param>
        /// <param name="OuDistrictId">Выбранный ЭПС</param>
        /// <param name="OuStreetId">Выбранная улица по умолчанию</param>
        public SelectList StreetsList(AddressSystemContext db, int OuDistrictId, int OuStreetId)
        {
            SelectList streets = new SelectList(db.Streets.Where(c => c.DistrictId == OuDistrictId), "StreetId", "StreetName", OuStreetId);

            return(streets);
        }