Exemplo n.º 1
0
        protected void AuthenticateUser()
        {
            try
            {
                User users = new User();

                string userName = txtUserName.Text;
                string password = txtPassword.Text;
                Guid userID = new Guid();

                if (users.IsUserAuthenticated(userName, password, out userID))
                {

                    if (userID != new Guid())
                    {
                        users.UserId = userID;
                        Session[Constant.SESSION_LOGGEDUSER] = users.Select();
                        Response.Redirect(Diary.Common.Constant.URL_DEFAULTBACKPAGE, false);
                        //Todo
                    }
                }
                else
                {
                    //trMsg.Visible = true;
                    FailureText.Text = Diary.Common.Messages.Invalid_Credentials;
                    FailureText.Visible = true;
                }
            }
            catch (System.Exception)
            {

            }
        }
Exemplo n.º 2
0
        protected void DisplayData()
        {
            try
            {

                Guid currentUserId = new Guid(this.hdnUserId.Value);
                User users = new User();
                users.UserId = currentUserId;
                users = users.Select();
                txtUserName.Text = users.UserName;
                txtFirstName.Text = users.FirstName;
                txtLastName.Text = users.LastName;
                txtEmail.Text = users.EmailAddress;
                txtPassword.Text = users.Password;
                txtContact.Text = users.Contact;
                ddlRoles.SelectedItem = ddlRoles.Items.FindByValue(users.RoleId);
                ddlGrade.SelectedItem = ddlGrade.Items.FindByValue(users.GradeId);
                ddlJob.SelectedItem = ddlJob.Items.FindByValue(users.JobId);
                ddlLocation.SelectedItem = ddlLocation.Items.FindByValue(users.LocationId);
                currentPassword = users.Password;

            }
            catch (System.Exception)
            {

            }
        }