示例#1
0
 void loadAdmin()
 {
     Admin             = AdminORM.listeAdmin();
     myDataObjectAdmin = new AdminViewModel();
     //LIEN AVEC la VIEW
     AdminCombobox.ItemsSource = Admin; // bind de la liste avec la source, permettant le binding.#2#*/
 }
 private void PersonellerForm_Load(object sender, EventArgs e)
 {
     Text = "Personeller";
     #region YetkiControl
     YetkiORM yOrm = new YetkiORM();
     SuperORM sOrm = new SuperORM();
     AdminORM aOrm = new AdminORM();
     if (PersonellerORM.AktifKullanici.YetkiID == 3)
     {
         cmbYetki.DataSource    = yOrm.Select();
         cmbYetki.DisplayMember = "YetkiAdi";
         cmbYetki.ValueMember   = "Id";
     }
     else if (PersonellerORM.AktifKullanici.YetkiID == 1)
     {
         cmbYetki.DataSource    = sOrm.Select();
         cmbYetki.DisplayMember = "YetkiAdi";
         cmbYetki.ValueMember   = "Id";
     }
     else
     {
         cmbYetki.DataSource    = aOrm.Select();
         cmbYetki.DisplayMember = "YetkiAdi";
         cmbYetki.ValueMember   = "Id";
     }
     #endregion
     dataGridView1.DataSource          = perOrm.Select();
     dataGridView1.Columns[0].Visible  = false;
     dataGridView1.Columns[8].Visible  = false;
     dataGridView1.Columns[9].Visible  = false;
     dataGridView1.Columns[10].Visible = false;
     dataGridView1.Columns[12].Visible = false;
     btnGuncelle.Visible = false;
     btnIptal.Visible    = false;
 }
        private void AdminButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                myDataObjectAdmin.idAdminProperty = AdminDAL.getMaxIdAdmin() + 1;

                Admin.Add(myDataObjectAdmin);
                AdminORM.insertAdmin(myDataObjectAdmin);
                compteur = Admin.Count();


                myDataObjectAdmin = new AdminViewModel();


                nomTextBox.DataContext       = myDataObjectAdmin;
                prenomTextBox.DataContext    = myDataObjectAdmin;
                mailTextBox.DataContext      = myDataObjectAdmin;
                numeroTelTextBox.DataContext = myDataObjectAdmin;
                dateVenteTextBox.DataContext = myDataObjectAdmin;
                ageTextBox.DataContext       = myDataObjectAdmin;
                comboxBoxLieu.DataContext    = myDataObjectAdmin;
                AdminButton.DataContext      = myDataObjectAdmin;
            }
            catch (Exception ex)
            {
                MessageBox.Show("A handled exception just occurred: " + ex.Message, "Exception Sample", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
 void loadAdmins()
 {
     lp = AdminORM.listeAdmin();
     myDataObjectAdmin = new AdminViewModel();
     //LIEN AVEC la VIEW
     listeAdmin.ItemsSource = lp; // bind de la liste avec la source, permettant le binding.
 }
 void loadAdmin()
 {
     nomAdmin          = AdminORM.listeAdmin();
     myDataObjectAdmin = new AdminViewModel();
     //LIEN AVEC la VIEW
     idAdmincomboBox.ItemsSource = nomAdmin; // bind de la liste avec la source, permettant le binding.*/
 }
 private void SupprButton(object sender, RoutedEventArgs routedEventArgs)
 {
     if (listeAdmin.SelectedItem is AdminViewModel)
     {
         AdminViewModel toRemove = (AdminViewModel)listeAdmin.SelectedItem;
         lp.Remove(toRemove);
         listeAdmin.Items.Refresh();
         AdminORM.supprimerAdmin(selectedAdminId);
     }
 }
        private void OnPropertyChanged(string info)
        {
            PropertyChangedEventHandler handler = PropertyChanged;

            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(info));
                this.PropertyChanged(this, new PropertyChangedEventArgs(info));
                AdminORM.updateAdmin(this);
            }
        }
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            string email = txtUsername.Text;
            string mdp   = txtPassword.Password;

            //email.Replace("@", ".");

            if (AdminORM.getAuth(email, mdp) >= 1)
            {
                //todo: condition d'authentification
                adminBaseWindow admin = new adminBaseWindow();
                this.Close();
                admin.Show();
            }
            else
            {
                MessageBox.Show("Email et/ou mot de passe incorrect", email);
            }
        }
 void loadAdmin()
 {
     Admin             = AdminORM.listeAdmin();
     myDataObjectAdmin = new AdminViewModel();
 }