Exemple #1
0
        public static List <incident> afficheIncidCollection()
        {
            incident        unIncident;
            List <incident> lesIncidents = new List <incident>();

            MySqlConnection conn = new MySqlConnection(connexion);

            conn.Open();

            MySqlCommand cmd = conn.CreateCommand();

            cmd.CommandText = "SELECT objet_incid, niv_urgence_incid, date_incid, etat_incid, type_charge_incid, id_mat, id_tech, id_user FROM incident";

            MySqlDataReader uneLigne = cmd.ExecuteReader();

            while (uneLigne.Read())
            {
                unIncident = new incident(Convert.ToString(uneLigne["objet_incid"]), Convert.ToInt32(uneLigne["niv_urgence_incid"]), Convert.ToString(uneLigne["date_incid"]), Convert.ToInt32(uneLigne["etat_incid"]), Convert.ToString(uneLigne["type_charge_incid"]), Convert.ToInt32(uneLigne["id_mat"]), Convert.ToInt32(uneLigne["id_tech"]), Convert.ToInt32(uneLigne["id_user"]));
                lesIncidents.Add(unIncident);
            }

            conn.Close();

            return(lesIncidents);
        }
Exemple #2
0
        //Ajoute incident
        public static void ajouteIncid(incident unIncid)
        {
            MySqlConnection conn = new MySqlConnection(connexion);

            conn.Open();

            MySqlCommand cmd = conn.CreateCommand();

            cmd.CommandText = "INSERT INTO incident(objet_incid,niv_urgence_incid,date_incid,etat_incid,type_charge_incid,id_mat,id_tech,id_user)" +
                              "VALUES(@objet, @nivUrgence, @date, @etat, @priseCharge, @idMat,  @idTech,@idUser)";
            cmd.Parameters.AddWithValue("@objet", unIncid.Objet);
            cmd.Parameters.AddWithValue("@nivUrgence", unIncid.NivUrgence);
            cmd.Parameters.AddWithValue("@date", unIncid.DateIncid);
            cmd.Parameters.AddWithValue("@etat", unIncid.EtatIncid);
            cmd.Parameters.AddWithValue("@priseCharge", unIncid.TypePriseCharge);
            cmd.Parameters.AddWithValue("@idMat", unIncid.IdMat);
            cmd.Parameters.AddWithValue("@idTech", unIncid.IdTech);
            cmd.Parameters.AddWithValue("@idUser", unIncid.IdUser);

            cmd.ExecuteNonQuery();

            conn.Close();
        }
Exemple #3
0
        private void btnDeclarer_Click(object sender, EventArgs e)
        {
            incident unIncid = new incident(TBprobleme.Text, Convert.ToInt32(numUrgence.Value), Convert.ToString(DateTime.Now), Convert.ToInt32(numEtat.Value), "Reçu", Convert.ToInt32(TBposte.Text), 0, id);

            BD.ajouteIncid(unIncid);
        }