//Returns the searchresult when something has been choosen in the search fields
        public IActionResult LocationAdminResult(EditStorageLocationModel dataFromView)
        {
            DBManagerAdministration     manager          = new DBManagerAdministration(configuration);
            List <StorageLocationModel> storageLocations = manager.GetSelectedStorageLocations(dataFromView);
            EditStorageLocationModel    searchResult     = new EditStorageLocationModel();

            List <string> buildings   = manager.GetBuildings();
            List <byte>   roomNumbers = manager.GetRoomNumbers();
            List <string> shelfNames  = manager.GetShelfName();
            List <byte>   shelfLevels = manager.GetShelfLevel();
            List <byte>   shelfspots  = manager.GetShelfSpot();


            searchResult.Buildings   = buildings;
            searchResult.RoomNumbers = roomNumbers;
            searchResult.ShelfNames  = shelfNames;
            searchResult.ShelfLevels = shelfLevels;
            searchResult.ShelfSpots  = shelfspots;
            searchResult.Filter      = 0;



            searchResult.StorageLocations = storageLocations;
            searchResult.StorageLocation  = dataFromView.StorageLocation;

            return(View("LocationAdmin", searchResult));
        }
Beispiel #2
0
        //Getting specific room, based on the choosen building and roomNr in the mass destruction.
        internal List <StorageLocationModel> GetSpecificRoom(EditStorageLocationModel dataFromView)
        {
            SqlConnection con = new SqlConnection(connectionString);
            SqlCommand    cmd = new SqlCommand("SelectRoomBasedOnBuildingNameAndRoomNr", con);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            if (dataFromView.StorageLocation.Location.Building != null)
            {
                cmd.Parameters.Add("@buildingName", System.Data.SqlDbType.VarChar).Value = dataFromView.StorageLocation.Location.Building;
            }
            else
            {
                cmd.Parameters.Add("@buildingName", System.Data.SqlDbType.VarChar).Value = null;
            }


            if (dataFromView.StorageLocation.Location.RoomNumber > 0)
            {
                cmd.Parameters.Add("@roomNr", System.Data.SqlDbType.TinyInt).Value = dataFromView.StorageLocation.Location.RoomNumber;
            }
            else
            {
                cmd.Parameters.Add("@roomNr", System.Data.SqlDbType.TinyInt).Value = null;
            }


            List <StorageLocationModel> selectedRoom = new List <StorageLocationModel>();

            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                StorageLocationModel selectedRooms = new StorageLocationModel();
                BuildingModel        buildingModel = new BuildingModel();
                buildingModel.Building   = (string)reader["buildingName"];
                buildingModel.RoomNumber = (byte)reader["roomNr"];
                selectedRooms.Location   = buildingModel;

                selectedRoom.Add(selectedRooms);
            }
            con.Close();
            return(selectedRoom);
        }
        public IActionResult LocationAdmin(EditStorageLocationModel dataFromView)
        {
            //Add standard values to the model
            EditStorageLocationModel initialData             = new EditStorageLocationModel();
            StorageLocationModel     selectedStorageLocation = new StorageLocationModel();
            BuildingModel            buildingModel           = new BuildingModel();

            //SortFilterModel sortFilterModel = new SortFilterModel();
            selectedStorageLocation.Location = buildingModel;
            initialData.StorageLocation      = selectedStorageLocation;
            initialData.StorageLocation.Location.Building   = null;
            initialData.StorageLocation.Location.RoomNumber = 0;
            initialData.StorageLocation.ShelfName           = null;
            initialData.StorageLocation.ShelfLevel          = 0;
            initialData.StorageLocation.ShelfSpot           = 0;
            //dummy.Filter = 1;

            DBManagerAdministration     manager          = new DBManagerAdministration(configuration);
            List <string>               buildings        = manager.GetBuildings();
            List <byte>                 roomNumbers      = manager.GetRoomNumbers();
            List <string>               shelfNames       = manager.GetShelfName();
            List <byte>                 shelfLevels      = manager.GetShelfLevel();
            List <byte>                 shelfspots       = manager.GetShelfSpot();
            List <StorageLocationModel> storageLocations = manager.GetSelectedStorageLocations(initialData);

            EditStorageLocationModel dropDownData = new EditStorageLocationModel();

            dropDownData.Buildings        = buildings;
            dropDownData.RoomNumbers      = roomNumbers;
            dropDownData.ShelfNames       = shelfNames;
            dropDownData.ShelfLevels      = shelfLevels;
            dropDownData.ShelfSpots       = shelfspots;
            dropDownData.StorageLocations = storageLocations;
            //dropDownData.SortFilters = sortFilters;

            return(View(dropDownData));
        }
Beispiel #4
0
        //Getting the list of storagelocations, based on the choices med in the Blue Oister bar.
        internal List <StorageLocationModel> GetSelectedStorageLocations(EditStorageLocationModel dataFromView)
        {
            SqlConnection con = new SqlConnection(connectionString);
            SqlCommand    cmd = new SqlCommand("SelectLocationIDBasedOnInputFields", con);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;


            if (dataFromView.StorageLocation.Location.Building != null)
            {
                cmd.Parameters.Add("@buildingName", System.Data.SqlDbType.VarChar).Value = dataFromView.StorageLocation.Location.Building;
            }
            else
            {
                cmd.Parameters.Add("@buildingName", System.Data.SqlDbType.VarChar).Value = null;
            }


            if (dataFromView.StorageLocation.Location.RoomNumber > 0)
            {
                cmd.Parameters.Add("@roomNr", System.Data.SqlDbType.TinyInt).Value = dataFromView.StorageLocation.Location.RoomNumber;
            }
            else
            {
                cmd.Parameters.Add("@roomNr", System.Data.SqlDbType.TinyInt).Value = null;
            }


            if (dataFromView.StorageLocation.ShelfName != null)
            {
                cmd.Parameters.Add("@shelfName", System.Data.SqlDbType.VarChar).Value = dataFromView.StorageLocation.ShelfName;
            }
            else
            {
                cmd.Parameters.Add("@shelfName", System.Data.SqlDbType.VarChar).Value = null;
            }


            if (dataFromView.StorageLocation.ShelfLevel > 0)
            {
                cmd.Parameters.Add("@shelfLevel", System.Data.SqlDbType.TinyInt).Value = dataFromView.StorageLocation.ShelfLevel;
            }
            else
            {
                cmd.Parameters.Add("@shelfLevel", System.Data.SqlDbType.TinyInt).Value = null;
            }


            if (dataFromView.StorageLocation.ShelfSpot > 0)
            {
                cmd.Parameters.Add("@shelfSpot", System.Data.SqlDbType.TinyInt).Value = dataFromView.StorageLocation.ShelfSpot;
            }
            else
            {
                cmd.Parameters.Add("@shelfSpot", System.Data.SqlDbType.TinyInt).Value = null;
            }


            if (dataFromView.Filter > 0)
            {
                cmd.Parameters.Add("@filter", System.Data.SqlDbType.TinyInt).Value = dataFromView.Filter;
            }
            else
            {
                cmd.Parameters.Add("@filter", System.Data.SqlDbType.TinyInt).Value = 1;
            }


            List <StorageLocationModel> selectedStorageLocations = new List <StorageLocationModel>();

            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                StorageLocationModel selectedStorageLocation = new StorageLocationModel();
                BuildingModel        buildingModel           = new BuildingModel();
                buildingModel.Building             = (string)reader["buildingName"];
                buildingModel.RoomNumber           = (byte)reader["roomNr"];
                selectedStorageLocation.Location   = buildingModel;
                selectedStorageLocation.ShelfName  = (string)reader["shelfName"];
                selectedStorageLocation.ShelfLevel = (byte)reader["shelfLevel"];
                selectedStorageLocation.ShelfSpot  = (byte)reader["shelfSpot"];

                selectedStorageLocations.Add(selectedStorageLocation);
            }
            con.Close();
            return(selectedStorageLocations);
        }