//GET: cinemas/DetailsSalle/5
        public ActionResult DetailsSalle(int?id, DateTime?start, DateTime?end)
        {
            Session["isOnRoom"] = 1;

            if (Session[SessionKeys.startDate] != null)
            {
                start = Session[SessionKeys.startDate] as DateTime?;
            }
            ViewBag.start = start;

            if (Session[SessionKeys.endDate] != null)
            {
                end = Session[SessionKeys.endDate] as DateTime?;
            }
            ViewBag.end = end;

            Session[SessionKeys.salleId] = id;
            try
            {
                ManagerSalle manager = new ManagerSalle();
                salle        salle   = manager.GetSalle(id, start, end);
                return(View(salle));
            }
            catch (Exception e)
            {
                TempData.Add("Alert", e.Message);
                return(RedirectToAction("Details", new { id = id }));
            }
        }
 //Get: cinemas/DeleteSalle/5
 public ActionResult DeleteSalle(int?id)
 {
     try
     {
         ManagerSalle manager = new ManagerSalle();
         salle        salle   = manager.GetSalle(id, null, null);
         if (salle != null)
         {
             return(PartialView("PartialDeleteSalle", salle));
         }
     }
     catch (Exception e)
     {
         TempData.Add("Alert", e.Message);
     }
     return(RedirectToAction("Details", new { id = Session[SessionKeys.cinemaId] as int? }));
 }
        //Get: cinemas/EditSalle/5
        public ActionResult EditSalle(int?id)
        {
            salle salle = new salle();

            try
            {
                ManagerSalle manager = new ManagerSalle();
                salle             = manager.GetSalle(id, null, null);
                ViewBag.status_id = new SelectList(new ManagerSalleStatus().GetAllSalleStatus(), "id", "status", salle.status_id);
                return(PartialView("PartialEditSalle", salle));
            }
            catch (Exception e)
            {
                TempData.Add("Alert", e.Message);
                return(RedirectToAction("Details", new { id = salle.cinema_id }));
            }
        }
示例#4
0
        public void IsSalleContainSeance_FalsParam()
        {
            //Arrange
            ManagerSalle manager    = new ManagerSalle(_context);
            salle        ValidSalle = manager.GetSalle(6, null, null);

            //Act
            try
            {
                var testResult = ValidatorSalle.IsSalleContainSeance(ValidSalle);
                //Assert
                Assert.IsFalse(testResult, "La Salle ne Contien pas de Seance mais la fonction dit que oui");
            }
            catch (Exception e)
            {
                Assert.Fail($"unexpected error of type {e.GetType()} occure with a message : {e.Message}");
            }
        }
示例#5
0
        public void IsSalleContainSeance_TrueParam()
        {
            //Arrange
            ManagerSalle manager    = new ManagerSalle(_context);
            salle        ValidSalle = manager.GetSalle(1, new DateTime(1900, 01, 01), new DateTime(2500, 01, 01));

            //Act
            try
            {
                var testResult = ValidatorSalle.IsSalleContainSeance(ValidSalle);
                //Assert
                Assert.IsTrue(testResult, "La Salle Contien des Seance mais la fonction dit que non");
            }
            catch (Exception e)
            {
                Assert.Fail($"unexpected error of type {e.GetType()} occure with a message : {e.Message}");
            }
        }
示例#6
0
        public void IsSalleActive_FalsParam()
        {
            //Arrange
            ManagerSalle manager       = new ManagerSalle(_context);
            salle        InactiveSalle = manager.GetSalle(6, null, null);

            //Act
            try
            {
                var testResult = ValidatorSalle.IsSalleActive(InactiveSalle);
                //Assert
                Assert.IsFalse(testResult, "La Salle n'est pas Active mais la fonction dit que OUI");
            }
            catch (Exception e)
            {
                Assert.Fail($"unexpected error of type {e.GetType()} occure with a message : {e.Message}");
            }
        }
 public ActionResult DeleteSalle(int id)
 {
     try
     {
         ManagerSalle manager = new ManagerSalle();
         int          cineId  = manager.GetSalle(id, null, null).cinema_id;
         if (manager.DeleteSalles(id))
         {
             return(RedirectToAction("Details", new { id = cineId }));
         }
     }
     catch (Exception e)
     {
         TempData.Add("Alert", e.Message);
     }
     Session[SessionKeys.roomTab] = "Delete";
     Session[SessionKeys.roomId]  = id;
     return(RedirectToAction("Details", new { id = Session[SessionKeys.cinemaId] as int? }));
 }