Exemplo n.º 1
0
        public ActionResult RoomDate(ReservationAuditoriumDay model)
        {
            string[] parse = model.date.Split(' ');

            string[] parts = parse[parse.Length - 1].Split('.');

            int year = int.Parse(parts[2]), month = int.Parse(parts[1]), day = int.Parse(parts[0]);

            DateTime date = new DateTime(year, month, day, 0, 0, 0);

            ReservationManager reservManager = new ReservationManager(date);

            if (model.auditorium != null)
            {
                reservManager.Table = new List <List <TD> >();

                reservManager.Table = reservManager.GetDayRoomReservation(date, model.auditorium);

                ViewBag.id = "td-day";

                ViewBag.Room = model.auditorium;

                ViewBag.Date = date;
            }
            else
            {
                ViewBag.id = "td";

                ViewBag.Auditoriums = db.Auditorium;
            }

            return(PartialView("Table", reservManager));
        }
Exemplo n.º 2
0
        public ActionResult IndexRoomDate(ReservationAuditoriumDay model)
        {
            string[] stringDate = model.date.Split(' ');

            string[] parts = stringDate[1].Split('.');

            int year = int.Parse(parts[2]), month = int.Parse(parts[1]), day = int.Parse(parts[0]);

            DateTime date = new DateTime(year, month, day, 0, 0, 0);

            return(RedirectToAction("Index", "Room", new { date = date, room = model.auditorium }));
        }
Exemplo n.º 3
0
        public ActionResult RoomWeek(ReservationAuditoriumDay model)
        {
            string[] parse = model.date.Split(' ');

            string[] parts = parse[parse.Length - 1].Split('.');

            int year = int.Parse(parts[2]), month = int.Parse(parts[1]), day = int.Parse(parts[0]);

            DateTime date = new DateTime(year, month, day, 0, 0, 0);

            ReservationManager reservManager = new ReservationManager(date);

            reservManager.Table = new List <List <TD> >();

            reservManager.Table = reservManager.GetWeekReservation(date, model.auditorium);

            ViewBag.id = "td";

            ViewBag.week = reservManager.GetDays(date);

            return(PartialView("Table", reservManager));
        }
Exemplo n.º 4
0
        public int IsCanBlockOnPeriod(ReservationAuditoriumDay model)
        {
            int result = 1;

            string[] parts = model.date.Split('.');

            int year = int.Parse(parts[2]), month = int.Parse(parts[1]), day = int.Parse(parts[0]);

            DateTime date = new DateTime(year, month, day, DateTime.Now.Hour + 1, 0, 0);

            if (date < DateTime.Now)
            {
                return(2); //in the past
            }

            ReservationManager reservManager = new ReservationManager(date);

            reservManager.Table = new List <List <TD> >();

            if (model.period)
            {
                reservManager.Table = reservManager.GetDayRoomReservation(date, model.auditorium);
            }
            else
            {
                reservManager.Table = reservManager.GetWeekReservation(date, model.auditorium);
            }

            if (
                (from tr in reservManager.Table from td in tr where td.ReservationId > 0 select td).Any(
                    td => td.FinishDate > DateTime.Now || td.StartDate > DateTime.Now))
            {
                return(0); //reservation is exist
            }

            return(result);
        }