Example #1
0
        private void connect_bttn_Click(object sender, RoutedEventArgs e)
        {
            OleDbConnection conn = new OleDbConnection(ConfigurationManager.ConnectionStrings["IstorieAccesDB"].ConnectionString.ToString());

            try
            {
                conn.Open();
                OleDbCommand comanda = new OleDbCommand("select count(*) from Utilizatori where Nume_user=@nume and Pass_user=@parola ", conn);
                comanda.Parameters.AddWithValue("@nume", numeUtilizator.Text);
                comanda.Parameters.AddWithValue("@parola", parolaUtilizator.Text);
                int exista = int.Parse(comanda.ExecuteScalar().ToString());
                if (exista > 0)
                {
                    MeniuPrincipal form = new MeniuPrincipal();
                    this.Hide();
                    form.ShowDialog();
                    this.Show();
                }
                else
                {
                    MessageBox.Show("Parola sau nume gresit");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                conn.Close();
            }
        }
Example #2
0
 private void connect_bttn_Click(object sender, RoutedEventArgs e)
 {
     using (IstorieEntities context = new IstorieEntities())
     {
         var query = (from c in context.Users
                      where c.name == numeUtilizator.Text && c.pass == parolaUtilizator.Text
                      select c).Count();
         if (query > 0)
         {
             MeniuPrincipal form = new MeniuPrincipal();
             this.Hide();
             form.ShowDialog();
             this.Close();
         }
         else
         {
             MessageBox.Show("Nume de utilizator sau parola gresita.");
         }
     }
 }
Example #3
0
 private void connect_bttn_Click(object sender, RoutedEventArgs e)
 {
     using (IstorieEntities context = new IstorieEntities())
     {
         var user = (from c in context.Users
                     where c.name == numeUtilizator.Text && c.pass == parolaUtilizator.Password
                     select c).FirstOrDefault();
         if (user != null)
         {
             UserActual.user = (User)user;
             MeniuPrincipal form = new MeniuPrincipal();
             this.Hide();
             form.ShowDialog();
             this.Close();
         }
         else
         {
             MessageBox.Show("Nume de utilizator sau parola gresita.");
         }
     }
 }
Example #4
0
        private void TimerLogin_Tick(object sender, EventArgs e)
        {
            timerLogin.Stop();
            Hide();

            using (SoundPlayer audio = new SoundPlayer(bitQuiz.Properties.Resources.booop))
            {
                audio.Play();

                if (rol == 1)
                {
                    MeniuPrincipal mp = new MeniuPrincipal();
                    mp.ShowDialog();
                }
                else
                {
                    Admin admin = new Admin();
                    admin.ShowDialog();
                }
                Close();
            }
        }