コード例 #1
0
 public Details(IMapList tree,
     Guid id,
     string roomName,
     Guid mapId,
     string mapName,
     Guid buildingId,
     string buildingName,
     Guid campusId,
     string campusName,
     string mapImageUrl,
     Polygon roomPolygon,
     string roomType,
     IEnumerable<string> roomTypes,
     int capacity,
     IEnumerable<string> equipment,
     IDictionary<string, int> roomEquipment)
 {
     Id = id;
     RoomName = roomName;
     MapId = mapId;
     MapName = mapName;
     BuildingId = buildingId;
     BuildingName = buildingName;
     CampusId = campusId;
     CampusName = campusName;
     MapImageUrl = mapImageUrl;
     RoomPolygon = roomPolygon;
     RoomType = roomType;
     RoomTypes = roomTypes;
     Capacity = capacity;
     Equipment = equipment;
     RoomEquipment = roomEquipment;
     RootItems = tree.RootItems;
     SelectedItem = tree.SelectedItem;
 }
コード例 #2
0
        public ViewResult Details(Guid Id)
        {
            var tree = new TreeSource().GetTree(Id, Url);

            var roomId = Id;
            var mapId = FacilitiesSingleton.Facilities.GetParent(roomId);
            var buildingId = FacilitiesSingleton.Facilities.GetParent(mapId);
            var campusId = FacilitiesSingleton.Facilities.GetParent(buildingId);

            var campus = tree.RootItems.Single(item => item.Id == campusId);
            var campusName = campus.Text;

            var building = campus.Children.Single(item => item.Id == buildingId);
            var buildingName = building.Text;

            var map = building.Children.Single(item => item.Id == mapId);
            var mapName = map.Text;

            var room = map.Children.Single(item => item.Id == roomId);
            var roomName = room.Text;

            var mapImageUrl = Url.Action("Image", "Map", new {Id = mapId});

            var roomPolygon = new Polygon(new[]
                                              {
                                                  new[] {257, 94},
                                                  new[] {257, 213},
                                                  new[] {327, 213},
                                                  new[] {327, 94}
                                              });

            var model = new Details(tree, roomId, roomName, mapId, mapName, buildingId, buildingName, campusId,
                                    campusName, mapImageUrl, roomPolygon,
                                    null,
                                    GetRoomTypes(),
                                    25,
                                    new[]
                                        {
                                            "PC",
                                            "Whiteboard",
                                            "Lab Sink",
                                            "Projector"
                                        },
                                    new Dictionary<string, int>
                                        {
                                            {"PC", 25},
                                            {"Whiteboard", 2},
                                            {"Projector", 1}
                                        });
            return View(model);
        }