12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 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
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- 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();
- }
- }
- }
- }
- }
|