Example #1
0
        private void LogIn_click(object sender, RoutedEventArgs e)
        {
            string       UserLogin = txtLogin.Text;
            string       UserPass  = txtPassword.Password;
            TortEntities baza      = new TortEntities();

            baza.Polzovatel.Load();
            var login = baza.Polzovatel
                        .Where(u => u.Login == UserLogin && u.Password == UserPass)
                        .FirstOrDefault();

            if (login == null)
            {
                MessageBox.Show("Логин или пароль введены неверно!");
            }

            if (login != null)
            {
                if (login != null && login.Role == "Менеджер по продажам")
                {
                    ManagerPoRabote manager = new ManagerPoRabote();
                    manager.Show();
                    Close();
                }

                if (login != null && login.Role == "Директор")
                {
                    Direсtor dir = new Direсtor();
                    dir.Show();
                    Close();
                }

                if (login != null && login.Role == "Мастер")
                {
                    Master mast = new Master();
                    mast.Show();
                    Close();
                }

                if (login != null && login.Role == "Заказчик")
                {
                    Zakazchik zakaz = new Zakazchik();
                    zakaz.Show();
                    Close();
                }

                if (login != null && login.Role == "Менеджер по закупкам")
                {
                    ManagerPoZakupke manzak = new ManagerPoZakupke();
                    manzak.Show();
                    Close();
                }
                if ((login != null) && login.Role == "")
                {
                    Zakazchik zakazchik = new Zakazchik();
                    zakazchik.Show();
                    Close();
                }
            }
        }
        }//Выход в главное меню

        private void BackClick(object sender, RoutedEventArgs e)
        {
            ManagerPoZakupke dir = new ManagerPoZakupke();

            dir.Show();
            Close();
        }//Выход в меню директора