using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace Cafe11 { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { gr671_mkyuEntities entities; public MainWindow() { InitializeComponent(); entities = new gr671_mkyuEntities(); } private void btnlog_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(txtlog.Text) || string.IsNullOrWhiteSpace(txtpass.Password)) { MessageBox.Show("Поля не заполнены"); return; } if (entities.Users.Select(x => x.Login + "" + x.Password).Contains(txtlog.Text + "" + txtpass.Password)) { var role = entities.Users.Where(x => x.Login == txtlog.Text).Select(x => x.IdRole).FirstOrDefault(); if (role == 1) { povar pov = new povar(); pov.Show(); this.Close(); } if (role == 2) { ofic of = new ofic(); of.Show(); this.Close(); } if (role == 3) { admin ad = new admin(); ad.Show(); this.Close(); } } } } }