Пример #1
0
        // Puni model detaljima o zgradi koja se nalazi u gradu sa cityID, u redu row i koloni column

        public void fillBuildingsDetailsModel(int cityID, int row, int column, RS2Entities entities)
        {
            try
            {
                var result = (from BUILDING in entities.buildings
                              join CITY_BUILDINGS in entities.city_buildings on BUILDING.id equals CITY_BUILDINGS.building_id
                              where (CITY_BUILDINGS.city_id == cityID &&
                                     CITY_BUILDINGS.building_positionX == row &&
                                     CITY_BUILDINGS.building_positionY == column)
                              select new
                {
                    resultBuilding = BUILDING,
                    resultCityBuildings = CITY_BUILDINGS
                }
                              ).First();

                BuildingModel      = result.resultBuilding;
                CityBuildingsModel = result.resultCityBuildings;
            }
            catch
            {
                this.BuildingModel      = null;
                this.CityBuildingsModel = null;
            }
        }
Пример #2
0
 public void fillUserDetailsModel(user User, RS2Entities entities)
 {
     this.User   = User;
     this.Cities = (from USER in entities.users
                    join USERCITY in entities.user_cities on USER.id equals USERCITY.user_id
                    join CITY in entities.cities on USERCITY.city_id equals CITY.id
                    where USER.id == User.id
                    select CITY
                    ).ToList();
 }
Пример #3
0
        public void fillCityDetailsModel(city City, RS2Entities entities)
        {
            BuildingDetailsList.Clear();

            this.City = City;

            this.CityType = (from CITY_TYPES in entities.city_types
                             where CITY_TYPES.id == City.city_type
                             select CITY_TYPES).First();

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    BuildingDetailsModel current = new BuildingDetailsModel();
                    current.fillBuildingsDetailsModel(City.id, i, j, entities);
                    BuildingDetailsList.Add(current);
                }
            }
        }
Пример #4
0
        public void fillAddBuildingModel(UserDetailsModel U, int cityID, int row, int column, RS2Entities entities)
        {
            AvailableBuildings.Clear();

            this.UserDetailsModel = U;
            this.cityID           = cityID;
            this.row                = row;
            this.column             = column;
            this.AvailableBuildings = (from BUILDING in entities.buildings
                                       select BUILDING).ToList();
        }