private void Button_Click(object sender, RoutedEventArgs e) { using (KullaniciPanelEntities db = new KullaniciPanelEntities(ConnecionTools.GetConnectionString())) { tbl_UserAccount user = null; try { try { user = db.tbl_UserAccount.Where(p => p.USERNICK == txtKullaniciAdi.Text && p.USERPASSWORD == txtPassword.Password).FirstOrDefault(); } catch (Exception) { MessageBox.Show("Database bilgilerinizi kontrol edin."); } } catch { } if (user == null) { lblHata.Content = "Kullanıcı adı veya şifre hatalı."; } else { App.currentUser = user; if (App.currentUser.USERSTATUS.Value) { MainWindow mainWindow = new MainWindow(); mainWindow.lblkullaniciadi.Content = user.USERAD; mainWindow.Show(); this.Close(); } else { KullaniciMainWindow mainWindow = new KullaniciMainWindow(); mainWindow.lblkullaniciadi.Content = user.USERAD; mainWindow.lblIDAl.Content = user.ID; mainWindow.Show(); this.Close(); } } } }