コード例 #1
0
        public ActionResult Index()
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Login", "Utilisateur"));
            }
            ViewBag.date = "" + DateTime.Now.Year;

            if ((Session["user"] as Utilisateur).EtatUser == "Superviseur")
            {
                Dictionary <String, String> data = new Dictionary <string, string>();
                data["IdUser"] = "" + (Session["user"] as Utilisateur).IdUser;
                Superviseur superviseur = new Superviseur();
                Session["user"] = superviseur.find_by_id(data);
            }
            if ((Session["user"] as Utilisateur).EtatUser == "TechnicienHelpdesk")
            {
                Dictionary <String, String> data = new Dictionary <string, string>();
                data["IdUser"] = "" + (Session["user"] as Utilisateur).IdUser;
                TechnicienHelpDesk technicienHelpDesk = new TechnicienHelpDesk();
                Session["user"] = technicienHelpDesk.find_by_id(data);
            }

            if ((Session["user"] as Utilisateur).EtatUser == "employerAgence")
            {
                Dictionary <String, String> data = new Dictionary <string, string>();
                data["IdUser"] = "" + (Session["user"] as Utilisateur).IdUser;
                Ticket t = new Ticket();
                return(View("ticket_em", t));
                //  Utilisateur technicienHelpDesk = new Utilisateur();
                //  Session["user"] = technicienHelpDesk.find_by_id(data);
            }
            return(View());
        }
コード例 #2
0
        // GET: Probleme
        public ActionResult Index()
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser == "EmployeAgence")
            {
                return(RedirectToAction("InvalidAccess", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser == "Superviseur")
            {
                Dictionary <String, String> data = new Dictionary <string, string>();
                data["IdUser"] = "" + (Session["user"] as Utilisateur).IdUser;
                Superviseur superviseur = new Superviseur();
                Session["user"] = superviseur.find_by_id(data);
            }
            if ((Session["user"] as Utilisateur).EtatUser == "TechnicienHelpdesk")
            {
                Dictionary <String, String> data = new Dictionary <string, string>();
                data["IdUser"] = "" + (Session["user"] as Utilisateur).IdUser;
                TechnicienHelpDesk technicienHelpDesk = new TechnicienHelpDesk();
                Session["user"] = technicienHelpDesk.find_by_id(data);
            }


            Probleme probleme = new Probleme();

            return(View(probleme));
        }
        // GET: TechnicienHelpDesk/Details/5
        public ActionResult Details(int?id)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Dictionary <String, String> data = new Dictionary <string, string>();

            data["IdUser"] = "" + id;
            TechnicienHelpDesk tech = new TechnicienHelpDesk();

            tech = tech.find_by_id(data);

            if (tech == null)
            {
                return(HttpNotFound());
            }
            return(View(tech));
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser != "Superviseur")
            {
                return(RedirectToAction("InvalidAccess", "Home"));
            }


            try
            {
                Dictionary <String, String> data = new Dictionary <string, string>();
                data["IdUser"] = "" + id;
                TechnicienHelpDesk tech = new TechnicienHelpDesk();
                tech = tech.find_by_id(data);
                tech.remove(data);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        // GET: TechnicienHelpDesk/Edit/5

        public ActionResult Edit(int?id)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser != "Superviseur")
            {
                return(RedirectToAction("InvalidAccess", "Home"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Dictionary <String, String> data = new Dictionary <string, string>();

            data["IdUser"] = "" + id;
            TechnicienHelpDesk tech = new TechnicienHelpDesk();

            tech = tech.find_by_id(data);
            if (tech == null)
            {
                return(HttpNotFound());
            }
            return(View(tech));
        }
コード例 #6
0
        public ActionResult GetMyTickets()
        {
            if ((Session["user"] as Utilisateur).EtatUser == "Superviseur")
            {
                Dictionary <String, String> data = new Dictionary <string, string>();
                data["IdUser"] = "" + (Session["user"] as Utilisateur).IdUser;
                Superviseur superviseur = new Superviseur();
                Session["user"] = superviseur.find_by_id(data);
            }
            if ((Session["user"] as Utilisateur).EtatUser == "TechnicienHelpdesk")
            {
                Dictionary <String, String> data = new Dictionary <string, string>();
                data["IdUser"] = "" + (Session["user"] as Utilisateur).IdUser;
                TechnicienHelpDesk technicienHelpDesk = new TechnicienHelpDesk();
                Session["user"] = technicienHelpDesk.find_by_id(data);
            }

            Ticket ticket = new Ticket();

            return(PartialView("_MyTicketsList", ticket.GetAllTickets()));
        }