Esempio n. 1
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            lblError.Content = "";

            if (string.IsNullOrEmpty(txtEmailAddress.Text))
            {
                lblError.Content = "Invalid Login";
                return;
            }
            ;

            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                lblError.Content = "Invalid Login";
                return;
            }
            ;


            var op = Userbll.Login(txtEmailAddress.Text, txtPassword.Text);

            if (op.Code == "200")
            {
                var users = Userbll.GetById(op.ReferenceId);
                var roles = Userbll.GetRoles(op.ReferenceId);

                ProgramUser.Id           = op.ReferenceId;
                ProgramUser.FirstName    = users.FirstName;
                ProgramUser.LastName     = users.LastName;
                ProgramUser.EmailAddress = users.Email;
                ProgramUser.Roles        = roles;

                Users.List userList = new Users.List();
                userList.Show();
                this.Close();
            }
            else
            {
                lblError.Content = "Invalid Login";
            }
        }