Пример #1
0
        private void back_click(object sender, RoutedEventArgs e)
        {
            MacApplicationsList main = new MacApplicationsList();

            main.Show();
            this.Close();
        }
        private void Click_Submit(object sender, RoutedEventArgs e)
        {
            try
            {
                bool    match     = false;
                UsersBL p         = new UsersBL();
                string  login_txt = LoginId_txt.Text;
                string  pass_txt  = txt_Password.Password;
                match = p.MacLogin(login_txt, pass_txt);
                if (match)
                {
                    //MessageBox.Show("Login Succesfull");
                    MacApplicationsList mac = new MacApplicationsList();
                    mac.Show();
                    this.Close();
                }
                else
                {
                    throw new UniversityException("Wrong Credentials");
                }
            }
            catch (UniversityException ex)
            {
                MessageBox.Show(ex.Message);
            }



            //try
            //{
            //    List<Users> list = new List<Users>();
            //    UsersBL p = new UsersBL();
            //    list = p.GetAll();
            //    foreach(Users user in list )
            //    {

            //        if(user.Role=="mac")
            //        {
            //            if (LoginId_txt.Text == user.LoginId && txt_Password.Password == user.Password)
            //            {
            //                match = true;
            //            }
            //            //else MessageBox.Show("Wrong Credentials");
            //        }


            //    }

            //    if (match == true)
            //    {
            //        MessageBox.Show("Login Succesfull");
            //        MacApplicationsList mac = new MacApplicationsList();
            //        mac.Show();
            //        this.Close();
            //    }
            //    else throw new UniversityException("Wrong Credentials");
            //}
            //catch (UniversityException ex)
            //{

            //    MessageBox.Show(ex.Message);
            //}
        }