Exemplo n.º 1
0
 // Constructeur par paramètres
 public C_Administrative(string usn, string pwd, string fname, string lname, string mail, bool fadmin, bool factive, bool fdelete, double salary, string internPhone) :
     base(usn, pwd, fname, lname, mail, fadmin, factive, fdelete)
 {
     this.salary      = salary;
     this.internPhone = internPhone;
     this.ticket      = null;
 }
Exemplo n.º 2
0
        // Méthode de récupération de l'ID d'un ticket
        public static int SelectIDTicket(C_Ticket ticket)
        {
            Ticket ticket1;

            try
            {
                ticket1 = db.Tickets.Single(t => t.Customer.Name == ticket.Client.Name && t.DateIN == ticket.DateIN);
                return(ticket1.ID);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 3
0
        // Méthode de réouverture d'un ticket
        public static void ReopenTicket(C_Ticket ticket)
        {
            int idTicket;

            try
            {
                idTicket = SelectIDTicket(ticket);
                db.PS_Other_ReopenTicket(idTicket);
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 4
0
        // Méthode d'ajout d'une note à un ticket
        public static void AddTicketNote(C_Ticket ticket)
        {
            int idTicket;

            try
            {
                idTicket = SelectIDTicket(ticket);
                db.PS_Other_AddTicketNote(idTicket, ticket.Note);
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 5
0
        // Méthode d'ajout d'une note à l'intervention
        public static void AddInterventionNote(C_Intervention interv, C_Ticket ticket)
        {
            int idInterv;

            try
            {
                idInterv = SelectIDIntervention(interv, ticket);
                db.PS_Other_AddInterventionNote(idInterv, interv.Note);
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 6
0
        // Delete / Undelete

        // Méthode de suppression d'une intervention
        public static void DeleteIntervention(C_Intervention interv, C_Ticket ticket)
        {
            int idInterv;

            try
            {
                idInterv = SelectIDIntervention(interv, ticket);
                db.PS_Delete_Intervention(idInterv);
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 7
0
        // Méthode de récupération de l'ID d'une intervention
        public static int SelectIDIntervention(C_Intervention interv, C_Ticket ticket)
        {
            Intervention interv1;

            try
            {
                interv1 = db.Interventions.Single(i => i.Technical.User.Usn == interv.TechnicalUsername &&
                                                  i.Ticket.Customer.Name == ticket.Client.Name &&
                                                  i.DateBegin == interv.DateBeg &&
                                                  i.DateEnd == interv.DateEnd);
                return(interv1.ID);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 8
0
        // Méthode d'insertion d'un ticket
        public static void InsertTicket(C_Ticket ticket, C_Administrative adm)
        {
            int idCustomer, idAdmin;

            try
            {
                idCustomer = SelectIDClient(ticket.Client);
                idAdmin    = SelectIDAdministrative(adm);
                db.PS_Insert_Ticket(idCustomer,
                                    idAdmin,
                                    ticket.Subject,
                                    ticket.DateIN,
                                    (ticket.Note != null) ? ticket.Note : DBNull.Value.ToString());
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 9
0
        // Méthode d'insertion d'une intervention
        public static void InsertIntervention(C_Intervention interv, C_Ticket ticket)
        {
            int idTech, idTicket;

            try
            {
                idTech   = SelectIDTechnical(usn: interv.TechnicalUsername);
                idTicket = SelectIDTicket(ticket);
                db.PS_Insert_Intervention(idTicket,
                                          idTech,
                                          interv.DateBeg,
                                          interv.DateEnd,
                                          interv.Label,
                                          (interv.Note != null) ? interv.Note : DBNull.Value.ToString());
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 10
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);
     }
 }
Exemplo n.º 11
0
        // Méthode de mise à jour d'un ticket
        public static void UpdateTicket(C_Ticket ticket, C_Administrative admin)
        {
            int idTicket, idClient, idAdmin;

            try
            {
                idTicket = SelectIDTicket(ticket);
                idClient = SelectIDClient(ticket.Client);
                idAdmin  = SelectIDAdministrative(admin);
                db.PS_Update_Ticket(idTicket,
                                    idClient,
                                    idAdmin,
                                    ticket.Subject,
                                    ticket.DateIN,
                                    (ticket.Note != null) ? ticket.Note : DBNull.Value.ToString(),
                                    ticket.FlagFinished);
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 12
0
 // Constructeur par défaut
 public C_Administrative()
 {
     this.salary      = float.MinValue;
     this.internPhone = null;
     this.ticket      = null;
 }