protected void passwordUpdateButton_Click(object sender, EventArgs e) { UserBLL user = new UserBLL(); try { if (string.IsNullOrEmpty(currentPasswordTextBox.Text.Trim())) { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Current Password field is required."; } else if (string.IsNullOrEmpty(newPasswordTextBox.Text.Trim())) { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "New Password field is required."; } else if (string.IsNullOrEmpty(confirmNewPasswordTextBox.Text.Trim())) { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Confirm New Password field is required."; } else if (newPasswordTextBox.Text.Trim() != confirmNewPasswordTextBox.Text.Trim()) { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "New Password & Confirm New Password do not match."; } else { user.UserId = LumexSessionManager.Get("ActiveUserId").ToString(); user.Password = currentPasswordTextBox.Text.Trim(); if (user.ValidateUser()) { user.Password = newPasswordTextBox.Text.Trim(); user.UpdateUserPassword(user.UserId, user.Password); string message = "Password <span class='actionTopic'>Updated</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/Logout.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { string message = "<span class='actionTopic'>Invalid</span> Current Password. You can't change your password."; MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");"); } } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { user = null; } }
protected void unlockButton_Click(object sender, EventArgs e) { UserBLL user = new UserBLL(); try { // user.UserId = userIdLockTextBox.Text.Trim(); // user.Password = passwordLockTextBox.Text.Trim(); if (user.ValidateUser() && user.UserId == LumexSessionManager.Get("ActiveUserId").ToString()) { DataTable dt = user.GetUserById(user.UserId); if (dt.Rows[0]["IsActive"].ToString() == "True" && dt.Rows[0]["IsUserGroupActive"].ToString() == "True") { // screenLock.Visible = false; // main.Visible = true; if (Session["ScreenLockURL"] != null) { LumexSessionManager.Remove("ScreenLockURL"); } if (Session["ScreenLock"] != null) { LumexSessionManager.Remove("ScreenLock"); } } else { // screenStatusLabel.Text = "User Access Denied!!!"; } } else { // screenStatusLabel.Text = "Invalid User or Password"; } } catch (Exception) { LumexSessionManager.RemoveAll(); Response.Redirect("~/Login.aspx", false); } finally { user = null; } }
protected void btnlogin_Click(object sender, EventArgs e) { UserBLL user = new UserBLL(); try { user.UserId = txtbxUserName.Text.Trim(); user.Password = txtbxPass.Text.Trim(); if (user.ValidateUser()) { DataTable dt = user.GetUserById(user.UserId); if (dt.Rows[0]["IsActive"].ToString() == "True" && dt.Rows[0]["IsUserGroupActive"].ToString() == "True") { LumexSessionManager.Add("ActiveUserId", dt.Rows[0]["UserId"].ToString()); LumexSessionManager.Add("ActiveUserName", dt.Rows[0]["UserName"].ToString()); LumexSessionManager.Add("isMenu", "N"); LumexSessionManager.Add("ActiveMenuFor", "inv"); LumexSessionManager.Add("ScreenLock", "False"); LumexSessionManager.Add("ScreenLock", "False"); LumexSessionManager.Add("UserSalesCenterId", dt.Rows[0]["SalesCenterId"].ToString()); LumexSessionManager.Add("UserWareHouseId", dt.Rows[0]["WarehouseId"].ToString()); LumexSessionManager.Add("UserGroupId", dt.Rows[0]["UserGroupId"].ToString()); Response.Redirect("~/Default.aspx"); } else { lblnotify.Text = "User Access Denied!!!"; } } else { lblnotify.Text = "Invalid User or Password"; } //if (txtbxUserName.Text != "" && txtbxPass.Text != "") //{ // UserLogin user = new UserLogin(); // user.UserId = txtbxUserName.Text.Trim(); // user.Password = txtbxPass.Text.Trim(); // if (user.ValidateUser(user)) // { // LumexSessionManager.Add("ActiveUserId", user.UserId); // LumexSessionManager.Add("ActiveUserName", user.UserName); // LumexSessionManager.Add("ScreenLock", "False"); // LumexSessionManager.Add("UserDasignation", user.Designation); // Response.Redirect("~/Default.aspx"); // //statusLabel.Text = "Invalid User or Password"; // } // else // { // lblnotify.Text = "Invalid User or Password"; // } // } //else //{ // lblnotify.Text = "Enter UserID or Password"; //} } catch (Exception ex) { lblnotify.Text = ex.Message; } finally { // user = null; } }