/**
         * GET: Notification
         * Page d'index de la liste des notifications
         */
        public ActionResult Index()
        {
            int idCurrentUser = (int)Session["userId"];
            List <NotificationDTO>     notifs = notifLogic.ListAllForUser(idCurrentUser);
            NotificationIndexViewModel vm     = new NotificationIndexViewModel
            {
                Notifications = GetNotificationsTuples(notifLogic.ListAllForUser(idCurrentUser))
            };

            Session["notifs"] = notifLogic.ListAllForUser(idCurrentUser).FindAll(n => n.IsRead == 0).Count;
            return(View(vm));
        }
        public ActionResult Insert(RequestBookingDTO _requestBooking, int[] passagers, int?driver, int?driver2, StopOverDTO stopOver)
        {
            RequestBookingInsertViewsModel vm = new RequestBookingInsertViewsModel();

            vm.Addresses = PopulateAddress();
            vm.Users     = PopulateUsers();

            int idCurrentUser = (int)Session["userId"];

            Session["notifs"] = notificationLogic.ListAllForUser(idCurrentUser).FindAll(n => n.IsRead == 0).Count;

            return(View(vm));
        }
Exemple #3
0
 public ActionResult Index()
 {
     if (Session["userId"] == null)
     {
         return(RedirectToAction("Login", "Account"));
     }
     else
     {
         int idCurrentUser = (int)Session["userId"];
         ViewBag.AdminNotifs = notifLogic.ListAllForUser(idCurrentUser).FindAll(n => n.IsRead == 0 && n.IsForAdmin == 1).Count;
         Session["notifs"]   = notifLogic.ListAllForUser(idCurrentUser).FindAll(n => n.IsRead == 0).Count;
         return(View());
     }
 }
        public ActionResult Login(UserDTO userDTO, string ReturnUrl)
        {
            UserDTO userDetails = utilisateurLogic.GetUserByMail(userDTO.Email);

            if (userDetails == null)
            {
                userDTO.LoginErrorMessage = "Aucun compte n'a été trouvé avec cette addresse";
                return(View("Login", userDTO));
            }
            else if (SecurePasswordHasherHelper.Verify(userDTO.Password, userDetails.Password) == false)
            {
                userDTO.LoginErrorMessage = "Vérifiez vos identifiants";
                return(View("Login", userDTO));
            }
            else
            {
                Session["userID"]    = userDetails.Id;
                Session["firstname"] = userDetails.Firstname;
                Session["lastName"]  = userDetails.Lastname;
                Session["userJob"]   = userDetails.Job;

                Session["notifs"] = notifLogic.ListAllForUser(userDetails.Id).FindAll(n => n.IsRead == 0).Count;

                FormsAuthentication.SetAuthCookie(userDetails.Email, false);
                return(Redirect("/"));
            }
        }
Exemple #5
0
        // GET: Reservation
        public ActionResult Index()
        {
            int idCurrentUser = (int)Session["userId"];

            Session["notifs"] = notificationLogic.ListAllForUser(idCurrentUser).FindAll(n => n.IsRead == 0).Count;

            return(View());
        }
        public ActionResult Index()
        {
            BookingIndexViewsModel vm = new BookingIndexViewsModel();

            vm.Addresses = PopulateAddress();
            vm.Users     = PopulateUsers();

            int idCurrentUser = (int)Session["userId"];

            Session["notifs"] = notificationLogic.ListAllForUser(idCurrentUser).FindAll(n => n.IsRead == 0).Count;

            return(View(vm));
        }
Exemple #7
0
        /// <summary>
        /// Affiche la page de configuration
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            ConfigurationIndexViewModel Civm = new ConfigurationIndexViewModel()
            {
                ListRoleWithActionTuple = actionLogic.GetListTupleRoleAction(roleLogic.List())
            };

            int idCurrentUser = (int)Session["userId"];

            Session["notifs"] = notificationLogic.ListAllForUser(idCurrentUser).FindAll(n => n.IsRead == 0).Count;

            return(View(Civm));
        }
Exemple #8
0
        // GET: Voiture
        public ActionResult Index()
        {
            CarIndexViewsModel vm = new CarIndexViewsModel
            {
                CarsMakes = GetCarsMakes(),
                Companys  = GetCompanys()
            };

            int idCurrentUser = (int)Session["userId"];

            Session["notifs"] = notificationLogic.ListAllForUser(idCurrentUser).FindAll(n => n.IsRead == 0).Count;

            return(View(vm));
        }
        public ActionResult Index()
        {
            int idCurrentUser = (int)Session["userId"];

            Session["notifs"] = notifLogic.ListAllForUser(idCurrentUser).FindAll(n => n.IsRead == 0).Count;

            List <UserDTO>    users     = userLogic.ListActive();
            List <CompanyDTO> companies = companyLogic.List();
            List <RoleDTO>    roles     = roleLogic.List();

            Tuple <UserDTO, CompanyDTO, List <RoleDTO> > userToEdit = null;

            if (TempData["userToEdit"] != null)
            {
                int     userId = (int)TempData["UserToEdit"];
                UserDTO usr    = userLogic.Get(userId);
                userToEdit = UserDTOTOTuple(usr);
            }

            UtilisateurIndexViewModel vm = new UtilisateurIndexViewModel
            {
                Users      = UsersDTOToTuple(users),
                Companies  = companies,
                Roles      = roles,
                UserToEdit = userToEdit
            };

            if (TempData["FormError"] != null)
            {
                ViewBag.FormError = TempData["FormError"].ToString();
            }

            if (TempData["SuccessModal"] != null)
            {
                ViewBag.SuccessModal = TempData["SuccessModal"].ToString();
            }
            if (TempData["ErrorModal"] != null)
            {
                ViewBag.ErrorModal = TempData["ErrorModal"].ToString();
            }

            return(View("Index", vm));
        }
Exemple #10
0
        public ActionResult Index(int?idUser)
        {
            int        idCurrentUser = idUser == null ? (int)Session["userId"] : (int)idUser;
            bool       isMyProfile   = idUser == null ? true : false;
            UserDTO    user          = userLogic.Get(idCurrentUser);
            RoleDTO    role          = new RoleDTO();
            CompanyDTO company       = companyLogic.List().Find(c => c.Id == user.Id_Company);

            Session["notifs"] = notificationLogic.ListAllForUser(idCurrentUser).FindAll(n => n.IsRead == 0).Count;

            ProfileIndexViewModel vm = new ProfileIndexViewModel
            {
                CurrentUser          = new Tuple <UserDTO, CompanyDTO, RoleDTO>(user, company, role),
                isSessionUserProfile = isMyProfile
            };

            if (TempData["ErrorModal"] != null)
            {
                ViewBag.ErrorModal = TempData["ErrorModal"].ToString();
            }
            if (TempData["EditDrivingLicence"] != null)
            {
                ViewBag.EditDrivingLicence = TempData["EditDrivingLicence"].ToString();
            }
            ViewBag.RenderContactForm = "off";
            if (TempData["RenderContactForm"] != null)
            {
                ViewBag.RenderContactForm = TempData["RenderContactForm"].ToString();
            }
            ViewBag.RenderInformationsForm = "off";
            if (TempData["RenderInformationsForm"] != null)
            {
                ViewBag.RenderInformationsForm = TempData["RenderInformationsForm"].ToString();
            }
            return(View(vm));
        }