Esempio n. 1
0
 private void activerCompteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (lstVw_ActorsList.SelectedItems.Count > 0)
     {
         //Get the selected Actor.
         ListViewItem selected = lstVw_ActorsList.SelectedItems[0];
         //Delete an Expert.
         if (rdbtn_Expert.Checked)
         {
             Manager.Expert expert = new Manager.Expert();
             expert.setLogin(selected.SubItems[1].Text);
             expert.Activate();
         }
         else//Delete a Technician.
         {
             Manager.Technician tech = new Manager.Technician();
             tech.setLogin(selected.SubItems[1].Text);
             tech.Activate();
         }
         loadListView();
     }
     else
     {
         MessageBox.Show(this, "Pas d'intervenant sélectionné!", "Message d'erreur", MessageBoxButtons.OK,
                         MessageBoxIcon.Warning);
     }
 }
Esempio n. 2
0
 private void btn_Modify_Click(object sender, EventArgs e)
 {
     //Manager.Expert expert = new Manager.Expert(selected.SubItems[3].Text,selected.SubItems[4].Text,selected.SubItems[5].Text,selected.SubItems[6].Text,
     //    selected.SubItems[7].Text,selected.SubItems[8].Text,selected.SubItems[9].Text,selected.SubItems[1].Text,selected.SubItems[2].Text);
     if (lstVw_ActorsList.SelectedItems.Count > 0)
     {
         //Get the selected Actor.
         ListViewItem selected = lstVw_ActorsList.SelectedItems[0];
         //Modify an Expert account.
         if (rdbtn_Expert.Checked)
         {
             Manager.Expert expert = new Manager.Expert(selected.SubItems[3].Text, selected.SubItems[4].Text, selected.SubItems[5].Text, selected.SubItems[6].Text,
                                                        selected.SubItems[7].Text, selected.SubItems[8].Text, selected.SubItems[9].Text, selected.SubItems[1].Text, selected.SubItems[2].Text);
             frm_ModifyActor modifActor = new frm_ModifyActor("Expert", expert);
             modifActor.ShowDialog();
             loadListView();
         }
         else//Modify a Technician account.
         {
             Manager.Technician tech = new Manager.Technician(selected.SubItems[3].Text, selected.SubItems[4].Text, selected.SubItems[5].Text, selected.SubItems[6].Text,
                                                              selected.SubItems[7].Text, selected.SubItems[8].Text, selected.SubItems[9].Text, selected.SubItems[1].Text, selected.SubItems[2].Text);
             frm_ModifyActor modifActor = new frm_ModifyActor("Technicien", tech);
             modifActor.ShowDialog();
             loadListView();
         }
         loadListView();
     }
     else
     {
         MessageBox.Show(this, "Pas d'intervenant sélectionné!", "Message d'erreur", MessageBoxButtons.OK,
                         MessageBoxIcon.Warning);
     }
 }
Esempio n. 3
0
 //Delete(Deactivate) an Actor account from the system.
 private void btn_Delete_Click(object sender, EventArgs e)
 {
     if (lstVw_ActorsList.SelectedItems.Count > 0)
     {
         DialogResult dr = MessageBox.Show(this, "Voulez vous vraiment supprimer cet intervenant?", "Message de confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.No)
         {
             return;
         }
         //Get the selected Actor.
         ListViewItem selected = lstVw_ActorsList.SelectedItems[0];
         //Delete an Expert.
         if (rdbtn_Expert.Checked)
         {
             Manager.Expert expert = new Manager.Expert();
             expert.setLogin(selected.SubItems[1].Text);
             expert.Delete();
         }
         else//Delete a Technician.
         {
             Manager.Technician tech = new Manager.Technician();
             tech.setLogin(selected.SubItems[1].Text);
             tech.Delete();
         }
         loadListView();
     }
     else
     {
         MessageBox.Show(this, "Pas d'intervenant sélectionné!", "Message d'erreur", MessageBoxButtons.OK,
                         MessageBoxIcon.Warning);
     }
 }
Esempio n. 4
0
        private void btn_Modify_Click(object sender, EventArgs e)
        {
            //Manager.Expert expert = new Manager.Expert(selected.SubItems[3].Text,selected.SubItems[4].Text,selected.SubItems[5].Text,selected.SubItems[6].Text,
            //    selected.SubItems[7].Text,selected.SubItems[8].Text,selected.SubItems[9].Text,selected.SubItems[1].Text,selected.SubItems[2].Text);
            if (lstVw_ActorsList.SelectedItems.Count > 0)
            {

                //Get the selected Actor.
                ListViewItem selected = lstVw_ActorsList.SelectedItems[0];
                //Modify an Expert account.
                if (rdbtn_Expert.Checked)
                {
                    Manager.Expert expert = new Manager.Expert(selected.SubItems[3].Text, selected.SubItems[4].Text, selected.SubItems[5].Text, selected.SubItems[6].Text,
                        selected.SubItems[7].Text, selected.SubItems[8].Text, selected.SubItems[9].Text, selected.SubItems[1].Text, selected.SubItems[2].Text);
                    frm_ModifyActor modifActor = new frm_ModifyActor("Expert", expert);
                    modifActor.ShowDialog();
                    loadListView();
                }
                else//Modify a Technician account.
                {
                    Manager.Technician tech = new Manager.Technician(selected.SubItems[3].Text, selected.SubItems[4].Text, selected.SubItems[5].Text, selected.SubItems[6].Text,
                        selected.SubItems[7].Text, selected.SubItems[8].Text, selected.SubItems[9].Text, selected.SubItems[1].Text, selected.SubItems[2].Text);
                    frm_ModifyActor modifActor = new frm_ModifyActor("Technicien", tech);
                    modifActor.ShowDialog();
                    loadListView();
                }
                loadListView();
            }
            else
                MessageBox.Show(this, "Pas d'intervenant sélectionné!", "Message d'erreur", MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
        }
Esempio n. 5
0
 //Delete(Deactivate) an Actor account from the system.
 private void btn_Delete_Click(object sender, EventArgs e)
 {
     if (lstVw_ActorsList.SelectedItems.Count > 0)
     {
         DialogResult dr= MessageBox.Show(this, "Voulez vous vraiment supprimer cet intervenant?", "Message de confirmation", MessageBoxButtons.YesNo,MessageBoxIcon.Question);
         if (dr == DialogResult.No)
             return;
         //Get the selected Actor.
         ListViewItem selected = lstVw_ActorsList.SelectedItems[0];
         //Delete an Expert.
         if (rdbtn_Expert.Checked)
         {
             Manager.Expert expert = new Manager.Expert();
             expert.setLogin(selected.SubItems[1].Text);
             expert.Delete();
         }
         else//Delete a Technician.
         {
             Manager.Technician tech = new Manager.Technician();
             tech.setLogin(selected.SubItems[1].Text);
             tech.Delete();
         }
         loadListView();
     }
     else
         MessageBox.Show(this, "Pas d'intervenant sélectionné!", "Message d'erreur", MessageBoxButtons.OK,
                             MessageBoxIcon.Warning);
 }
Esempio n. 6
0
 private void activerCompteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (lstVw_ActorsList.SelectedItems.Count > 0)
     {
         //Get the selected Actor.
         ListViewItem selected = lstVw_ActorsList.SelectedItems[0];
         //Delete an Expert.
         if (rdbtn_Expert.Checked)
         {
             Manager.Expert expert = new Manager.Expert();
             expert.setLogin(selected.SubItems[1].Text);
             expert.Activate();
         }
         else//Delete a Technician.
         {
             Manager.Technician tech = new Manager.Technician();
             tech.setLogin(selected.SubItems[1].Text);
             tech.Activate();
         }
         loadListView();
     }
     else
         MessageBox.Show(this, "Pas d'intervenant sélectionné!", "Message d'erreur", MessageBoxButtons.OK,
                             MessageBoxIcon.Warning);
 }
Esempio n. 7
0
        //Add an Actor (Expert/Technician) to the data base.
        private void btn_Validate_Click(object sender, EventArgs e)
        {
            if (Check_Fields())
            {
                //T for Technician
                if (lbl_Actor.Text[0] == 'T')
                {
                    //The instructions to modify a technician data.
                    Manager.Technician tech = new Manager.Technician(txtBx_FirstName.Text, txtBx_LastName.Text, txtBx_Email.Text,
                                                                     txtBx_Phone.Text, txtBx_Address.Text, txtBx_Role.Text, txtBx_Specialty.Text, txtBx_Login.Text, txtBx_Password.Text);

                    if (Check_Technician(tech))
                    {
                        if (PasswordDontMatch())
                        {
                            lbl_Password.ForeColor        = Color.OrangeRed;
                            lbl_ConfirmPassword.ForeColor = Color.OrangeRed;
                            MessageBox.Show(this, "Les mots de passe ne sont pas identiques.", "Message d'erreur",
                                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        else//Modify the Technician.
                        {
                            //If the login(id) doesn't already exist in the DB add this technician.
                            MessageBox.Show(tech.getLogin());
                            if (!tech.Exists() || (tech.getLogin() == _Actor.getLogin()))
                            {
                                if (tech.Modify(_Actor.getLogin()))
                                {
                                    MessageBox.Show(this, "Modification terminée avec succès.", "Message d'information", MessageBoxButtons.OK,
                                                    MessageBoxIcon.Information);
                                    this.Close();
                                }
                                else
                                {
                                    MessageBox.Show(this, "Modification terminée avec erreurs.", "Message d'information", MessageBoxButtons.OK,
                                                    MessageBoxIcon.Information);
                                }
                            }
                            else
                            {
                                MessageBox.Show(this, "Le login existe deja.", "Message d'erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Il y a des champs invalides dans le formulaires(en rouge).");
                    }
                }
                else//E for an Expert
                if (lbl_Actor.Text[0] == 'E')
                {
                    //The instructions to modify an expert data.
                    Manager.Expert expert = new Manager.Expert(txtBx_FirstName.Text, txtBx_LastName.Text, txtBx_Email.Text,
                                                               txtBx_Phone.Text, txtBx_Address.Text, txtBx_Role.Text, txtBx_Specialty.Text, txtBx_Login.Text, txtBx_Password.Text);
                    if (Check_Expert(expert))
                    {
                        if (PasswordDontMatch())
                        {
                            lbl_Password.ForeColor        = Color.OrangeRed;
                            lbl_ConfirmPassword.ForeColor = Color.OrangeRed;
                            MessageBox.Show(this, "Les mots de passe ne sont pas identiques.", "Message d'erreur",
                                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        else    //Modify the Expert.
                        {
                            //If the login(id) doesn't already exist in the DB add this expert.
                            if (!expert.Exists() || (expert.getLogin() == _Actor.getLogin()))
                            {
                                if (expert.Modify(_Actor.getLogin()))
                                {
                                    MessageBox.Show(this, "Modification terminée avec succès.", "Message d'information", MessageBoxButtons.OK,
                                                    MessageBoxIcon.Information);
                                    this.Close();
                                }
                                else
                                {
                                    MessageBox.Show(this, "Modification terminée avec erreurs.", "Message d'information", MessageBoxButtons.OK,
                                                    MessageBoxIcon.Information);
                                }
                            }
                            else
                            {
                                MessageBox.Show(this, "Le login existe deja.", "Message d'erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Il y a des champs invalides dans le formulaires(en rouge).");
                    }
                }
            }
            else
            {
                MessageBox.Show(this, "Remplir tous les champs d'abord.", "Message d'erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 8
0
        //Add an Actor (Expert/Technician) to the data base.
        private void btn_Validate_Click(object sender, EventArgs e)
        {
            if (Check_Fields())
            {
                //T for Technician
                if (lbl_Actor.Text[0] == 'T')
                {
                    //The instructions to add a technician to the data base.
                    Manager.Technician tech = new Manager.Technician(txtBx_FirstName.Text, txtBx_LastName.Text, txtBx_Email.Text,
                        txtBx_Phone.Text, txtBx_Address.Text, txtBx_Role.Text, txtBx_Specialty.Text, txtBx_Login.Text, txtBx_Password.Text);
                    if (Check_Technician(tech))
                    {
                        if (PasswordDontMatch())
                        {
                            lbl_Password.ForeColor = Color.OrangeRed;
                            lbl_ConfirmPassword.ForeColor = Color.OrangeRed;
                            MessageBox.Show(this, "Les mots de passe ne sont pas identiques.", "Message d'erreur",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        else//Add the Technician.
                        {
                            //If the login(id) doesn't already exist in the DB add this technician.
                            if (!tech.Exists())
                            {
                                if (tech.Add())
                                {
                                    MessageBox.Show(this, "Ajout terminé avec succès.", "Message d'information", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                                this.Close();
                                }
                                else
                                    MessageBox.Show(this, "Ajout terminé avec erreurs.", "Message d'information", MessageBoxButtons.OK,
                                           MessageBoxIcon.Information);
                            }
                            else
                                MessageBox.Show(this, "Le login existe deja.", "Message d'erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                        MessageBox.Show("Il y a des champs invalides dans le formulaires(en rouge).");

                }
                else//E for an Expert
                    if (lbl_Actor.Text[0] == 'E')
                    {
                        //The instructions to add a expert to the data base.
                        Manager.Expert expert = new Manager.Expert(txtBx_FirstName.Text, txtBx_LastName.Text, txtBx_Email.Text,
                            txtBx_Phone.Text, txtBx_Address.Text, txtBx_Role.Text, txtBx_Specialty.Text, txtBx_Login.Text, txtBx_Password.Text);
                        if (Check_Expert(expert))
                        {
                            if (PasswordDontMatch())
                            {
                                lbl_Password.ForeColor = Color.OrangeRed;
                                lbl_ConfirmPassword.ForeColor = Color.OrangeRed;
                                MessageBox.Show(this, "Les mots de passe ne sont pas identiques.", "Message d'erreur",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }

                            else//Add the Expert.
                            {
                                //If the login(id) doesn't already exist in the DB add this expert.
                                if (!expert.Exists())
                                {
                                    expert.Add();
                                    MessageBox.Show(this, "Ajout terminé.", "Message d'information", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                                    this.Close();
                                }
                                else
                                    MessageBox.Show(this, "Le login existe deja.", "Message d'erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                            MessageBox.Show("Il y a des champs invalides dans le formulaires(en rouge).");
                    }
            }
            else
            {
                MessageBox.Show(this, "Remplir tous les champs d'abord.", "Message d'erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }