コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: ibogdan25/Istorie
 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.");
         }
     }
 }
コード例 #2
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.");
         }
     }
 }