Beispiel #1
0
        /// <summary>
        /// redigerar building objekt
        /// </summary>
        /// <param name="buildingID"></param>
        public bool EditBuilding(string buildingID)
        {
            building.BuildingID = buildingID;

            if (controller.EditBuilding(buildingID, building))
            {
                SQLQuery.EditBuilding(buildingID, building);
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Tries to add buildings into the local list from the database
        /// </summary>
        public void SetDataFromDatabase()
        {
            DataTable dataTable           = SQLQuery.RetrieveAllBuildings();
            string    residentialCategory = new ResidentialBuilding().GetBuildingCategory();
            string    category;
            Building  building;

            for (int row = 0; row < dataTable.Rows.Count; row++)
            {
                category = dataTable.Rows[row].Field <string>("Category");

                if (category.Equals(residentialCategory))
                {
                    building = SetResidentialBuilding(dataTable, row);
                }
                else
                {
                    building = SetCommercialBuilding(dataTable, row);
                }
                list.Add(building);
            }
            SetDisplayList();
        }