Exemplo n.º 1
0
        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]);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 public ActionResult Create(BuildingEntity model)
 {
     model.Id             = null;
     model.OrganizationId = CurrentOrganization.Id;
     _buildingRepository.Update(model);
     return(RedirectToAction("Index"));
 }
Exemplo n.º 6
0
        /// <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();
            }
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        /// <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));
        }
Exemplo n.º 9
0
 public static void LoadEntities()
 {
     LoadCommonEntities();
     LoadCoreEntities();
     LoadPeds();
     BuildingEntity.LoadBuildings();
 }
Exemplo n.º 10
0
        /// <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(""));
            }
        }
Exemplo n.º 11
0
 public bool Build(BuildingEntity building, TileContainer tileContainer)
 {
     if (CanBuildOnTile(tileContainer, building))
     {
         return(state.TryBuild(building, resolvedMultipliers, tileContainer));
     }
     return(false);
 }
Exemplo n.º 12
0
        public async Task CreateRoomTest_NoBuilding()
        {
            BuildingEntity buildingEntity = new BuildingEntity {
            };
            RoomPropotype roomPrototype   = new RoomPropotype("testRoom4", buildingEntity);

            Assert.AreEqual(-1, await apiController.createRoom(roomPrototype));
        }
Exemplo n.º 13
0
        /// <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);
        }
Exemplo n.º 15
0
        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();
        }
Exemplo n.º 16
0
        public ActionResultDTO Post(BuildingEntity building)
        {
            var result = _buildingServices.AddBuilding(building);

            if (result == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            return(result);
        }
Exemplo n.º 17
0
 public void Configure(BuildingEntity building)
 {
     Configure(
         building.Name,
         building.BuildCost,
         GameManager.Instance.CanAfford(building),
         GameManager.Instance.AvailableTilesForBuilding(building),
         () => UIManager.Instance.State = UIState.BuildingSelected(building)
         );
 }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
        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"));
        }
Exemplo n.º 20
0
 /// <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();
            }
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
        public void SetDragging(BuildingEntity building)
        {
            mode = WorldMode.MovingBuilding;

            if (draggedBuilding != null)
            {
                draggedBuilding.SetDragging(false);
            }

            draggedBuilding = building;
            draggedBuilding.SetDragging(true);
        }
Exemplo n.º 24
0
        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;
            }
        }
Exemplo n.º 26
0
        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);
         }
     }
 }
Exemplo n.º 29
0
        /// <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);
     }
 }
Exemplo n.º 31
0
        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);
            }
        }