public static DepartementViewModel getDepartement(int idDep)
        {
            DAODepartement       m           = DAODepartement.getDepatrement(idDep);
            DepartementViewModel departement = new DepartementViewModel(m.idDepartement, m.nomDAODepartement);

            return(departement);
        }
示例#2
0
        public static void insertDepartement(DAODepartement d)
        {
            string           query       = "INSERT INTO departement (`nom`) VALUES (\"" + d.nomDAODepartement + ");";
            MySqlCommand     cmd2        = new MySqlCommand(query, connection);
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2);

            cmd2.ExecuteNonQuery();
        }
示例#3
0
        public static void updateDepartement(DAODepartement d)
        {
            string           query       = "UPDATE departement set nom=\"" + d.nomDAODepartement + "\" where idDepartement=" + d.idDepartement + ";";
            MySqlCommand     cmd         = new MySqlCommand(query, connection);
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd);

            cmd.ExecuteNonQuery();
        }
示例#4
0
        private void OnPropertyChanged(string info)
        {
            PropertyChangedEventHandler handler = PropertyChanged;

            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(info));
                DAODepartement.updateDepartement(this);
            }
        }
        public static ObservableCollection <DepartementViewModel> listeDepartement()
        {
            ObservableCollection <DAODepartement>       lDAO = DAODepartement.listeDepartements();
            ObservableCollection <DepartementViewModel> l    = new ObservableCollection <DepartementViewModel>();

            foreach (var element in lDAO)
            {
                DepartementViewModel p = new DepartementViewModel(element.idDepartement, element.nomDAODepartement);
                l.Add(p);
            }

            return(l);
        }
示例#6
0
        public static DAODepartement getDepartement(int idDepartement)
        {
            string       query = "SELECT * FROM departement WHERE idDepartement=" + idDepartement + ";";
            MySqlCommand cmd   = new MySqlCommand(query, connection);

            cmd.ExecuteNonQuery();
            MySqlDataReader reader = cmd.ExecuteReader();

            reader.Read();
            DAODepartement dep = new DAODepartement(reader.GetInt32(0), reader.GetString(1));

            reader.Close();
            return(dep);
        }
示例#7
0
        public static ObservableCollection <DAODepartement> selectDepartement()
        {
            ObservableCollection <DAODepartement> l = new ObservableCollection <DAODepartement>();
            string       query = "SELECT * FROM departement;";
            MySqlCommand cmd   = new MySqlCommand(query, connection);

            cmd.ExecuteNonQuery();

            MySqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                DAODepartement d = new DAODepartement(reader.GetInt32(0), reader.GetString(1));
                l.Add(d);
            }
            reader.Close();
            return(l);
        }
        public static DAODepartement getDepatrement(int idDepartement)
        {
            DAODepartement p = DALDepartement.getDepartement(idDepartement);

            return(p);
        }
 public static void updateDepartement(DepartementViewModel d)
 {
     DAODepartement.updateDepartement(d);
 }