예제 #1
0
 public void Build(BuildPlotLocation location, BuildingType buildingType, BuildingModel buildingModel)
 {
     buildPlotMap.Build(location, buildingType, buildingModel);
     OutputPlotStatus();
     UpdateBuildPlotView(location);
     UpdateBuildingInfoView(buildingType);
 }
예제 #2
0
 public void Post([FromBody] BuildingModel building)
 {
     {
         var dbm = new DatabaseManager();
         dbm.AddBuilding(building.Building_Name);
     }
 }
예제 #3
0
        public bool TryPurchaseBuilding(BuildingModel model, out UserModel newUser)
        {
            var userCurrency = User.Currency;
            var newCurrency  = new Currency[User.Currency.Current.Length];

            for (var i = 0; i < newCurrency.Length; i++)
            {
                var current = userCurrency.Current[i];
                var cost    = model.Сonditions.Cost.FirstOrDefault(c => c.Type == current.Type);
                var value   = current.Count;

                if (cost != null)
                {
                    value = current.Count - cost.Count;

                    if (value < 0)
                    {
                        newUser = User;
                        return(false);
                    }
                }

                newCurrency[i] = new Currency(current.Type, value);
            }

            newUser = new UserModel(new UserCurrency(newCurrency, User.Currency.Max));

            return(true);
        }
        private void icnBtnUpdate_Click(object sender, EventArgs e)
        {
            BuildingModel objBuildings = new BuildingModel();

            if (txtBuildingName.Text == "" || txtFloorBlock.Text == "" || txtNoofRooms.Text == "")
            {
                MessageBox.Show("Building Name and No of Rooms cannot be null");
            }
            else
            {
                objBuildings.Building_Name    = txtBuildingName.Text;
                objBuildings.Block_Floor_Name = txtFloorBlock.Text;
                objBuildings.No_of_Rooms      = Convert.ToInt32(txtNoofRooms.Text);

                objBuildingCore.updateBuildingDetails(objBuildings, objCurrentBuilding);

                loadData();

                //reset feilds
                txtBuildingName.Text = "";
                txtFloorBlock.Text   = "";
                txtNoofRooms.Text    = "";

                MessageBox.Show("Update Successfully!");
            }
        }
예제 #5
0
        public static void UpdateSizingFactors(this Building building, BuildingModel buildingModel)
        {
            if (building == null || buildingModel == null)
            {
                return;
            }

            List <Space> spaces = buildingModel.GetSpaces();

            if (spaces == null || spaces.Count == 0)
            {
                return;
            }

            double heatingSizingFactor = double.NaN;

            if (!buildingModel.TryGetValue(BuildingModelParameter.HeatingSizingFactor, out heatingSizingFactor))
            {
                heatingSizingFactor = double.NaN;
            }

            double coolingSizingFactor = double.NaN;

            if (!buildingModel.TryGetValue(BuildingModelParameter.CoolingSizingFactor, out coolingSizingFactor))
            {
                coolingSizingFactor = double.NaN;
            }

            UpdateSizingFactors(building, spaces, heatingSizingFactor, coolingSizingFactor);
        }
예제 #6
0
        /// <summary>
        /// Adds a table to the database from user entered data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void addTableButton_Click(Object sender, EventArgs e)
        {
            //Uses ASP.NET function IsValid() to test user input and the current error state before proceeding
            if (Page.IsValid)
            {
                TableModel    newTable = new TableModel();
                BuildingModel bm       = new BuildingModel();
                RoomModel     rm       = new RoomModel();

                //Selects single selected building form buildinglist
                bm = buildings.Where(b => b.BuildingID == Int32.Parse(buildingDropdown.Text)).FirstOrDefault();
                int id = bm.BuildingID;

                //Fills the list for the next to take it
                rooms = RoomBL.fillRoomsList(id);

                //Selects single selected building from roomlist
                rm = rooms.Where(r => r.RoomID == Int32.Parse(roomDropdown.Text)).FirstOrDefault();

                //Sets the table values from user data
                newTable.RoomID         = rm.RoomID;
                newTable.Category       = inTableCatagory.Value;
                newTable.PersonCapacity = Convert.ToInt32(inTableCapacity.Value);

                //Adds a new table to the database
                TableBL.ProcessAddNewTable(newTable);

                //Visually displays recognition of successful table creation
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Table Created!" + "');", true);
            }
        }
예제 #7
0
        public BuildingModel CreateOrUpdate(BuildingModel model)
        {
            Logger.Debug($"{model}");

            if (model == null)
            {
                throw new System.ArgumentNullException("model");
            }

            Building center = null;

            if (model.Id == null || model.Id == System.Guid.Empty)
            {
                center = this.UnitOfWork.BuildingRepository.CreateBuilding(model.SemesterId, model.Name, model.Code, model.HighlightColor, model.LogoUrl, model.IsActive);
            }
            else
            {
                center = this.UnitOfWork.BuildingRepository.UpdateBuidling(model.Id, model.SemesterId, model.Name, model.Code, model.HighlightColor, model.LogoUrl, model.IsActive);
            }

            this.UnitOfWork.SaveChanges();

            BuildingModel centerModel = Mapper.Map <Models.Building, Models.BuildingModel>(center);

            return(centerModel);
        }
예제 #8
0
        public void PlaceBuilding(Point point, BuildingModel building, BlockModel[,,] blocks)
        {
            point = point - building.StartPoint;

            if (!CanYouPlaceBuilding(point, building, blocks))
            {
                return;
            }

            for (int x = 0; x < building.Width; x++)
            {
                for (int y = 0; y < building.Height; y++)
                {
                    for (int z = 0; z < building.Lenght; z++)
                    {
                        if (building.BuildingBlocks[x, y, z] != null)
                        {
                            int blocksX = x + point.X;
                            int blocksY = y + point.Y;
                            int blocksZ = z + point.Z;

                            blocks[blocksX, blocksY, blocksZ] = blockFactory.CreateBlock(new Point(blocksX, blocksY, blocksZ), building.BuildingBlocks[x, y, z].BlockType);
                        }
                    }
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Adds a room to the database from user entered data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void addRoomButton_Click(Object sender, EventArgs e)
        {
            //Uses ASP.NET function IsValid() to test user input and the current error state before proceeding
            if (Page.IsValid)
            {
                BuildingModel bm = new BuildingModel(); //New buiding instance

                //Finds the single matching building to the user's selection
                bm = buildings.Where(b => b.BuildingID == Int32.Parse(buildingDropdown.Text)).FirstOrDefault();

                int id = bm.BuildingID;

                RoomModel newRoom = new RoomModel(); //New room instance

                //Sets the room values from user data
                newRoom.BuildingID = id;
                newRoom.RoomName   = inRoomName.Value;
                newRoom.RoomLabel  = inRoomLabel.Value;
                newRoom.TableQty   = Convert.ToInt32(inTableQty.Value);

                //Adds a new room to the database
                RoomBL.ProcessAddNewRoom(newRoom);

                //Redirects the admin to the Admin HomePage after processing
                Response.Redirect("AdminHome.aspx");
            }
        }
예제 #10
0
 //Oferta z budynkiem
 public Offer(CharacterEntity sender, CharacterEntity getter, BuildingModel building, decimal moneyCount)
 {
     Building = building;
     Money    = moneyCount;
     Sender   = sender;
     Getter   = getter;
 }
예제 #11
0
        internal static Dictionary <int, KeyValuePair <AbsFightModel, BuildingModel> > ReadBuildingModel(string dir, int sheetIndex)
        {
            FileInfo     file    = new FileInfo(dir);
            ExcelPackage package = new ExcelPackage(file);
            Dictionary <int, KeyValuePair <AbsFightModel, BuildingModel> > buildingModelList = null;

            if (package.Workbook.Worksheets.Count > 0)
            {
                buildingModelList = new Dictionary <int, KeyValuePair <AbsFightModel, BuildingModel> >();
                ExcelWorksheet excelWorksheet = package.Workbook.Worksheets[sheetIndex];
                for (int m = excelWorksheet.Dimension.Start.Row + 1, n = excelWorksheet.Dimension.End.Row; m <= n; m++)
                {
                    BuildingModel buildingModel = new BuildingModel();
                    AbsFightModel fightModel    = new AbsFightModel();
                    fightModel.category         = excelWorksheet.GetValue <byte>(m, 1);
                    fightModel.specieId         = excelWorksheet.GetValue <int>(m, 3);
                    fightModel.name             = excelWorksheet.GetValue <string>(m, 4);
                    fightModel.maxHp            = excelWorksheet.GetValue <int>(m, 7);
                    fightModel.atk              = excelWorksheet.GetValue <int>(m, 8);
                    fightModel.def              = excelWorksheet.GetValue <int>(m, 9);
                    fightModel.atkSpeed         = excelWorksheet.GetValue <int>(m, 10);
                    fightModel.atkRange         = excelWorksheet.GetValue <int>(m, 11);
                    fightModel.eyeRange         = excelWorksheet.GetValue <int>(m, 12);
                    buildingModel.couldAttack   = excelWorksheet.GetValue <bool>(m, 13);
                    buildingModel.isAntiStealth = excelWorksheet.GetValue <bool>(m, 14);
                    buildingModel.isReborn      = excelWorksheet.GetValue <bool>(m, 15);
                    buildingModel.rebornTime    = excelWorksheet.GetValue <int>(m, 16);

                    buildingModelList.Add(fightModel.category.GetHashCode() + fightModel.specieId.GetHashCode(), new KeyValuePair <AbsFightModel, BuildingModel>(fightModel, buildingModel));
                }
            }

            package.Dispose();
            return(buildingModelList);
        }
        public void Render(BuildingModel model)
        {
            var prefab = buildingAssets.FindBuilding(model.Id);

            ghost = Instantiate(prefab, transform);
            ghost.Root.position = lastPosition;
        }
예제 #13
0
        public async Task <IActionResult> Edit(int id, [Bind("BuildingId,BuildingName,Flg")] BuildingModel buildingModel)
        {
            // Get Login User's details.
            var ur = _userRepo.Find(u => u.UserName == this.User.Identity.Name).FirstOrDefault();

            buildingModel.Rtp = ur.Id;
            buildingModel.Rtt = DateTime.Now;

            if (id != buildingModel.BuildingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(buildingModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BuildingModelExists(buildingModel.BuildingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(buildingModel));
        }
예제 #14
0
        private void ExecuteSaveCommand()
        {
            BuildingModel model = new BuildingModel()
            {
                Building       = BuildingsCollection[SelectedIndex].Building,
                Amount         = Amount,
                Woodwork       = BuildingsCollection[SelectedIndex].Woodwork,
                LeftWoodwork   = BuildingsCollection[SelectedIndex].Woodwork * Amount,
                Wood           = BuildingsCollection[SelectedIndex].Wood,
                LeftWood       = BuildingsCollection[SelectedIndex].Wood * Amount,
                Stonework      = BuildingsCollection[SelectedIndex].Stonework,
                LeftStonework  = BuildingsCollection[SelectedIndex].Stonework * Amount,
                Stone          = BuildingsCollection[SelectedIndex].Stone,
                LeftStone      = BuildingsCollection[SelectedIndex].Stone * Amount,
                Smithswork     = BuildingsCollection[SelectedIndex].Smithswork,
                LeftSmithswork = BuildingsCollection[SelectedIndex].Smithswork * Amount,
                Iron           = BuildingsCollection[SelectedIndex].Iron,
                LeftIron       = BuildingsCollection[SelectedIndex].Iron * Amount
            };

            AddBuildingUIEventArgs newEventArgs =
                new AddBuildingUIEventArgs(
                    AddBuildingUIRoutedEvent,
                    "Save",
                    model
                    );

            RaiseEvent(newEventArgs);

            SelectedIndex = -1;
        }
예제 #15
0
        //Getting Room numbers (Not actual rooms) for the dropdown in Blue Oister bar
        internal List <byte> GetRoomNumbers()
        {
            SqlConnection con = new SqlConnection(connectionString);

            con.Open();
            SqlCommand cmd = new SqlCommand("SelectRoomNr", con);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.ExecuteNonQuery();
            SqlDataReader reader = cmd.ExecuteReader();

            List <byte> roomNumbers = new List <byte>();

            try
            {
                while (reader.Read())
                {
                    //EditStorageLocationModel output = new EditStorageLocationModel();
                    BuildingModel roomNumber = new BuildingModel(null, (byte)reader["roomNr"]);

                    roomNumbers.Add(roomNumber.RoomNumber);
                }
            }
            catch (Exception)
            {
                throw;
            }

            con.Close();
            return(roomNumbers);
        }
예제 #16
0
        public BuildingEntity Create(Account creator, string name, BuildingType buildingType, Position internalPosition, Position externalPosition)
        {
            BuildingModel buildingToCreate = new BuildingModel()
            {
                Name                    = name,
                BuildingType            = buildingType,
                EntryFee                = 0,
                ExternalPickupPositionX = externalPosition.X,
                ExternalPickupPositionY = externalPosition.Y,
                ExternalPickupPositionZ = externalPosition.Z,
                InternalPickupPositionX = internalPosition.X,
                InternalPickupPositionY = internalPosition.Y,
                InternalPickupPositionZ = internalPosition.Z,
                MaxObjectsCount         = 0,
                CurrentObjectsCount     = 0,
                HasCCTV                 = false,
                HasSafe                 = false,
                Description             = "",
                Creator                 = creator,
                CreatedTime             = DateTime.Now,
                ItemsInBuilding         = new List <ItemModel>()
            };

            Save();

            return(new BuildingEntity(buildingToCreate));
        }
        private void btnInsert_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtBuilding.Text))
            {
                MessageBox.Show("Please Enter Building Name!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                ActionResult saveResult = formCtrl._saveFormData(new BuildingModel()
                {
                    BuildingName = txtBuilding.Text.Trim(),
                    BuildingDesc = txtBuilding.Text.Trim(),
                });

                if (saveResult.State)
                {
                    BuildingModel saveObj = saveResult.Data;
                    MessageBox.Show("Building " + saveObj.BuildingName + " Sucessfully Saved!", "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    initForm();
                }
                else
                {
                    MessageBox.Show(saveResult.Data, "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #18
0
        //Getting Building names for the dropdown in Blue Oister bar
        internal List <string> GetBuildings()
        {
            SqlConnection con = new SqlConnection(connectionString);

            con.Open();
            SqlCommand cmd = new SqlCommand("SelectBuildingName", con);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.ExecuteNonQuery();

            SqlDataReader reader    = cmd.ExecuteReader();
            List <string> buildings = new List <string>();

            try
            {
                while (reader.Read())
                {
                    BuildingModel building = new BuildingModel((string)reader["buildingName"], 0);

                    buildings.Add(building.Building);
                }
            }
            catch (Exception)
            {
                throw;
            }

            con.Close();
            return(buildings);
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtBuilding.Text))
            {
                MessageBox.Show("Please select Building first!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                initForm();
            }
            else
            {
                ActionResult deleteResult = formCtrl._deleteFormData(new BuildingModel()
                {
                    BuildingId = buildingId
                });

                if (deleteResult.State)
                {
                    BuildingModel deleteObj = deleteResult.Data;
                    MessageBox.Show("Building " + deleteObj.BuildingName + " Sucessfully Deleted!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    initForm();
                }
                else
                {
                    MessageBox.Show(deleteResult.Data, "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtBuilding.Text))
            {
                MessageBox.Show("Please Fill Building Name first!", "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                ActionResult updateResult = formCtrl._updateFormData(new BuildingModel()
                {
                    BuildingId   = buildingId,
                    BuildingName = txtBuilding.Text.Trim(),
                    BuildingDesc = txtBuilding.Text.Trim(),
                });

                if (updateResult.State)
                {
                    BuildingModel updateObj = updateResult.Data;
                    MessageBox.Show("Building " + updateObj.BuildingName + " Sucessfully Updated!", "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    initForm();
                }
                else
                {
                    MessageBox.Show(updateResult.Data, "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #21
0
        /// <summary>
        /// returns complete list of all records in building table
        /// as a list of building models
        /// </summary>
        public static List <BuildingModel> loadBuildingList()
        {
            List <BuildingModel> buildings = new List <BuildingModel>();

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

            using (conn)
            {
                conn.Open();

                using (SqlCommand command = new SqlCommand(
                           "SELECT * FROM tblBuilding",
                           conn))
                {
                    SqlDataReader dr = command.ExecuteReader();
                    BuildingModel building;
                    while (dr.Read())
                    {
                        building               = new BuildingModel();
                        building.BuildingID    = Convert.ToInt32(dr["buildingID"]);
                        building.BuildingName  = dr["buildingName"].ToString();
                        building.BuildingLabel = dr["buildingLabel"].ToString();
                        building.RoomQty       = Convert.ToInt32(dr["roomQty"]);

                        buildings.Add(building);
                    }
                    dr.Close();
                }
                conn.Close();
            }

            return(buildings);
        }
예제 #22
0
    public BuildingModel Copy()
    {
        BuildingModel a = (BuildingModel)this.MemberwiseClone();

        a._heatMap = new double[7, 7];
        return(a);
    }
예제 #23
0
        public static List <BuildingModel> GetBuilding()
        {
            var buildingModelsList = new List <BuildingModel>();
            var sessionFactory     = SessionFactory.CreateSessionFactory();

            using (var session = sessionFactory.OpenSession())
            {
                using (session.BeginTransaction())
                {
                    var BuildingCreate = session.CreateCriteria(typeof(Building))
                                         .List <Building>();

                    foreach (var bui in BuildingCreate)
                    {
                        var temp = new BuildingModel()
                        {
                            Id           = bui.Id,
                            Type         = bui.Type,
                            HasWindows   = bui.HasWindows,
                            IsIndustrial = bui.IsIndustrial,
                        };

                        buildingModelsList.Add(temp);
                    }

                    return(buildingModelsList);
                }
            }
        }
예제 #24
0
    internal void changeBuildingHeight(BuildingModel[,] city, int x, int y, float newHeight)
    {
        BuildingModel[] block   = new BuildingModel[inputSize];
        int             counter = 0;

        for (int i = x - inputWidth / 2; i < x + inputWidth / 2 + 1; i++)
        {
            for (int j = y - inputWidth / 2; j < y + inputWidth / 2 + 1; j++)
            {
                if (i < 0 || j < 0 || i >= city.GetLength(0) || j >= city.GetLength(1))
                {
                    BuildingModel tmp = new BuildingModel();
                    tmp.Height = 1;
                    //TODO HEIGHT CHANGE
                    block[counter] = tmp;
                }
                else
                {
                    block[counter] = city[i, j];
                }
                counter++;
            }
        }
        counter = 0;
        updateBlock(block, newHeight);
        block[inputSize / 2].Height = newHeight;
    }
예제 #25
0
        public IActionResult GetLocations(EditDeviceModel data)
        {
            //initializing DB managers
            DBManagerDevice dbManager = new DBManagerDevice(configuration);
            DBManagerShared shared    = new DBManagerShared(configuration);

            //get the logs back again
            List <DeviceModel> logs = dbManager.GetDeviceLogs(data.Device.DeviceID);
            int modelID             = shared.GetModelID(data.Device.Model.ModelName);

            data.Logs = logs;
            EditDeviceModel newdata = data;

            //check if image exists
            string filename  = $"Capture_{modelID}.png";
            string imagepath = (string)AppDomain.CurrentDomain.GetData("webRootPath") + "\\DeviceContent\\" + filename;

            if (System.IO.File.Exists(imagepath))
            {
                newdata.ImagePath = filename;
            }

            //fetch storage locations if user has typed a valid room
            if (data.Room != null)
            {
                //prep data for database
                string[] splittedRoom = data.Room.Split('.');

                //prep data model
                EditDeviceModel      editData        = new EditDeviceModel();
                DeviceModel          device          = new DeviceModel();
                BuildingModel        building        = new BuildingModel(splittedRoom[0], Convert.ToByte(splittedRoom[1]));
                StorageLocationModel storageLocation = new StorageLocationModel();
                storageLocation.Location = building;
                device.Location          = storageLocation;
                editData.Device          = device;

                //get storagelocations
                EditDeviceModel locations = dbManager.GetStorageLocations(editData);

                newdata.Shelfs = locations.Shelfs;
                newdata.Shelf  = null;
            }
            //return the same data without having selected anything
            else
            {
                EditDeviceModel storagelocation = dbManager.GetStorageLocations(null);
                newdata.Rooms = storagelocation.Rooms;
                newdata.Shelf = null;
            }



            // clear model
            ModelState.Clear();



            return(View("EditView", newdata));
        }
예제 #26
0
    private void RefreshTiles()
    {
        foreach (Transform child in _contentArea.transform)
        {
            Destroy(child.gameObject);
        }

        BuildingModel[] models = SharedModels.GetModels <BuildingModel>();
        foreach (var model in models)
        {
            var asset = Instantiate(ElementTemplate);
            var tile  = asset.GetComponent <TileView>();
            Assert.IsNotNull(tile, "ElementTemplate does not contain a ColorTileView script");
            tile.transform.SetParent(_contentArea, false);
            tile.ContentModel       = model;
            tile.TileSelectedEvent += OnItemSelected;
            //tile.TileEnableEvent += (itile, go) => Debug.Log(go.name + " enabled: " + itile.IsEnabled);
            tile.AvailabilityDelegate = (tileModel) =>
            {
                BuildingModel buildingModel   = tileModel as BuildingModel;
                int           buildingsNumber = _gridModel.FindAll(buildingModel).Length;
                return(buildingsNumber < buildingModel.MaxNumber);
            };
        }
    }
예제 #27
0
        /// <summary>
        /// Creates a new instance of <see cref="BuildingViewModel"/>
        /// </summary>
        public BuildingViewModel(BuildingModel buildingModel)
        {
            _buildingModel = buildingModel;

            _name        = _buildingModel.Name;
            _description = _buildingModel.Description;
            _map         = _buildingModel.Map;

            foreach (BuildingType buildingType in Enum.GetValues(typeof(BuildingType)).Cast <BuildingType>().OrderBy(x => x.ToString()))
            {
                if (buildingType != BuildingType.Other)
                {
                    _buildingTypeOptions.Add(buildingType, buildingType.ToString().Replace("_", " "));
                }
            }
            _buildingTypeOptions.Add(BuildingType.Other, BuildingType.Other.ToString());
            _selectedBuildingType = _buildingTypeOptions.FirstOrDefault(x => x.Key == _buildingModel.BuildingType);

            _customBuildingType = _buildingModel.CustomBuildingType;

            foreach (RoomModel roomModel in _buildingModel.Rooms)
            {
                RoomViewModel roomViewModel = new RoomViewModel(roomModel);
                roomViewModel.PropertyChanged += RoomViewModel_PropertyChanged;
                _rooms.Add(roomViewModel);
            }

            _browseMapLocationCommand = new RelayCommand(obj => true, obj => BrowseMapLocation());
            _addRoomCommand           = new RelayCommand(obj => true, obj => AddRoom());
            _deleteRoomCommand        = new RelayCommand(obj => true, obj => DeleteRoom(obj as RoomViewModel));
        }
예제 #28
0
        /// <summary>
        /// Update list of rooms on change of content
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ddlroomDropDown_SelectedIndexChanged(object sender, EventArgs e)
        {
            BuildingModel bm = new BuildingModel();

            //Selects single selected building
            bm = buildings.Where(b => b.BuildingID == Int32.Parse(buildingDropdown.Text)).FirstOrDefault();
            int id = bm.BuildingID;

            //Pull all rooms from the database
            rooms = RoomBL.fillRoomsList(id);

            RoomModel rm = new RoomModel();

            //Selects single selected building
            rm = rooms.Where(r => r.RoomID == Int32.Parse(roomDropdown.Text)).FirstOrDefault();
            int rid = rm.RoomID;

            tables = TableBL.FillTableList(rid);


            //Update values from user input
            tableDropdown.DataSource     = tables;
            tableDropdown.DataValueField = "TableID";
            tableDropdown.DataTextField  = "TableID";
            tableDropdown.DataBind();
        }
예제 #29
0
        /// <summary>
        /// Loads a building record by building ID
        /// returns as a building Model
        /// </summary>
        public static BuildingModel loadBuildingByID(int id)
        {
            BuildingModel building = new BuildingModel();

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

            using (conn)
            {
                conn.Open();

                using (SqlCommand command = new SqlCommand(
                           "SELECT * FROM tblBuilding WHERE buildingID=" + "'" + id + "'",
                           conn))
                {
                    SqlDataReader dr = command.ExecuteReader();
                    while (dr.Read())
                    {
                        building               = new BuildingModel();
                        building.BuildingID    = Convert.ToInt32(dr["buildingID"]);
                        building.BuildingName  = dr["buildingName"].ToString();
                        building.BuildingLabel = dr["buildingLabel"].ToString();
                        building.RoomQty       = Convert.ToInt32(dr["roomQty"]);
                        building.street        = dr["street"].ToString();
                        building.suburb        = dr["suburb"].ToString();
                        building.provence      = dr["provence"].ToString();
                        building.country       = dr["country"].ToString();
                    }
                    dr.Close();
                }
                conn.Close();
            }

            return(building);
        }
예제 #30
0
    private void CreateBuilding(BuildingTypesModel buildingTypesModel)
    {
        Debug.Log("Trying to create building " + buildingTypesModel.GetName());
        BuildingModel newBuilding = new BuildingModel(buildingTypesModel);

        RenderBuilding(newBuilding, false);
    }
예제 #31
0
 public Model GetBuildingModel(BuildingModel id)
 {
     return buildingModel[(int) id];
 }