public async Task GetReportPositions_CorrectIdRoomWithoutNulls(int ReportId, int[] assetId, int[] assetTypeId, string[] assetName, char[] assetLetter, int[] prevRoom, int[] presentRoom, string[] roomName, int[] buildingId, string[] buildingName) { ReportPositionEntity[] reportPositionEntities = await apiController.getReportPositions(ReportId); for (int i = 0; i < assetId.Length; i++) { ReportPositionEntity tempReportPositionEntity = new ReportPositionEntity(); tempReportPositionEntity.present = Convert.ToBoolean(presentRoom[i]); AssetEntity tempAssetEntity = new AssetEntity(); tempAssetEntity.id = assetId[i]; AssetTypeEntity assetType = new AssetTypeEntity(); assetType.id = assetTypeId[i]; assetType.name = assetName[i]; assetType.letter = assetLetter[i]; tempAssetEntity.type = assetType; tempReportPositionEntity.asset = tempAssetEntity; RoomEntity tempRoomEntity = new RoomEntity(); tempRoomEntity.id = prevRoom[i]; tempRoomEntity.name = roomName[i]; BuildingEntity tempBuildingEntity = new BuildingEntity(); tempBuildingEntity.id = buildingId[i]; tempBuildingEntity.name = buildingName[i]; tempRoomEntity.building = tempBuildingEntity; tempReportPositionEntity.previous_room = tempRoomEntity; Assert.AreEqual(tempReportPositionEntity, reportPositionEntities[i]); } }
public MapEntity CreateEntity(IRegionEntityFactory factory, IResourceContainer resources, bool scrollAffected) { MapEntity result = null; switch (EntityType) { case EntityType.None: result = new MapEntity(factory, scrollAffected); break; case EntityType.Building: result = new BuildingEntity(factory, scrollAffected); break; case EntityType.Player: result = new PlayerEntity(factory, scrollAffected); break; case EntityType.Npc: result = new NPCEntity(factory, scrollAffected); break; case EntityType.Door: //result = new EntityDoor(); break; } if (result != null) { result.TemplateID = this.ID; } return(result); }
public BuildingScreen(BuildingEntity building, MarsWorld world, bool isUpgrade) { this.building = building; this.world = world; this.isUpgrade = isUpgrade; var properties = building.Properties; if (isUpgrade) { heading = "UPGRADE BUILDING"; title = string.Format("{0} level {1}", properties.Description, properties.Level + 1); okText = "Upgrade"; targetLevel = properties.Level + 1; } else { heading = "PURCHASE BUILDING"; title = properties.Description; okText = "Purchase"; targetLevel = 0; } IsOverlay = true; TransitionInDuration = TransitionOutDuration = TimeSpan.FromMilliseconds(250); }
public async Task GetReportHeader_CorrectID(int id, int staticId, string staticName, int staticRoomId, int staticOwnerId, string staticDate, string staticLogin, string staticRoomName, string staticBuildingName, int staticBuildingId) { ReportHeaderEntity reportHeaderEntity = await apiController.getReportHeader(id); ReportHeaderEntity tempEntity = new ReportHeaderEntity(); tempEntity.id = staticId; tempEntity.name = staticName; tempEntity.create_date = DateTime.Parse(staticDate); RoomEntity tempRoomEntity = new RoomEntity(); tempRoomEntity.id = staticRoomId; tempRoomEntity.name = staticRoomName; BuildingEntity tempBuildingEntity = new BuildingEntity(); tempBuildingEntity.id = staticBuildingId; tempBuildingEntity.name = staticBuildingName; tempRoomEntity.building = tempBuildingEntity; tempEntity.room = tempRoomEntity; UserEntity tempUserEntity = new UserEntity(); tempUserEntity.id = staticOwnerId; tempUserEntity.login = staticLogin; tempEntity.owner = tempUserEntity; Assert.AreEqual(tempEntity, reportHeaderEntity); }
public ActionResult Create(BuildingEntity model) { model.Id = null; model.OrganizationId = CurrentOrganization.Id; _buildingRepository.Update(model); return(RedirectToAction("Index")); }
/// <summary> /// Places the building being dragged /// </summary> void placeDraggedBuilding() { // placement is valid, set the new location if (draggedBuilding.IsPlacementValid) { // node index from the building bounds var newLocation = new Point() { Y = draggedBuildingBounds.X / gridNodeSize.X, X = draggedBuildingBounds.Y / gridNodeSize.Y }; // move to the building to its new location draggedBuilding.MoveTo(newLocation); // stop dragging the building draggedBuilding.SetDragging(false); // remove our reference draggedBuilding = null; } else { // the placement was invalid, play the error sound invalidPlacementSound.Play(); } }
public ActionResultDTO UpdateBuilding(BuildingEntity building) { var actionResult = new ActionResultDTO(); var existingBuilding = GetBuilding(building.Id); if (existingBuilding == null) { return new ActionResultDTO { ErrorMessage = "Building Not Found", Id = 0 } } ; var validationResult = ValidateBuilding(building, false); if (validationResult.Success) { _uow.BuildingRepository.Update(building, building.Id); _uow.Save(); actionResult.Success = true; actionResult.Id = building.Id; } else { actionResult.ErrorMessage = validationResult.ErrorMessage; } return(actionResult); }
/// <summary> /// Deletes the building. /// </summary> /// <param name="building">The building.</param> /// <returns></returns> public string DeleteBuilding(BuildingEntity building) { const string sql = @"uspDelete_Building"; object[] parms = { "@BuildingId", building.BuildingId }; return(Db.Delete(sql, true, parms)); }
public static void LoadEntities() { LoadCommonEntities(); LoadCoreEntities(); LoadPeds(); BuildingEntity.LoadBuildings(); }
/// <summary> /// 获取房间数树 /// </summary> /// <returns></returns> public ActionResult GetDataItemTreeJson(string keyValue) { string property_id = ""; if (!string.IsNullOrEmpty(Utils.GetCookie("property_id"))) { property_id = Utils.GetCookie("property_id"); } //string floor_list = buildingbll.Getfloor_list(keyValue, property_id); //if (!string.IsNullOrEmpty(floor_list)) //{ // var treeList = new List<TreeEntity>(); // string[] floor_lists = floor_list.Split(','); // for (int i = 0; i < floor_lists.Length; i++) // { // TreeEntity tree = new TreeEntity(); // bool hasChildren = false; // tree.id = floor_lists[i]; // tree.text = floor_lists[i] + " 层"; // tree.value = floor_lists[i]; // tree.parentId = "0"; // tree.isexpand = true; // tree.complete = true; // tree.hasChildren = hasChildren; // treeList.Add(tree); // } // return Content(treeList.TreeToJson()); //} //else //{ // return Content(""); //} BuildingEntity model = buildingbll.GetEntity(keyValue); if (model != null) { var treeList = new List <TreeEntity>(); for (int i = 1; i <= model.floor_count; i++) { TreeEntity tree = new TreeEntity(); bool hasChildren = false; tree.id = i.ToString(); tree.text = i + " 层"; tree.value = i.ToString(); tree.parentId = "0"; tree.isexpand = true; tree.complete = true; tree.hasChildren = hasChildren; treeList.Add(tree); } return(Content(treeList.TreeToJson())); } else { return(Content("")); } }
public bool Build(BuildingEntity building, TileContainer tileContainer) { if (CanBuildOnTile(tileContainer, building)) { return(state.TryBuild(building, resolvedMultipliers, tileContainer)); } return(false); }
public async Task CreateRoomTest_NoBuilding() { BuildingEntity buildingEntity = new BuildingEntity { }; RoomPropotype roomPrototype = new RoomPropotype("testRoom4", buildingEntity); Assert.AreEqual(-1, await apiController.createRoom(roomPrototype)); }
/// <summary> /// Adds a building to the world's entities /// </summary> /// <param name="type"> Building type </param> /// <param name="location"> Target node index location </param> public void AddBuilding(Building type, Point location) { var building = new BuildingEntity(this, buildingProperties[type]); building.MoveTo(location); entities.Add(building); }
private BuildingEntity CreateBuildingEntity() { int BuildingId = int.Parse(buildingid_txtbx.Text); string BuildingName = buildingname_txtbx.Text; buildingEntity = new BuildingEntity(BuildingId, BuildingName); return(buildingEntity); }
public static async Task LoadServerEntity() { RoleplayContext ctx = Singleton.GetDatabaseInstance(); using (UnitOfWork unit = new UnitOfWork(ctx)) { await BuildingEntity.LoadBuildingsAsync(unit); await AtmEntity.LoadAtmsAsync(unit); await BusEntity.LoadBusAsync(unit); await ShopEntity.LoadShopAsync(unit); await GroupEntity.LoadGroupsAsync(unit); await WarehouseOrderEntity.LoadWarehouseOrdersAsync(); } JobEntity courierJob = new JobEntity(new JobEntityModel() { JobName = "Kurier", VehicleModel = AltV.Net.Enums.VehicleModel.Boxville2, RespawnVehicle = true, Position = new Position(26.1626f, -1300.59f, 29.2124f), RespawnVehiclePosition = new Position(36.9495f, -1283.84f, 29.2799f), RespawnVehicleRotation = new Rotation(0, 0, 1.53369f), JobType = JobType.Courier, MaxSalary = 400 }); courierJob.Create(); JobEntity junkerJob = new JobEntity(new JobEntityModel() { JobName = "Śmieciarz", VehicleModel = AltV.Net.Enums.VehicleModel.Trash, RespawnVehicle = true, Position = new Position(500.334f, -652.009f, 24.8989f), RespawnVehiclePosition = new Position(508.286f, -609.771f, 25.1348f), RespawnVehicleRotation = new Rotation(0, 0, 1.63264f), JobType = JobType.Junker, MaxSalary = 400 }); junkerJob.Create(); JobCenterEntity jobCenter = new JobCenterEntity(new JobCenterModel() { Id = 0, Position = new Position(104.73f, -934.075f, 29.8022f), Jobs = EntityHelper.GetJobs() }); jobCenter.Spawn(); }
public ActionResultDTO Post(BuildingEntity building) { var result = _buildingServices.AddBuilding(building); if (result == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(result); }
public void Configure(BuildingEntity building) { Configure( building.Name, building.BuildCost, GameManager.Instance.CanAfford(building), GameManager.Instance.AvailableTilesForBuilding(building), () => UIManager.Instance.State = UIState.BuildingSelected(building) ); }
public async Task CreateRoomTest(int buildingID, string roomName, bool status) { BuildingEntity buildingEntity = new BuildingEntity { id = buildingID }; RoomPropotype roomPrototype = new RoomPropotype(roomName, buildingEntity); bool result = await apiController.createRoom(roomPrototype) > 0; Assert.AreEqual(status, result); }
public ActionResult Edit(BuildingEntity model) { if (_buildingRepository.Get(model.Id)?.OrganizationId != CurrentOrganization.Id) { return(HttpNotFound()); } model.OrganizationId = CurrentOrganization.Id; _buildingRepository.Update(model); return(RedirectToAction("Index")); }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, BuildingEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
private void building_combobx_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox buildingComboBx = sender as ComboBox; if (buildingComboBx.SelectedItem != null) { BuildingEntity selectedBuilding = buildingComboBx.SelectedItem as BuildingEntity; building_combobx_val = selectedBuilding.BuildingName; CheckValidations(); } }
public ActionResultDTO Put(int id, BuildingEntity building) { building.Id = id; var result = _buildingServices.UpdateBuilding(building); if (result == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(result); }
public void SetDragging(BuildingEntity building) { mode = WorldMode.MovingBuilding; if (draggedBuilding != null) { draggedBuilding.SetDragging(false); } draggedBuilding = building; draggedBuilding.SetDragging(true); }
protected void Insert(object sender, EventArgs e) { RequiresAuthorization(AuthorizationStrings.CreateGlobal); var gvRow = (GridViewRow)(sender as Control).Parent.Parent; var building = new BuildingEntity { Name = ((TextBox)gvRow.FindControl("txtNameAdd")).Text, ClusterGroupId = Convert.ToInt32(((DropDownList)gvRow.FindControl("ddlDpAdd")).SelectedValue) }; Call.BuildingApi.Post(building); BindGrid(); }
private void building_data_grid_SelectionChanged(object sender, SelectionChangedEventArgs e) { updateMode = true; delete_btn_.IsEnabled = true; DataGrid dataGrid = (DataGrid)sender; BuildingEntity building = dataGrid.SelectedItem as BuildingEntity; if (building != null) { buildingid_txtbx.Text = building.BuildingId.ToString(); buildingname_txtbx.Text = building.BuildingName; } }
public ActionResultDTO Put(int id, BuildingEntity tObject) { Request.Method = Method.PUT; Request.AddJsonBody(tObject); Request.Resource = string.Format("api/{0}/Put/{1}", Resource, id); var response = _apiRequest.Execute <ActionResultDTO>(Request); if (response.Id == 0) { response.Success = false; } return(response); }
public void UpdateData(BuildingEntity building) { using (IDbConnection con = new SQLiteConnection(AppData.ConnectionString)) { try { con.Execute("UPDATE Building SET BuildingName=@BuildingName WHERE BuildingId=@BuildingId", building); } catch (Exception e) { MessageBox.Show(e.Message); } } }
public void SaveData(BuildingEntity building) { using (IDbConnection con = new SQLiteConnection(AppData.ConnectionString)) { try { con.Execute("INSERT INTO Building (BuildingId, BuildingName) values (@BuildingId, @BuildingName)", building); } catch (Exception e) { MessageBox.Show(e.Message); } } }
/// <summary> /// Sets the new target building /// </summary> /// <param name="building"> Target building </param> void setTargetBuilding(BuildingEntity building) { building.OnDeath += (a, b) => { if (targetBuilding != null) { targetBuilding.Delete(); } hasTarget = attacking = false; }; targetBuilding = building; }
private void update_btn__Click(object sender, RoutedEventArgs e) { try { buildingEntity = CreateBuildingEntity(); _buildingViewModel.UpdateBuildingData(buildingEntity); building_data_grid.ItemsSource = _buildingViewModel.LoadBuildingData(); ClearAll(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void BuyBuildingMenuEntrySelected(object sender, PlayerIndexEventArgs e) { if (Tile_Engine.SelectedTile.IsBlocked == false && Tile_Engine.SelectedTile.DrawEntityList.Count() == 1 && this.player_CurrentGold >= BuildingEntity.GoldCost && this.player_CurrentEnergy >= BuildingEntity.EnergyCost) { Tile_Engine.PlayerEntity.Gold -= BuildingEntity.GoldCost; Tile_Engine.PlayerEntity.Energy -= BuildingEntity.EnergyCost; BuildingEntity entity = new BuildingEntity(Tile_Engine.SelectedTile, buildingTexture, Color.White, true); entity.GuyTexture = guyTexture; Tile_Engine.SelectedTile.AddEntity(entity); } }