// 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: Probleme/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["IdProbleme"] = "" + id;
            Probleme probleme = new Probleme();

            probleme = probleme.find_by_id(data);

            if (probleme == null)
            {
                return(HttpNotFound());
            }
            return(View(probleme));
        }
        public async Task <ActionResult> Edit([Bind(Include = "IdProbleme,ObjetProbleme,DescreptionProbleme,IdCategorie")] Probleme probleme, Categorie categorie)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser != "Superviseur")
            {
                return(RedirectToAction("InvalidAccess", "Home"));
            }

            try
            {
                if (ModelState.IsValid)
                {
                    probleme.categorie = categorie;
                    probleme.edit_by_id();
                    return(RedirectToAction("Index"));
                }
                return(View(probleme));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create([Bind(Include = "IdProbleme,ObjetProbleme,DescreptionProbleme,IdCategorie")] Probleme probleme, Categorie categorie)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser == "EmployeAgence")
            {
                return(RedirectToAction("InvalidAccess", "Home"));
            }

            try
            {
                probleme.categorie = categorie;
                probleme.save();
            }
            catch
            {
            }
            if (ModelState.IsValid)
            {
                return(RedirectToAction("index"));
            }
            return(View());
        }
        // GET: Probleme/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["IdProbleme"] = "" + id;
            Probleme probleme = new Probleme();

            probleme = probleme.find_by_id(data);
            if (probleme == null)
            {
                return(HttpNotFound());
            }
            return(View(probleme));
        }
        private void FormAjouterDeclaration_Load(object sender, EventArgs e)
        {
            ComboBoxContainer.DataSource    = Modele.Container.FetchAll();
            ComboBoxContainer.DisplayMember = "NumContainer";

            comboBoxProbleme.DataSource    = Probleme.FetchAll();
            comboBoxProbleme.DisplayMember = "LibelleProbleme";
        }
        public ActionResult Index(Probleme probleme)
        {
            Dictionary <string, string> data = new Dictionary <string, string>();

            data["ObjetProbleme"]       = probleme.ObjetProbleme;
            data["DescreptionProbleme"] = probleme.ObjetProbleme;

            return(View("Search", probleme.find_by_search(data)));
        }
Beispiel #8
0
 public FormProbleme(string matiere)
 {
     _matiere = matiere;
     InitializeComponent();
     pbm = Probleme.selectionPbm(matiere, MainMenu.difficile);
     MessageBox.Show("Vous allez avoir une série de 10 problèmes de " + _matiere + " sous forme de QCM.\nUne seule réponse est possible à chaque fois.\nAucune limite de temps pour répondre.\nAppuyer sur OK quand vous êtes prêt.");
     lancerTest();
     verifLB.Visible = false;
 }
        public ActionResult solv(Probleme probleme, Solution solution)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            Ticket ticket = (Session["ticket"] as Ticket);

            if (ticket.EtatTicket == "Cloturé")
            {
                return(View("Error"));
            }

            ticket.DateFermeture = DateTime.Now;
            ticket.EtatTicket    = "Cloturé";
            ticket.edit_by_id();

            ticket.save(probleme);

            solution.probleme = probleme;
            solution.save();

            Dictionary <string, string> id = new Dictionary <string, string>();

            id["[DescriptionSolution]"] = "'" + solution.Description + "'";
            solution = solution.find_by_id(id);
            if (solution != null)
            {
                ticket.save(probleme, solution);
            }


            Ticket_Historique ticket_historique = new Ticket_Historique();

            ticket_historique.Date   = DateTime.Now;
            ticket_historique.Ticket = ticket;

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

            data["IdUser"] = "" + (Session["user"] as Utilisateur).IdUser;
            technicienHD   = technicienHD.find_by_id(data);
            ticket_historique.Technicien = technicienHD;
            ticket_historique.Etat       = "Cloturé";

            // Save Historique :
            ticket_historique.save();



            return(RedirectToAction("Index", "Home"));
        }
 public IActionResult Post([FromBody] Probleme model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _problemeRepository.AddEntity(model);
             if (_problemeRepository.Save())
             {
                 return(Created($"/intervention/{model.Id}", model));
             }
         }
         else
         {
             return(BadRequest(ModelState));
         }
     }
     catch (Exception ex)
     {
         _logger.LogError($"Erreur pour sauvegarder une déclaration de problème : {ex}");
     }
     return(BadRequest("Erreur pour sauvegarder une déclaration de problème"));
 }
 private void comboBoxProbleme_SelectedIndexChanged(object sender, EventArgs e)
 {
     _problemeSelectionee = comboBoxProbleme.SelectedItem as Probleme;
 }