Ejemplo n.º 1
0
        internal int ChangePassword(tbl_UserPassword _userPassword)
        {
            tbl_UserPassword obj = _context.tbl_UserPassword.First(x => x.UserID == _userPassword.UserID);

            obj.Password = _userPassword.Password;
            _context.SaveChanges();
            return(1);
        }
Ejemplo n.º 2
0
        internal int getCurrentStatusBy(Guid userId, string passwordId)
        {
            int status           = 0;
            tbl_UserPassword obj = _context.tbl_UserPassword.First(x => x.UserID == userId);

            if (obj.Password != passwordId)
            {
                status = 1;
            }
            return(status);
        }
Ejemplo n.º 3
0
 internal int SaveUsrPassword(tbl_UserPassword userPassword)
 {
     try
     {
         _context.tbl_UserPassword.AddObject(userPassword);
         _context.SaveChanges();
         return(1);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 4
0
        protected void BtnChange_Clik(object sender, EventArgs e)
        {
            try
            {
                UserBLL _userBll = new UserBLL();

                //int status = _userBll.getCurrentStatusBy(((SessionUser)Session["SessionUser"]).UserId, txtCurrentPass.Text);
                if (txtCurrentPass.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Password Not Found')", true);
                    return;
                }
                else
                {
                    //string UserID = ((SessionUser)Session["SessionUser"]).UserId.ToString();
                    //string NewPassword = txtNewPass.Text.ToString();
                    string ConfPassword = txtConfirmPass.Text.ToString();
                    //if (NewPassword != ConfPassword)
                    //{
                    //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('These passwords don't match. Try again?')", true);
                    //}

                    tbl_UserPassword _userPassword = new tbl_UserPassword();
                    _userPassword.UserID   = Guid.Parse(drpUserName.SelectedValue);
                    _userPassword.Password = ConfPassword;
                    int result = _userBll.ChangePassword(_userPassword);
                    if (result == 1)
                    {
                        drpUserName.ClearSelection();
                        txtCurrentPass.Text = "";
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Password Change Successfully.')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 5
0
        protected void BtnChange_Clik(object sender, EventArgs e)
        {
            try
            {
                UserBLL _userBll = new UserBLL();

                int status = _userBll.getCurrentStatusBy(((SessionUser)Session["SessionUser"]).UserId, txtCurrentPass.Text);
                if (status == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('your Current Password is not Match.')", true);
                }
                else
                {
                    string UserID       = ((SessionUser)Session["SessionUser"]).UserId.ToString();
                    string NewPassword  = txtNewPass.Text.ToString();
                    string ConfPassword = txtConfirmPass.Text.ToString();
                    if (NewPassword != ConfPassword)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('These passwords don't match. Try again?')", true);
                    }
                    else
                    {
                        tbl_UserPassword _userPassword = new tbl_UserPassword();
                        _userPassword.UserID   = ((SessionUser)Session["SessionUser"]).UserId;
                        _userPassword.Password = ConfPassword;
                        int result = _userBll.ChangePassword(_userPassword);
                        if (result == 1)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Password Change Successfully.')", true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                tbl_User         userObj      = new tbl_User();
                tbl_UserPassword userPassword = new tbl_UserPassword();


                //    ;
                //if (drpdownStatus.SelectedValue == "Y")
                //{
                //    userObj.IsActive = true;
                //}
                //else
                //{
                //    userObj.IsActive = false;
                //}
                if (Label1.Text != "User Name Already Exist!")
                {
                    userObj.Use_Email = txtbxEmail.Text;
                    if (BtnSave.Text == "Submit")
                    {
                        if (txtbxPassword.Text == txtbxConformePassword.Text)
                        {
                            //string Md5 = txtbxPassword.Text;
                            // string Md5Password = Md5EncriptPassword(Md5);

                            userPassword.Password = txtbxPassword.Text;
                            userPassword.EditDate = DateTime.Now;
                            userPassword.EditUser = ((SessionUser)Session["SessionUser"]).UserId;
                            Guid guid = Guid.NewGuid();
                            userObj.UserID       = guid;
                            userPassword.UserID  = guid;
                            userObj.EID          = txtbxEID.Text;
                            userObj.LoginName    = txtbxUserName.Text;
                            userObj.UserFullName = txtbxUsrFullName.Text;
                            userObj.OCode        = "8989";
                            userObj.EditDate     = DateTime.Now;
                            userObj.EditUser     = ((SessionUser)Session["SessionUser"]).UserId;
                            userObj.IsActive     = Convert.ToBoolean(drpdownStatus.SelectedValue);

                            int result = usrBll.SaveUser(userObj);
                            if (result == 1)
                            {
                                int res = usrBll.SaveUsrPassword(userPassword);
                                if (res == 1)
                                {
                                    //lblMessage.Text = "User Save Successfully.";
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('User Save Successfully.')", true);
                                }
                            }
                        }
                        else
                        {
                            //lblStatus.Text = "Password Not Match";
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Password Not Match')", true);
                        }
                    }
                    else
                    {
                        userObj.EID          = txtbxEID.Text;
                        userObj.LoginName    = txtbxUserName.Text;
                        userObj.UserFullName = txtbxUsrFullName.Text;
                        userObj.OCode        = "8989";
                        userObj.EditDate     = DateTime.Now;
                        userObj.EditUser     = ((SessionUser)Session["SessionUser"]).UserId;
                        userObj.IsActive     = Convert.ToBoolean(drpdownStatus.SelectedValue);
                        string usereId = hidEID.Value;
                        int    result  = usrBll.Updateuser(userObj, usereId);
                        if (result == 1)
                        {
                            //lblMessage.Text = "Data Updated Successfully";
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text",
                                                                "func('User Updated Successfully')", true);
                        }
                    }


                    getadduser();
                    ClearUI();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('User Name Already Exist!')", true);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 7
0
 internal int ChangePassword(tbl_UserPassword _userPassword)
 {
     return(userDalObj.ChangePassword(_userPassword));
 }
Ejemplo n.º 8
0
 internal int SaveUsrPassword(tbl_UserPassword userPassword)
 {
     return(userDalObj.SaveUsrPassword(userPassword));
 }