Exemplo n.º 1
0
        public ActionResult SelectedFloorChanged(AnmalanModel incomingAnmalan)
        {
            AnmalanModel anmalan = TempData["anmalan"] as AnmalanModel;

            anmalan.SelectedFloorCode = incomingAnmalan.SelectedFloorCode;

            //Floor
            if (anmalan.SelectedFloorCode == null)
            {
                anmalan.SelectedFloorCode = null;

                anmalan.RoomList         = new List <Room>();
                anmalan.SelectedRoomCode = null;
            }
            else
            {
                PrismaServiceClient client = new PrismaServiceClient();

                RequestMessageGetFloors requestMessageGetFloors = new RequestMessageGetFloors();
                requestMessageGetFloors.BuildingCode = anmalan.SelectedBuildingCode;

                var responseMessageGetFloors = client.GetFloors(requestMessageGetFloors);
                var floors = responseMessageGetFloors.Floors;
                anmalan.FloorList         = new List <Floor>(floors);
                anmalan.SelectedFloorCode = anmalan.SelectedFloorCode;

                //Room
                RequestMessageGetRooms requestMessageGetRooms = new RequestMessageGetRooms();
                requestMessageGetRooms.BuildingCode = anmalan.SelectedBuildingCode;
                requestMessageGetRooms.FloorCode    = anmalan.SelectedFloorCode;
                var responseMessageGetRooms = client.GetRooms(requestMessageGetRooms);
                var rooms = responseMessageGetRooms.Rooms;
                anmalan.RoomList         = new List <Room>(rooms);
                anmalan.SelectedRoomCode = null;

                client.Close();
            }

            TempData["anmalan"] = anmalan;
            return(View("Index", anmalan));
        }
Exemplo n.º 2
0
        public ActionResult SelectedBuildingChanged(AnmalanModel incomingAnmalan)
        {
            AnmalanModel anmalan = TempData["anmalan"] as AnmalanModel;

            if (incomingAnmalan.SelectedBuildingCode == null)
            {
                anmalan.SelectedBuildingCode = null;

                anmalan.FloorList = new List<Floor>();
                anmalan.SelectedFloorCode = null;

                anmalan.RoomList = new List<Room>();
                anmalan.SelectedRoomCode = null;
            }
            else
            {
                anmalan.SelectedBuildingCode = incomingAnmalan.SelectedBuildingCode;

                PrismaServiceClient client = new PrismaServiceClient();
                RequestMessageGetFloors request = new RequestMessageGetFloors();
                request.BuildingCode = anmalan.SelectedBuildingCode;

                //Floor
                var response = client.GetFloors(request);
                var floors = response.Floors;
                anmalan.FloorList = new List<Floor>(floors);
                anmalan.SelectedFloorCode = null;

                //Room
                anmalan.RoomList = new List<Room>();
                anmalan.SelectedRoomCode = null;

                client.Close();
            }

            TempData["anmalan"] = anmalan;
            return View("Index", anmalan);
        }