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 ActionResult Create(Ticket_Historique t) { try { t.Date = DateTime.Now; t.save(); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Ticket/Details/5 public ActionResult Details(int?id) { if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } // Get the Ticket by id : Dictionary <String, String> data = new Dictionary <string, string>(); data["IdTicket"] = "" + id; Ticket ticket = new Ticket(); ticket = ticket.find_by_id(data); // Verify ticket exsistance if (ticket == null) { return(HttpNotFound()); } if (ticket.EtatTicket != "En cours" && ticket.EtatTicket != "Cloturé") { ticket.EtatTicket = "En attente"; ticket.edit_by_id(); } // Save ticket in the history : Ticket_Historique ticket_historique = new Ticket_Historique(); ticket_historique.Date = DateTime.Now; ticket_historique.Ticket = ticket; Utilisateur technicienHD = new Utilisateur(); Dictionary <String, String> data2 = new Dictionary <string, string>(); data2["IdUser"] = "" + (Session["user"] as Utilisateur).IdUser; technicienHD = technicienHD.find_by_id(data2); ticket_historique.Technicien = technicienHD; ticket_historique.Etat = "En attente"; ticket_historique.save(); return(View(ticket)); }
public ActionResult Details(Ticket ticket) { if (Session["user"] == null) { return(RedirectToAction("Index", "Home")); } try { Dictionary <String, String> _data = new Dictionary <string, string>(); _data["IdTicket"] = "" + ticket.IdTicket; ticket = ticket.find_by_id(_data); if (ticket.EtatTicket != "Cloturé") { ticket.EtatTicket = "En cours"; ticket.edit_by_id(); } Session["ticket"] = ticket; // TODO: Add update logic here 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 = "En cours"; // Save Historique : ticket_historique.save(); return(RedirectToAction("Resoudre")); } catch { return(View("Error")); } }