コード例 #1
0
        public ViewResult Info()
        {
            //створюємо об'єкт для передачі в шаблон
            RoomInfoViewModel obj = new RoomInfoViewModel();

            obj.Room      = _allRooms.getObjectRoom(0);
            obj.Category  = _allCatagories.AllCategories.FirstOrDefault();
            ViewBag.Title = "";
            return(View(obj));//передача об'єкта в шаблон
        }
コード例 #2
0
        public IActionResult Info(int id)
        {
            var room  = _roomService.GetRoom(id);
            var model = new RoomInfoViewModel
            {
                Room        = room,
                Users       = _userService.GetUsersInRoom(room.RoomId),
                Connections = _connectionService.GetRoomConnections(room.RoomId, true),
            };

            return(View(model));
        }
コード例 #3
0
        public async Task <IActionResult> RoomDetails(int?id)
        {
            var dto = await _roomRepository.GetByIdAsync(id);

            var bookings = await _bookingRepository.GetByRoomIdAsync(id.Value);

            RoomInfoViewModel viewModel = new RoomInfoViewModel
            {
                Room     = dto,
                Bookings = bookings
            };

            return(View(viewModel));
        }
コード例 #4
0
        public static IEnumerable <string> GetRoomInfoByCourseId(int courseId)
        {
            List <string> infos = null;

            string sql = "SELECT r.Number, d.Name, ra.FromTime, ra.ToTime FROM RoomAllocations ra " +
                         "INNER JOIN Rooms r ON r.Id = ra.RoomId " +
                         "INNER JOIN DaysOfWeek d ON d.Id = ra.DayId " +
                         "WHERE ra.CourseId=" + courseId;


            Command = new SqlCommand(sql, Connection);

            Connection.Open();

            SqlDataReader reader = Command.ExecuteReader();

            if (reader.HasRows)
            {
                infos = new List <string>();
                while (reader.Read())
                {
                    RoomInfoViewModel model = new RoomInfoViewModel
                    {
                        RoomNo   = reader["Number"].ToString(),
                        Day      = reader["Name"].ToString(),
                        FromTime = DateTime.Parse(reader["FromTime"].ToString()),
                        ToTime   = DateTime.Parse(reader["ToTime"].ToString())
                    };

                    infos.Add(GetRoomInfo(model));
                }
            }

            reader.Close();

            Connection.Close();

            return(infos ?? new List <string> {
                "Not Allocated Yet Gateway"
            });
        }
コード例 #5
0
 public RoomInfoView()
 {
     InitializeComponent();
     BindingContext = new RoomInfoViewModel();
 }
コード例 #6
0
 public static string GetRoomInfo(RoomInfoViewModel model)
 {
     return("R. No : " + model.RoomNo + ", " + model.Day + ", "
            + model.FromTime.ToString("hh:mm tt") + " - "
            + model.ToTime.ToString("hh:mm tt"));
 }