Ejemplo n.º 1
0
        public List <cmetier.Personnel> sendReqInfo()
        {
            string       req = "select * from salarie";
            MySqlCommand cmd = form_gestion.instance.CreateCommand();

            cmd.CommandText = req;
            MySqlDataReader reader;

            reader = cmd.ExecuteReader();
            cmetier.Personnel        personnel;
            List <cmetier.Personnel> list_personnel = new List <cmetier.Personnel>();

            while (reader.Read())
            {
                int    id           = reader.GetInt32(0);
                string nom          = reader.GetString(1);
                string prenom       = reader.GetString(2);
                int    mobile       = reader.GetInt32(3);
                string type_service = reader.GetString(4);
                string mail         = reader.GetString(5);
                int    responsable  = reader.GetInt32(6);

                personnel = new cmetier.Personnel(id, nom, prenom, mobile, type_service, mail, responsable, 0, "");
                list_personnel.Add(personnel);
            }
            reader.Close();
            return(list_personnel);
        }
Ejemplo n.º 2
0
        public List <cmetier.Personnel> getAllSalarieVehicule()
        {
            string       req = "SELECT * FROM salarie WHERE immatriculation!=''";
            MySqlCommand cmd = form_gestion.instance.CreateCommand();

            cmd.CommandText = req;
            MySqlDataReader reader;

            reader = cmd.ExecuteReader();
            cmetier.Personnel        salarie;
            List <cmetier.Personnel> list_salarie = new List <cmetier.Personnel>();

            while (reader.Read())
            {
                int    id              = reader.GetInt32(0);
                string nom             = reader.GetString(1);
                string prenom          = reader.GetString(2);
                int    mobile          = reader.GetInt32(3);
                string type_service    = reader.GetString(4);
                string mail            = reader.GetString(5);
                int    responsable     = reader.GetInt32(6);
                int    id_vehicule     = reader.GetInt32(7);
                string immatriculation = reader.GetString(8);

                salarie = new cmetier.Personnel(id, nom, prenom, mobile, type_service, mail, responsable, id_vehicule, immatriculation);
                list_salarie.Add(salarie);
            }
            reader.Close();
            return(list_salarie);
        }
Ejemplo n.º 3
0
        public bool updateResponsableTypeService(cmetier.Personnel responsable, string new_responsable)
        {
            string       req;
            MySqlCommand cmd = form_gestion.instance.CreateCommand();

            req             = "UPDATE salarie SET responsable='0' WHERE id_salarie='" + responsable.Id_salarie + "'";
            cmd.CommandText = req;
            cmd.ExecuteNonQuery();
            req             = "UPDATE salarie SET responsable='1' WHERE id_salarie='" + new_responsable + "'";
            cmd.CommandText = req;
            cmd.ExecuteNonQuery();

            return(true);
        }
Ejemplo n.º 4
0
        private void _combo_vehicule_affect_service_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <cmetier.Personnel> list_personnels  = new List <cmetier.Personnel>();
            MySqlDataReader          personnel_reader = personneldb.getInfoSalarieService(_combo_vehicule_affect_service.SelectedItem.ToString());

            while (personnel_reader.Read())
            {
                string nom    = personnel_reader.GetString(1);
                string prenom = personnel_reader.GetString(1);
                int    id     = personnel_reader.GetInt32(0);

                cmetier.Personnel perso = new cmetier.Personnel(id, nom, prenom, 0, "", "", 0, 0, "");
                list_personnels.Add(perso);
            }
            personnel_reader.Close();
        }
Ejemplo n.º 5
0
        public List <cmetier.Personnel> getSalarieTypeService(string type_service)
        {
            List <cmetier.Personnel> perso = new List <cmetier.Personnel>();

            MySqlDataReader reader_nom;
            MySqlCommand    cmd = form_gestion.instance.CreateCommand();
            string          req = "SELECT DISTINCT id_salarie, nom, prenom FROM salarie WHERE type_service='" + type_service + "'";

            cmd.CommandText = req;
            reader_nom      = cmd.ExecuteReader();
            while (reader_nom.Read())
            {
                cmetier.Personnel infoperso = new cmetier.Personnel(reader_nom.GetInt32(0), reader_nom.GetString(1), reader_nom.GetString(2), 0, "", "", 0, 0, "");
                perso.Add(infoperso);
            }
            reader_nom.Close();
            return(perso);
        }
Ejemplo n.º 6
0
        public cmetier.Personnel getResponsableTypeService(string type_service)
        {
            cmetier.Personnel perso;
            string            nom    = "";
            string            prenom = "";
            int id_salarie           = 0;

            MySqlDataReader reader_nom;
            MySqlCommand    cmd = form_gestion.instance.CreateCommand();
            string          req = "SELECT id_salarie, prenom, nom FROM salarie WHERE type_service='" + type_service + "' AND responsable=1";

            cmd.CommandText = req;
            reader_nom      = cmd.ExecuteReader();
            while (reader_nom.Read())
            {
                nom        = reader_nom.GetString(2);
                prenom     = reader_nom.GetString(1);
                id_salarie = reader_nom.GetInt16(0);
            }
            reader_nom.Close();
            perso = new cmetier.Personnel(id_salarie, nom, prenom, 0, "", "", 0, 0, "");
            return(perso);
        }
Ejemplo n.º 7
0
        public void reading()
        {
            list_vehicules = vehicule_instance.getVehiculesUsed();

            foreach (cmetier.Vehicule vehicule in list_vehicules)
            {
                vehicule_used = vehicule_instance.getVehiculeById(vehicule.Id);


                dgv_vehicule.Rows.Add(vehicule_used.Id, vehicule.Imma, vehicule_used.Marque, vehicule_used.Modele, vehicule_used.Annee);
            }

            List <cmetier.Service> list_services = new List <cmetier.Service>();

            list_services = servicedb.sendReqInfo();

            foreach (cmetier.Service service in list_services)
            {
                _combo_vehicule_affect_service.Items.Add(service.Type_service);
            }
            _combo_vehicule_affect_service.SelectedIndex = 0;

            List <cmetier.Personnel> list_personnels  = new List <cmetier.Personnel>();
            MySqlDataReader          personnel_reader = personneldb.getInfoSalarieService(_combo_vehicule_affect_service.SelectedItem.ToString());

            while (personnel_reader.Read())
            {
                string nom    = personnel_reader.GetString(1);
                string prenom = personnel_reader.GetString(1);
                int    id     = personnel_reader.GetInt32(0);

                cmetier.Personnel perso = new cmetier.Personnel(id, nom, prenom, 0, "", "", 0, 0, "");
                list_personnels.Add(perso);
            }

            personnel_reader.Close();
        }