// GET: Departments public ActionResult Index() { var service = new BuildingService(); var model = service.GetBuildings(); return(View(model)); }
//building service constructor private BuildingService CreateBuildingService() { Guid userId = Guid.Parse(User.Identity.GetUserId()); BuildingService buildingService = new BuildingService(userId); return(buildingService); }
public BuildingController( IMapper mapper, BuildingService buildingService) { _mapper = mapper; _buildingService = buildingService; }
/// <summary> /// Constructor /// </summary> public BuildingViewModel(BuildingService buildingService, SuiteService suiteService) { BuildingServiceObj = buildingService; SuiteServiceObj = suiteService; PopulateBuildingsDataGrid(); SelectedBuilding = new Building(); _populateSuitesCommand = new DataGridSelectionChangedCommand(PopulateSuites, CanExecuteMethod); }
private void BuildingComboBoxList() //Column 5 { var Bui = BuildingService.GetBuilding().Select(x => x.Type); foreach (var bui in Bui) { BuildingComboBox.Items.Add(bui); } }
private void BuildingComboBoxList() //Column 5 { BuildingComboBox.Items.Clear(); var Bui = BuildingService.GetBuilding().Where(x => x.Id == Place_Id_Building).Select(x => x.Type); foreach (var bui in Bui) { BuildingComboBox.Items.Add(bui); } }
public async Task <IHttpActionResult> GetAllTasksForBuildingsById([FromUri] int id) { { //instantiate service BuildingService service = CreateBuildingService(); //return the values as an ienumerable IEnumerable <BuildingGetAllMaintenceTasks> building = await service.GetAllTasksInBuildingById(id); return(Ok(building)); } }
public async Task <IHttpActionResult> GetBuildingsById([FromUri] int id) { { //instantiate service BuildingService service = CreateBuildingService(); //return the values as an ienumerable IEnumerable <BuildingListItem> building = await service.GetBuildingById(id); return(Ok(building)); //200 } }
public async Task <IHttpActionResult> GetAllBuildings() { { //instantiate building service BuildingService service = CreateBuildingService(); //return the values as an ienumerable IEnumerable <BuildingListItem> buildings = await service.GetBuildings(); return(Ok(buildings)); //200 } }
public BuildPylonService(MacroData macroData, IBuildingBuilder buildingBuilder, SharkyUnitData sharkyUnitData, ActiveUnitData activeUnitData, BaseData baseData, TargetingData targetingData, BuildingService buildingService) { MacroData = macroData; BuildingBuilder = buildingBuilder; SharkyUnitData = sharkyUnitData; ActiveUnitData = activeUnitData; BaseData = baseData; TargetingData = targetingData; BuildingService = buildingService; defensivePointLastFailFrame = 0; }
public DataController(IMapper mapper, BuildingService buildingService, GuestStayService guestStayService, UnitService unitService, DataService dataService) { _mapper = mapper; _buildingService = buildingService; _guestStayService = guestStayService; _unitService = unitService; _dataService = dataService; }
// DELETE: api/Building/5 public IHttpActionResult Delete(int id) { bool result = new BuildingService().Remove(id); if (result) { return(Ok()); } else { return(Conflict()); } }
public async Task CreateBuildings(int countBuildings, int countEntrances) { IBuildingService buildingService = new BuildingService(); for (int i = 0; i < countBuildings; i++) { var res = await buildingService.CreateBuilding(new BuildingModel() { BuildingNumber = i + 1, }); await CreateEntrances(res.Id, countEntrances); } }
public async Task <IHttpActionResult> ActiveBuildingById([FromUri] int id) { { //instantiate the service BuildingService service = CreateBuildingService(); if (await service.ActiveBuildingById(id) == false) { return(InternalServerError()); } return(Ok("Active Status Updated")); //200 with custom message } }
private void frmBuildingDetails_Load(object sender, EventArgs e) { if (Op.Equals("edit")) { SetFields(); SetRoomGrid(); } if (Op.Equals("new")) { IBuildingService buildingService = new BuildingService(); BindRoomGrid(); } }
private void BuildingComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { BuildingSetType.Text = BuildingService.GetBuilding() .Where(x => (x.Type == BuildingComboBox.SelectedItem.ToString())) .Select(x => x.Type).FirstOrDefault().ToString(); BuildingSetWindows.Text = BuildingService.GetBuilding() .Where(x => (x.Type == BuildingComboBox.SelectedItem.ToString())) .Select(x => x.InfoWindows).FirstOrDefault().ToString(); BuildingSetIsIndustrial.Text = BuildingService.GetBuilding() .Where(x => (x.Type == BuildingComboBox.SelectedItem.ToString())) .Select(x => x.InfoIndustrial).FirstOrDefault().ToString(); }
private void txtBuildingCode_Leave(object sender, EventArgs e) { Building bldg = new Building(); string msg = string.Empty; IBuildingService bldgService = new BuildingService(); bldg = bldgService.GetBuilding(txtBuildingCode.Text, ref msg); if (bldg.BuildingCode != null) { MessageBox.Show("Building Code already exist!"); txtBuildingCode.Text = string.Empty; txtBuildingCode.Focus(); return; } }
// Use this for initialization void Start() { buildingService = new BuildingService(); unitService = new UnitService(); placedBuildings = new List <BuildingView>(); WoodRessource = 500; MetalRessource = 500; FoodRessource = 500; RessourceInfo.text = DisplayRessources(); buildings = buildingService.GetBuildable(); units = unitService.GetAll(); InvokeRepeating("AddRessources", 1, 1); }
public BuildingManagementHostedService(BuildingService buildingService, LoggerService loggerService) { _buildingHosteds = new Dictionary <ObjectId, BuildingHosted>(); _buildingService = buildingService; _loggerService = loggerService; var buildings = _buildingService.GetAll().Where(x => x.Status != BuildingStatus.Inactive); foreach (var building in buildings) { var buildingHosted = new BuildingHosted(building, buildingService); _buildingHosteds.Add(building.Id, buildingHosted); } BuildingService.UpdateBuildingEvent += UpdateBuildingHandler; }
public async Task <IHttpActionResult> Update([FromUri] int id, [FromBody] BuildingCreateAndUpdate model) { { //check if model is valid if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //instantiate the service BuildingService service = CreateBuildingService(); if (await service.UpdateBuilding(id, model) == false) { return(InternalServerError()); } return(Ok("Building Updated")); //200 with custom message } }
public async Task <IHttpActionResult> Create(BuildingCreateAndUpdate model) { { //check if model is valid if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //instantiate the service BuildingService service = CreateBuildingService(); if (await service.CreateNewBuilding(model) == false) { return(InternalServerError()); //500 } return(Ok("Building Added")); //200 with custom message } }
public WorkerScoutGasStealTask(SharkyUnitData sharkyUnitData, TargetingData targetingData, MacroData macroData, MapDataService mapDataService, bool enabled, float priority, DebugService debugService, BaseData baseData, AreaService areaService, MapData mapData, BuildingService buildingService, ActiveUnitData activeUnitData) { SharkyUnitData = sharkyUnitData; TargetingData = targetingData; MacroData = macroData; MapDataService = mapDataService; Priority = priority; DebugService = debugService; BaseData = baseData; AreaService = areaService; BuildingService = buildingService; MapData = mapData; ActiveUnitData = activeUnitData; UnitCommanders = new List <UnitCommander>(); Enabled = enabled; BlockExpansion = false; HidePylonInBase = false; BlockWall = false; }
public void LoadBuildings() { IBuildingService buildingService = new BuildingService(); string message = String.Empty; try { var buildings = buildingService.GetAllBuildings(); buildingList = new List <Building>(buildings); gvBuilding.DataSource = buildings; gvBuilding.Refresh(); if (gvBuilding.RowCount != 0) { gvBuilding.Rows[0].IsSelected = true; } } catch (Exception ex) { message = "Error Loading Building List"; MessageBox.Show(ex.ToString()); } }
private void Save_Click(object sender, RoutedEventArgs e) { string _countryName = CountrySetName.Text; string _countryContinent = CountrySetContinent.Text; string _presidentName = PresidentSetName.Text; string _presidentAge = PresidentSetAge.Text; string _cityName = CitySetName.Text; string _cityPopulation = CitySetPopulation.Text; string _palceStreet = PlaceSetStreet.Text; string _placePopulation = PlaceSetPopulation.Text; string _buildingType = BuildingSetType.Text; string _buildingWindows = BuildingSetWindows.Text; string _buildingIndustrial = BuildingSetIsIndustrial.Text; //if(_countryName==""||) if ((_countryName == countryName && _countryContinent != countryContinent) || (_countryName == countryName && _countryContinent == countryContinent)) { CountryService.SaveCountry(_countryName, _countryContinent, Id_Country); //bez sensu. nawet jak nie zmieniam country to męczy DB i updatuje if ((_presidentName == presidentName && _presidentAge != presidentAge) || _presidentName != presidentName) { PresidentService.SavePresident(_presidentName, Convert.ToInt32(_presidentAge), Id_Country); } if (_cityName != "") { CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulation), Id_Country, Id_City); } } if (_countryName != countryName) { bool _buildingWindowsBool; bool _buildingIndustrialBool; CountryService.SaveCountry(_countryName, _countryContinent); int id_Country = CountryService.GetCountry().Select(x => x.Id).LastOrDefault(); PresidentService.SavePresident(_presidentName, Convert.ToInt32(_presidentAge), id_Country); CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulation), id_Country); int id_City = CityService.GetCity().Select(x => x.Id).LastOrDefault(); if (_buildingWindows.ToUpper().Trim() == "TAK") { _buildingWindowsBool = true; } else { _buildingWindowsBool = false; } if (_buildingIndustrial.ToUpper().Trim() == "TAK") { _buildingIndustrialBool = true; } else { _buildingIndustrialBool = false; } BuildingService.SaveBuilding(_buildingType, _buildingWindowsBool, _buildingIndustrialBool); int id_Building = BuildingService.GetBuilding().Select(x => x.Id).LastOrDefault(); PlaceService.SavePlace(_palceStreet, Convert.ToInt32(_placePopulation), id_City, id_Building); } CountryComboBoxList(); PresidentComboBoxList(); CityComboBoxList(); PlaceComboBoxList(); BuildingComboBoxList(); CountrySetName.Clear(); CountrySetContinent.Clear(); PresidentSetName.Clear(); PresidentSetAge.Clear(); CitySetName.Clear(); CitySetPopulation.Clear(); CitySetPopulation.Clear(); PlaceSetStreet.Clear(); PlaceSetPopulation.Clear(); BuildingSetType.Clear(); BuildingSetWindows.Clear(); BuildingSetIsIndustrial.Clear(); }
private void Awake() { CursorSlotImage = CursorSlot.GetComponentInChildren <RawImage>(); CursorSlotCount = CursorSlot.GetComponentInChildren <Text>(); MaterialsSides = new Vector2[Enum.GetNames(typeof(BlockType)).Length, 6]; playerService = new PlayerService(); buildingService = new BuildingService(); invenvtoryImagesGameObjects = GameObject.FindGameObjectsWithTag("MainInventorySlots"); inventoryImages = new RawImage[invenvtoryImagesGameObjects.Length]; for (int i = 0; i < invenvtoryImagesGameObjects.Length; i++) { inventoryImages[i] = invenvtoryImagesGameObjects[i].GetComponent <RawImage>(); } inventoryItemCountsGameObjects = GameObject.FindGameObjectsWithTag("MainInventoryCount"); inventoryItemCounts = new Text[inventoryItemCountsGameObjects.Length]; for (int i = 0; i < inventoryItemCountsGameObjects.Length; i++) { inventoryItemCounts[i] = inventoryItemCountsGameObjects[i].GetComponent <Text>(); } inventory = GameObject.FindGameObjectWithTag("Inventory"); inventory.SetActive(false); hotbarSlotSelected = GameObject.FindGameObjectsWithTag("ItemSelected"); hotbarSlotsGameObjects = GameObject.FindGameObjectsWithTag("InventorySlots"); hotbarSlotsImages = new RawImage[hotbarSlotsGameObjects.Length]; hotbarCountGameObjects = GameObject.FindGameObjectsWithTag("ItemCount"); hotbarItemCounts = new Text[hotbarCountGameObjects.Length]; for (int i = 0; i < hotbarSlotsGameObjects.Length; i++) { hotbarSlotsImages[i] = hotbarSlotsGameObjects[i].GetComponent <RawImage>(); } for (int i = 0; i < hotbarCountGameObjects.Length; i++) { hotbarItemCounts[i] = hotbarCountGameObjects[i].GetComponent <Text>(); } perlinNoiseService = new PerlinNoiseService(); inventoryService = new InventoryService(); BlockService = new BlockService(); for (int i = 0; i < MaterialsSides.GetLength(0); i++) { MaterialsSides[i, 0] = MaterialsSideTop[i]; if (MaterialsSideBottom[i].x != -1) { MaterialsSides[i, 1] = MaterialsSideBottom[i]; MaterialsSides[i, 2] = MaterialsSideRight[i]; MaterialsSides[i, 3] = MaterialsSideLeft[i]; MaterialsSides[i, 4] = MaterialsSideFront[i]; MaterialsSides[i, 5] = MaterialsSideBack[i]; } else { MaterialsSides[i, 1] = MaterialsSideTop[i]; MaterialsSides[i, 2] = MaterialsSideTop[i]; MaterialsSides[i, 3] = MaterialsSideTop[i]; MaterialsSides[i, 4] = MaterialsSideTop[i]; MaterialsSides[i, 5] = MaterialsSideTop[i]; } } gameController = new GameController(100, 100, 100); gameChunks = new GameObject[gameController.GetGameModel().Blocks.GetLength(0) / chunkSize, gameController.GetGameModel().Blocks.GetLength(2) / chunkSize]; playerCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>(); Cursor.lockState = CursorLockMode.Locked; //Materials = new Material[Enum.GetNames(typeof(BlockType)).Length]; }
public RealEstateController(BuildingService buildingService) { BuildingService = buildingService; }
private void Save_Click(object sender, RoutedEventArgs e) { string _countryName = CountrySetName.Text; string _countryContinent = CountrySetContinent.Text; string _presidentName = PresidentSetName.Text; int _presidentAge; bool _presidentAgeBool = Int32.TryParse(PresidentSetAge.Text, out _presidentAge); string _cityName = CitySetName.Text; int _cityPopulation; bool _cityPopulationBool = Int32.TryParse(CitySetPopulation.Text, out _cityPopulation); string _placeStreet = PlaceSetStreet.Text; int _placePopulation; bool _placePopulationBool = Int32.TryParse(PlaceSetPopulation.Text, out _placePopulation); string _buildingType = BuildingSetType.Text; string _buildingWindows = BuildingSetWindows.Text; string _buildingIndustrial = BuildingSetIsIndustrial.Text; bool _buildingWindowsBool; bool _buildingIndustrialBool; if (_buildingWindows.ToUpper().Trim() == "TAK") { _buildingWindowsBool = true; } else { _buildingWindowsBool = false; } if (_buildingIndustrial.ToUpper().Trim() == "TAK") { _buildingIndustrialBool = true; } else { _buildingIndustrialBool = false; } if (_countryName == "" || _presidentName == "") { MessageBox.Show("Nie została podana nazwa państwa lub/i nazwisko prezydenta"); return; } if (!_presidentAgeBool || !_cityPopulationBool || !_placePopulationBool) { MessageBox.Show("Wartości dla wieku czy populacji należy podawać w liczbach całkowitych"); return; } if (_countryName == countryName) { if (_countryContinent != countryContinent) { CountryService.SaveCountry(_countryName, _countryContinent, Id_Country); } if (_cityName == cityName && _cityPopulation != Convert.ToInt32(cityPopulation)) { CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulation), Id_Country, Id_City); } if (_cityName != cityName) { CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulation), Id_Country); Id_City = CityService.GetCity().Select(x => x.Id).LastOrDefault(); } if ((_buildingType == buildingType && (_buildingWindows != buildingWindows || _buildingIndustrial != buildingIndustrial))) { BuildingService.SaveBuilding(_buildingType, _buildingWindowsBool, _buildingIndustrialBool, Place_Id_Building); } if (_buildingType != buildingType) { BuildingService.SaveBuilding(_buildingType, _buildingWindowsBool, _buildingIndustrialBool); Place_Id_Building = BuildingService.GetBuilding().Select(x => x.Id).LastOrDefault(); } if (_placeStreet == placeStreet && _placePopulation != Convert.ToInt32(placePopulation)) { PlaceService.SavePlace(_placeStreet, _placePopulation, Id_City, Place_Id_Building, Place_Id); } if (_placeStreet != placeStreet) { PlaceService.SavePlace(_placeStreet, _placePopulation, Id_City, Place_Id_Building); } } else { CountryService.SaveCountry(_countryName, _countryContinent); int id_Country = CountryService.GetCountry().Select(x => x.Id).LastOrDefault(); PresidentService.SavePresident(_presidentName, Convert.ToInt32(_presidentAge), id_Country); CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulation), id_Country); int id_City = CityService.GetCity().Select(x => x.Id).LastOrDefault(); BuildingService.SaveBuilding(_buildingType, _buildingWindowsBool, _buildingIndustrialBool); Place_Id_Building = BuildingService.GetBuilding().Select(x => x.Id).LastOrDefault(); PlaceService.SavePlace(_placeStreet, Convert.ToInt32(_placePopulation), id_City, Place_Id_Building); } CountryComboBoxList(); PresidentComboBoxList(); CityComboBoxList(); PlaceComboBoxList(); BuildingComboBoxList(); CountrySetName.Clear(); CountrySetContinent.Clear(); PresidentSetName.Clear(); PresidentSetAge.Clear(); CitySetName.Clear(); CitySetPopulation.Clear(); CitySetPopulation.Clear(); PlaceSetStreet.Clear(); PlaceSetPopulation.Clear(); BuildingSetType.Clear(); BuildingSetWindows.Clear(); BuildingSetIsIndustrial.Clear(); }
static void Main(string[] args) { //Эта трехуровневая архитектура буквально выпила мою душу. Она принесла мне огромное количество радости и разочарований. Спасибо. //Generator generator = new Generator(); //var res = generator.CreateBuildings(4); //res.Wait(); IPersonService personService = new PersonService(); IApartmentService apartmentService = new ApartmentService(); IBuildingService buildingService = new BuildingService(); //Console.WriteLine("Enter someName please:"); //string s = Console.ReadLine(); //string someName = "Building Creator"; string someName = "Name2"; SquarePrice squarePrice = new SquarePrice(); //squarePrice.priceForOneM2 = 100; var somePerson = personService.FindPersonByName(someName); somePerson.Wait(); var foundApartments = apartmentService.GetApartmentsByPersonId(somePerson.Result.Id); foundApartments.Wait(); foreach (var apartment in foundApartments.Result) { var tempBuilding = buildingService.GetByIdAsync(apartment.BuildingId); tempBuilding.Wait(); Console.WriteLine($"{somePerson.Result.Name}, {tempBuilding.Result.BuildingNumber} , {apartment.ApartmentNumber}, {apartment.SquareSize}, {apartment.SquareSize * squarePrice.priceForOneM2}, {apartment.OrderDate}, {somePerson.Result.PhoneNumber}"); } Console.WriteLine(); //find all var allPerson = personService.GetAllPersons(); allPerson.Wait(); foreach (var person in allPerson.Result) { if (person.Id == 1) { continue; } var personApartments = apartmentService.GetApartmentsByPersonId(person.Id); personApartments.Wait(); foreach (var personApartment in personApartments.Result) { var tempBuilding = buildingService.GetByIdAsync(personApartment.BuildingId); tempBuilding.Wait(); Console.WriteLine($"{person.Name}, {tempBuilding.Result.BuildingNumber}, {personApartment.ApartmentNumber}, {personApartment.OrderDate}, {person.PhoneNumber} {personApartment.SquareSize}, {personApartment.SquareSize * squarePrice.priceForOneM2},"); } } // //var item = personService.CreatePerson(new PersonModel //{ // Id = 2, // Name = "Name1", // PhoneNumber = 0670000001, //}); //item.Wait(); // Buy apartment //var person = personService.BuyApartment(3, 9); //person.Wait(); //var item2 = personService.CreatePerson(new PersonModel //{ // Id = 3, // Name = "Name3", // PhoneNumber = 0670000003, //}); //item2.Wait(); //var res = apartmentService.CreateApartment(new ApartmentModel() //{ // ApartmentNumber = 1, // BuildingId = 1, // IsOwn = false, // SquareSize = 12, // EntranceId = 1, // PersonId = 1, //}); //res.Wait(); //Task<List<ApartmentModel>> apartments = apartmentService.GetAllApartments(); //apartments.Wait(); //foreach (var apartment in apartments.Result) //{ // Console.WriteLine($"{apartment.ApartmentNumber}, {apartment.SquareSize}, {apartment.IsOwn} "); //} //IPersonService personService = new PersonService(); ////var res = personService.CreatePerson(new PersonModel() ////{ //// //Id = 0, //// Name = "Name2", //// PhoneNumber = 0670000002, ////}); ////res.Wait(); ////res = personService. ////res.Wait(); //Task<List<PersonModel>> persons = personService.GetAllPersons(); //persons.Wait(); //foreach (var person in persons.Result) //{ // Console.WriteLine($"{person.Id}, {person.Name}, {person.PhoneNumber}"); //} Console.WriteLine("End of program"); Console.ReadLine(); }
public ChokePointService(IPathFinder pathFinder, MapDataService mapDataService, BuildingService buildingService) { PathFinder = pathFinder; MapDataService = mapDataService; BuildingService = buildingService; }
public async Task <IActionResult> DeleteBuilding(int id) { var res = await BuildingService.DeleteBuilding(_context, id); return(new ObjectResult(res)); }