// Constructeur de la classe public WPF_ModifRMA(Class.C_Ticket ticket, Class.C_Administrative adm = null, Class.C_Technical tech = null) { // Initialisation des composants InitializeComponent(); // Récupération des paramètres this.ticket = ticket; this.adm = adm; this.tech = tech; // Remise à zéro du formulaire RAZ(); // Mise en place des informations this.TXT_ClientCity.Text = ticket.Client.City; this.TXT_ClientFax.Text = ticket.Client.Fax; this.TXT_ClientMail.Text = ticket.Client.Mail; this.TXT_ClientName.Text = ticket.Client.Name; this.TXT_ClientStreet.Text = ticket.Client.Street; this.TXT_ClientStreetBox.Text = ticket.Client.StreetBox; this.TXT_ClientStreetNB.Text = ticket.Client.StreetNumber; this.TXT_ClientTel.Text = ticket.Client.Telephone; this.TXT_ClientZipCode.Text = ticket.Client.ZipCode; this.TXT_RMANote.Text = ticket.Note; this.TXT_RMAObjec.Text = ticket.Subject; // Préparation de la DataTable dtDGV = new DataTable(); dtDGV.Clear(); dtDGV.Columns.Add("ID"); dtDGV.Columns.Add("Technicien"); dtDGV.Columns.Add("Début"); dtDGV.Columns.Add("Fin"); dtDGV.Columns.Add("Sujet"); this.DGV_InterventionList.ItemsSource = dtDGV.AsDataView(); // Remplissage de la datagrid FillDataGrid(); // Vérification du type d'utilisateur if (adm != null) { this.BTN_AddInterv.IsEnabled = false; this.BTN_RemoveInterv.IsEnabled = false; this.TXT_RMANote.IsEnabled = true; this.TXT_RMAObjec.IsEnabled = true; this.BTN_Accept.IsEnabled = true; } else { this.BTN_AddInterv.IsEnabled = true; this.BTN_RemoveInterv.IsEnabled = true; this.TXT_RMANote.IsEnabled = false; this.TXT_RMAObjec.IsEnabled = false; this.BTN_Accept.IsEnabled = false; } }
// Constructeur de la classe public WPF_SearchRMA(string call, Class.C_Technical tech = null, Class.C_Administrative adm = null) { try { // Initialisation des composants InitializeComponent(); // Mise à zéro des variables dt = null; // Remise à zéro du formulaire RAZ(); // Récupération du type de formulaire appelant this.call = call; this.adm = adm; this.tech = tech; // Préparation de la DataTable this.dt = new DataTable(); this.dt = Class.C_Database.RetrieveOpenedTickets(); // Récupération depuis la DB // Préparation de la DataTable dtDGV = new DataTable(); dtDGV.Columns.Add("Numéro"); dtDGV.Columns.Add("Date d'encodage"); dtDGV.Columns.Add("Nom du client"); dtDGV.Columns.Add("Sujet"); this.DGV_Search.ItemsSource = dtDGV.AsDataView(); // Premier remplissage de la DGV DataRow[] dr = new DataRow[dt.Rows.Count]; int i = 0; foreach (DataRow r in dt.Rows) { dr[i] = r; i++; } FillDGV(dr); } catch (Exception ex) { // Message d'erreur MessageBox.Show("Le programme a rencontré une ou plusieur(s) erreur(s) : \n\n" + ex.Message); // Fermeture du formulaire this.Close(); } }
// Constructeur de la classe public WPF_AddInterv(Class.C_Ticket ticket, Class.C_Technical tech) { // Initialisation des composants InitializeComponent(); // Remise à zéro du formulaire RAZ(); // Récupération des variables this.ticket = ticket; this.tech = tech; // Chargement du numéro de ticket this.TXT_RMANumber.Text = Class.C_Database.SelectIDTicket(ticket).ToString(); }
// Constructeur de la classe public UC_Technical(Class.C_Technical tech) { try { // Initialisation des composants InitializeComponent(); // Mise en place des variables d'instanciation this.tech = tech; // Mise à zéro du formulaire RAZ(); // Préparation de la DataTable dtDGV = new DataTable(); dtDGV.Columns.Add("Numéro"); dtDGV.Columns.Add("Date d'encodage"); dtDGV.Columns.Add("Nom du client"); dtDGV.Columns.Add("Sujet"); this.DGV_RMAList.ItemsSource = dtDGV.AsDataView(); // Préparation de la DataTable this.dt = new DataTable(); this.dt = Class.C_Database.RetrieveOpenedTickets(); // Récupération depuis la DB // Création du timer timer = new DispatcherTimer(); // Instanciation du timer timer.Tick += new EventHandler(timer_Tick); // Abonnement à la méthode pour le Tick timer.Interval = new TimeSpan(0, 1, 0); // Définition du temps d'attente entre les Ticks timer.Start(); // Remplis la DataGrid FillDataGrid(); } catch (Exception ex) { // Affichage du message d'erreur MessageBox.Show("Le programme a rencontré une ou plusieur(s) erreur(s) : \n\n" + ex.Message); // Fermeture de l'applicatif App.Current.Shutdown(); } }
// Constructeur de la classe public WPF_ModifInterv(Class.C_Ticket ticket, Class.C_Intervention interv, Class.C_Technical tech) { // Initialisation des composants InitializeComponent(); // Récupération des informaitons this.ticket = ticket; this.interv = interv; this.tech = tech; // Remise à zéro du fomulaire RAZ(); // Mise en place des informations this.TXT_HeureBeg.Text = interv.DateBeg.Hour.ToString(); this.TXT_HeureFin.Text = interv.DateEnd.Hour.ToString(); this.TXT_MinuteBeg.Text = interv.DateBeg.Minute.ToString(); this.TXT_MinuteFin.Text = interv.DateEnd.Minute.ToString(); this.TXT_Note.Text = interv.Note; this.TXT_Object.Text = interv.Label; this.TXT_RMANumber.Text = Class.C_Database.SelectIDTicket(ticket).ToString(); this.DTP_DateBeg.SelectedDate = interv.DateBeg.Date; this.DTP_DateFin.SelectedDate = interv.DateEnd.Date; }
// Evènement de click du bouton de connexion private void BTN_Connection_Click(object sender, RoutedEventArgs e) { // Déclaration des variables locales Class.C_User tmpUser = null; Class.C_Technical tmpTech = null; try { // Instanciation d'un utilisateur temporaire tmpUser = Class.C_Database.SelectUser(this.TXT_Username.Text); // Vérification que l'utilisateur à bien été instancié if (tmpUser.Username != null && tmpUser.Username != "") { // Vérification si l'authentification se passe bien if (tmpUser.Authentification(this.TXT_Username.Text, this.PWD_Password.Password)) { // Mise en place du nom d'utilisateur et du passage du login this.loginState = true; this.username = tmpUser.Username; // Instanciation d'un technicien temporaire tmpTech = Class.C_Database.SelectTechnical(username); // Vérification que le technicien à bien été instancié if (tmpTech.Username != null) { // Mise en place du type d'utilisateur sur 'Technical' this.userType = "Technical"; } else { // Mise en place du type d'utilisateur sur 'Administrative' this.userType = "Administrative"; } // Remise à zéro des champs et fermeture de la fenêtre RAZ(); this.Close(); } else { // Message de mauvais USN ou PWD MessageBox.Show("Le nom d'utilisateur et/ou le mot de passe n'est pas valide. Veuillez réessayer svp."); // Mise des variables a null ou faux this.loginState = false; this.username = null; this.userType = null; } } else { // Message de mauvais USN ou PWD MessageBox.Show("Le nom d'utilisateur et/ou le mot de passe n'est pas valide. Veuillez réessayer svp."); } } catch (Exception ex) { // Affichage du message d'erreur en cas d'exception MessageBox.Show("Le programme a rencontré une ou plusieur(s) erreur(s) : \n\n" + ex.Message); } }