Example #1
0
 // Méthode de modification du ticket
 public void ModifTicket(DateTime dateIN, string subject, string note, C_Client client)
 {
     this.dateIN  = dateIN;
     this.subject = subject;
     this.note    = note;
     this.cli     = client;
 }
Example #2
0
 // Constructeur par paramètres
 public C_Ticket(DateTime dateIN, string subject, string note, C_Client client)
 {
     this.dateIN       = dateIN;
     this.subject      = subject;
     this.note         = note;
     this.flagFinished = false;
     this.listInterv   = new List <C_Intervention>();
     this.cli          = client;
 }
Example #3
0
 // Constructeur par défaut
 public C_Ticket()
 {
     this.dateIN       = DateTime.MinValue;
     this.subject      = null;
     this.note         = null;
     this.flagFinished = false;
     this.listInterv   = null;
     this.cli          = null;
 }
Example #4
0
        // Méthode de récupération de l'ID d'un client
        private static int SelectIDClient(C_Client cli)
        {
            Customer cli1;

            try
            {
                cli1 = db.Customers.Single(c => c.Name == cli.Name);
                return(cli1.ID);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Example #5
0
 // Méthode de mise à jour d'un client
 public static void UpdateClient(C_Client cli)
 {
     try
     {
         db.PS_Update_Customer(cli.Name,
                               cli.ZipCode,
                               cli.City,
                               cli.Street,
                               cli.StreetNumber,
                               (cli.StreetBox != null) ? cli.StreetBox : DBNull.Value.ToString(),
                               cli.Telephone,
                               (cli.Fax != null) ? cli.Fax : DBNull.Value.ToString(),
                               cli.Mail);
         db.SubmitChanges();
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Example #6
0
 // Méthode de récupération d'un ticket
 public static C_Ticket SelectTicket(int num)
 {
     try
     {
         db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.Tickets);
         var ticket = from t in db.Tickets
                      where t.ID == num
                      select t;
         if (ticket.Count() > 0)
         {
             C_Client tmpClient = SelectClient(ticket.First().IDCustomer);
             C_Ticket tick      = new C_Ticket(ticket.First().DateIN,
                                               ticket.First().Subject,
                                               (ticket.First().Note == null ? null : ticket.First().Note),
                                               tmpClient);
             var interv = from i in db.Interventions
                          where i.IDTicket == ticket.First().ID
                          select i;
             foreach (Intervention i in interv)
             {
                 C_Technical    tech  = SelectTechnical(i.Technical.User.Usn);
                 C_Intervention inter = new C_Intervention(i.DateBegin,
                                                           i.DateEnd,
                                                           i.Subject,
                                                           i.TechnicalNote,
                                                           tech);
                 tick.AddIntervInList(inter);
             }
             return(tick);
         }
         else
         {
             return(new C_Ticket());
         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }