Exemplo n.º 1
0
 private void buttonConectare_Click(object sender, EventArgs e)
 {
     try
     {
         var context = new HREntities1();
         var result  = (from c in context.Logins
                        where c.Username == username
                        select c.Username).FirstOrDefault();
         if (result == null)
         {
             MessageBox.Show("Username incorect");
             this.Close();
         }
         else
         {
             var result1 = (from c in context.Logins
                            where c.Username == username
                            select c.Parola).FirstOrDefault();
             if (password != Encoding.Unicode.GetString(Convert.FromBase64String(result1)))
             {
                 MessageBox.Show("Parola incorecta");
                 this.Close();
             }
             else
             {
                 if (username == "hr")
                 {
                     FormMenu f2 = new FormMenu();
                     this.Hide();
                     f2.ShowDialog();
                     this.Close();
                 }
                 if (username == "admin")
                 {
                     FormMenuAdmin f3 = new FormMenuAdmin();
                     this.Hide();
                     f3.ShowDialog();
                     this.Close();
                 }
                 if (username == "guest")
                 {
                     FormInformatii formInfo = new FormInformatii();
                     formInfo.ShowDialog();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
        private void buttonVeziInfo_Click(object sender, EventArgs e)
        {
            FormInformatii formInfoAngajati = new FormInformatii();

            formInfoAngajati.ShowDialog();
        }