/// <summary>
 /// Créez un nouvel objet Ticket.
 /// </summary>
 /// <param name="ticketID">Valeur initiale de la propriété TicketID.</param>
 /// <param name="title">Valeur initiale de la propriété Title.</param>
 /// <param name="stateSolved">Valeur initiale de la propriété StateSolved.</param>
 /// <param name="stateRead">Valeur initiale de la propriété stateRead.</param>
 /// <param name="dateCreation">Valeur initiale de la propriété DateCreation.</param>
 /// <param name="dateModification">Valeur initiale de la propriété DateModification.</param>
 /// <param name="summary">Valeur initiale de la propriété Summary.</param>
 /// <param name="contents">Valeur initiale de la propriété Contents.</param>
 /// <param name="iDMarchand">Valeur initiale de la propriété IDMarchand.</param>
 /// <param name="iDUser">Valeur initiale de la propriété IDUser.</param>
 public static Ticket CreateTicket(global::System.Int32 ticketID, global::System.String title, global::System.Int32 stateSolved, global::System.Int32 stateRead, global::System.DateTime dateCreation, global::System.DateTime dateModification, global::System.String summary, global::System.String contents, global::System.Int32 iDMarchand, global::System.Int32 iDUser)
 {
     Ticket ticket = new Ticket();
     ticket.TicketID = ticketID;
     ticket.Title = title;
     ticket.StateSolved = stateSolved;
     ticket.stateRead = stateRead;
     ticket.DateCreation = dateCreation;
     ticket.DateModification = dateModification;
     ticket.Summary = summary;
     ticket.Contents = contents;
     ticket.IDMarchand = iDMarchand;
     ticket.IDUser = iDUser;
     return ticket;
 }
示例#2
0
 public void Delete(Ticket ticket)
 {
     MsiRepo.Tickets.DeleteObject(ticket);
 }
 /// <summary>
 /// Méthode déconseillée pour ajouter un nouvel objet à l'EntitySet Tickets. Utilisez la méthode .Add de la propriété ObjectSet&lt;T&gt; associée à la place.
 /// </summary>
 public void AddToTickets(Ticket ticket)
 {
     base.AddObject("Tickets", ticket);
 }
示例#4
0
 //-------------------------------------------------------------------------------------------//
 //-----------------------------------REQUETES TICKETS----------------------------------------//
 //-------------------------------------------------------------------------------------------//
 public void Add(Ticket ticket)
 {
     MsiRepo.Tickets.AddObject(ticket);
 }
示例#5
0
 public void Update(Ticket ticket)
 {
     MsiRepo.Tickets.Attach(ticket);
     MsiRepo.ObjectStateManager.ChangeObjectState(ticket, EntityState.Modified);
 }
        public ActionResult Add(TicketsAddViewModel customModel)
        {
            if (customModel != null)
            {
                if (customModel.MarchandID == 0)
                {

                    if (customModel.MarchandID == 0 & customModel.Name != null & customModel.Url != null & customModel.Contact != null & customModel.Telephone != 0)
                    {
                        Marchand marchand = new Marchand()
                        {
                            Name = customModel.Name,
                            Url = customModel.Url,
                            Phone = customModel.Telephone,
                            ContactName = customModel.Contact,
                        };
                        MsiRepoMarchand.Add(marchand);
                        MsiRepoMarchand.Save();
                        customModel.MarchandID = MsiRepoMarchand.GetIdMarchand(customModel.Url).MarchandID;

                    }
                    else
                    {

                        ViewData["marchandID"] = marchandBox();
                        if (customModel.MarchandID == 0)
                        {
                            ModelState.AddModelError("choiceError", "Choisissez un marchand dans la liste déroulante ou ajouter un nouveau marchand à l'aide des champs");
                        }

                        if (customModel.Name == null)
                        {

                            ModelState.AddModelError("nameError", "vous devez entrer un nom");
                        }

                        if (customModel.Url == null)
                        {

                            ModelState.AddModelError("urlError", "vous devez entrer une URL");
                        }

                        if (customModel.Telephone == 0)
                        {

                            ModelState.AddModelError("phoneError", "vous devez rentrer un numéro de téléphone");
                        }

                        if (customModel.Contact == null)
                        {

                            ModelState.AddModelError("contactError", "vous devez rentrer le nom de votre contact technique");
                        }

                        return View("Add");
                    }
                }

                //customModel.ID_User = MsiRepoUser.GetUserByMail((User as CustomPrincipal).Mail).UserID;
                customModel.ID_User = MsiRepoUser.GetUser(User.Identity.Name).UserID;
                Ticket ticket = new Ticket()
                {
                    IDUser = customModel.ID_User,
                    Title = customModel.Title,
                    Summary = customModel.Summary,
                    Contents = customModel.Description,
                    DateCreation = DateTime.Now,
                    DateModification = DateTime.Now,
                    StateSolved = 0,
                    stateRead = 0,
                    IDMarchand = customModel.MarchandID
                };
                MsiRepoTicket.Add(ticket);
                MsiRepoTicket.Save();

                return View("CreateTicketSuccess");
            }
            else
                return View("NotFound");
        }
 public ActionResult Edit(Ticket ticket)
 {
     if (ModelState.IsValid)
     {
         MsiRepoTicket.Update(ticket);
         MsiRepoTicket.Save();
         return View("EditTicketSuccess");
     }
     return View(ticket);
 }
 public InvestigationDetailViewModel(Hypothesis hypothese, Ticket ticket, List<Hypothesis> investigation)
 {
     this.hypothese = hypothese;
     this.Ticket = ticket;
     this.Investigation = investigation;
 }