示例#1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            /* frmRapports m = new frmRapports();
            this.Hide();
            m.ShowDialog();
            this.Show();*/
            int noEmploye = -1;
            if (int.TryParse(txtUsername.Text, out noEmploye))
            {
                string motDePasse = txtPassword.Text;
                var dataClasses = new DataClasses1DataContext();

                var employe = from unEmploye in dataClasses.Employes
                                          where unEmploye.No == noEmploye && unEmploye.MotDePasse == motDePasse
                                          select unEmploye;
                if(employe.Count() == 1)
                {
                    Hide();
                    var menuPrincipal = new frmMenu(employe.First());
                    menuPrincipal.ShowDialog();
                    txtPassword.Text = "";
                    txtUsername.Text = "";
                    Show();
                }
                else
                {
                    MessageBox.Show(Resources.UtilisateurOuMotDePasseNonValide, Resources.TitreErreur);
                }
            }
            else
            {
                MessageBox.Show(Resources.NoEmployeInvalide, Resources.TitreErreur);
            }
        }
 public frmModifierEmploye(int noEmploye, DataClasses1DataContext dataContexteProjet1)
 {
     InitializeComponent();
     // TODO: Complete member initialization
     this.noEmploye = noEmploye;
     this.dataContexteProjet1 = dataContexteProjet1;
 }