public ActionResult Login(string email = "", string password = "") { if (Request.HttpMethod == "GET") { return(View()); } else { var userAccount = UserAccountBLL.Authorize(email, password, UserAccountTypes.Employee); if (userAccount != null) { WebUserData cookieData = new WebUserData() { UserID = userAccount.UserID, FullName = userAccount.FullName, GroupName = userAccount.GroupName, SessionID = Session.SessionID, ClientIP = Request.UserHostAddress, Photo = userAccount.Photo, Email = userAccount.Email }; FormsAuthentication.SetAuthCookie(cookieData.ToCookieString(), false); return(RedirectToAction("Index", "Dashboard")); } else { ModelState.AddModelError("error", "Đăng nhập thất bại"); ViewBag.email = email; return(View()); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { uoHiddenFieldUser.Value = GlobalCode.Field2String(Session["UserName"]); PortVendorLogAuditTrail(); uoHiddenFieldRole.Value = GlobalCode.Field2String(Session["UserRole"]);; if (uoHiddenFieldRole.Value == "") { uoHiddenFieldRole.Value = UserAccountBLL.GetUserPrimaryRole(uoHiddenFieldUser.Value); } Session["UserRole"] = uoHiddenFieldRole.Value; Session["UserName"] = uoHiddenFieldUser.Value; if (Request.QueryString["vmId"] != null) { Session["vendorPrimaryId"] = Request.QueryString["vmId"]; uoHiddenFieldPortID.Value = Request.QueryString["vmId"]; } PortCountryLoad(); //ChangeToUpperCase(uoDropDownListCountry); //PortCityLoad(Convert.ToInt32(uoDropDownListCountry.SelectedValue)); //ChangeToUpperCase(uoDropDownListCity); LoadPort(); LoadAirport(true); LoadAirportDDL(true); } }
/// <summary> /// Author: Charlene Remotigue /// Date Created: 06/03/2012 /// ---------------------------------- /// Modified By: Josephine Gad /// Modified Date: 31/08/2012 /// Description: Force logout if there is new session id for this user /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { InitializeValues(); if (!IsPostBack) { if (Request.QueryString["ufn"] != null) { string sUserSessionID = UserAccountBLL.GetUserSessionID(GlobalCode.Field2String(Session["UserName"])); if (sUserSessionID != "" && sUserSessionID != Session.SessionID) { var rCookie = Request.Cookies["asp.net_sessionid"]; if (rCookie != null) { HttpCookie respCookie = new HttpCookie("asp.net_sessionid", sUserSessionID); respCookie.Expires = DateTime.Now.AddMinutes(-1); Session["ForceLogout"] = "1"; Response.Redirect("/Login.aspx", false); } } else { Session["ForceLogout"] = "0"; } ucLabelFName.Text = Request.QueryString["ufn"]; string sUserRole = GlobalCode.Field2String(Session["UserRole"]);; } } }
/// <summary> /// Author: Josephine Gad /// Date Created: 04/Mar/2013 /// Description: Email Notification when the system is under maintenance /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //protected void uoButtonEmail_Click(object sender, EventArgs e) //{ // List<ActiveUserEmail> list = new List<ActiveUserEmail>(); // list = EmailBLL.GetActiveUserEmail(); // List<ActiveUserEmail> listEmailed = new List<ActiveUserEmail>(); // ActiveUserEmail item; // if (list.Count > 0) // { // for (int i = 0; i < list.Count; i++) // { // if (SendEmail_UnderMaintenance(list[i].sEmail)) // { // item = new ActiveUserEmail(); // item.sEmail = list[i].sEmail; // listEmailed.Add(item); // } // } // if (listEmailed.Count > 0) // { // ListView1.DataSource = null; // ListView1.DataBind(); // uoUserList.DataSource = listEmailed; // uoUserList.DataBind(); // } // } //} /// <summary> /// Author: Josephine Gad /// Date Created: 04/Mar/2013 /// Description: Email Notification when the system resumes /// </summary> //protected void uoButtonResume_Click(object sender, EventArgs e) //{ // List<ActiveUserEmail> list = new List<ActiveUserEmail>(); // list = EmailBLL.GetActiveUserEmail(); // List<ActiveUserEmail> listEmailed = new List<ActiveUserEmail>(); // ActiveUserEmail item; // if (list.Count > 0) // { // for (int i = 0; i < list.Count; i++) // { // if (SendEmail_Resume(list[i].sEmail)) // { // item = new ActiveUserEmail(); // item.sEmail = list[i].sEmail; // listEmailed.Add(item); // } // } // if (listEmailed.Count > 0) // { // ListView1.DataSource = null; // ListView1.DataBind(); // uoUserList.DataSource = listEmailed; // uoUserList.DataBind(); // } // } //} #endregion #region METHODS /// <summary> /// Author: Charlene Remotigue /// Date Created: 11/04/2012 /// Description: Initialize Session Values (user, role) /// </summary> protected void InitializeValues() { string UserRolePrimary = GlobalCode.Field2String(Session["UserRole"]); string Name = GlobalCode.Field2String(Session["UserName"]); if (GlobalCode.Field2String(Session["UserName"]) == "") { Session["UserName"] = User.Identity.Name; Name = GlobalCode.Field2String(Session["UserName"]); } MembershipUser UserName = Membership.GetUser(Name); if (UserName == null) { Response.Redirect("~/Login.aspx", false); } else { if (!UserName.IsOnline) { Response.Redirect("~/Login.aspx", false); } } if (GlobalCode.Field2String(Session["UserRole"]) == "") { UserRolePrimary = UserAccountBLL.GetUserPrimaryRole(Name); Session["UserRole"] = UserRolePrimary; } uoHiddenFieldUser.Value = Name; uoHiddenFieldRole.Value = UserRolePrimary; Session["strPrevPage"] = Request.RawUrl; }
private void getmyAccountSummary(string UserId) { try { UserAccountBLL userAccount = new UserAccountBLL(); DataTable dt = userAccount.getAccountSummaryById(UserId); if (dt.Rows.Count > 0) { lvlIncomeWallet.Text = (('$') + dt.Rows[0]["Income"].ToString()); lvlDepositWallet.Text = (('$') + dt.Rows[0]["Deposit"].ToString()); lvlCommisionWallet.Text = (('$') + dt.Rows[0]["Commission"].ToString()); lvlFxFund.Text = (('$') + dt.Rows[0]["FxFund"].ToString()); } else { lvlIncomeWallet.Text = "0"; lvlDepositWallet.Text = "0"; lvlCommisionWallet.Text = "0"; lvlFxFund.Text = "0"; } } catch (Exception) { // throw; } }
public ActionResult ResetPassword(ResetPasswordModel model) { if (model.NewPassword.Length < 8) { ModelState.AddModelError("", "mật khẩu phái có ít nhất 8 ký tự!"); } else { if (model.NewPassword != model.ConfirmPassword) { ModelState.AddModelError("", "mật khẩu nhập lại không đúng!"); } else { var message = ""; UserAccount user = UserAccountBLL.UserAccount_GetUserByResetPasswordCode(model.ResetCode); if (user != null) { UserAccountBLL.UserAccount_ChangePassword(user.UserID, model.NewPassword); UserAccountBLL.UserAccount_AddResetCode(user.UserID, ""); return(RedirectToAction("Index")); } else { message = "fail"; } ViewBag.message = message; } } return(View(model)); }
/// ------------------------------------------- /// Date Modified: 15/03/2012 /// Modified By: Josephine Gad /// (description) Replace Global Variable with Session /// ------------------------------------------- protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null) { Response.Redirect("~/Login.aspx"); } if (!IsPostBack) { uoHiddenFieldUser.Value = GlobalCode.Field2String(Session["UserName"]); uoHiddenFieldUserRole.Value = UserAccountBLL.GetUserPrimaryRole(uoHiddenFieldUser.Value); Session["strPrevPage"] = Request.RawUrl; Session["HotelPath"] = Path.GetFileName(Request.Path); BindRegion(); BindCountry(); BindAirport(); BindHotel(); } //GlobalCode.Field2String(Session["strPrevPage"]) = Request.RawUrl; if (uoHiddenFieldPopupAdd.Value == "1") { uoDropDownListRegion.SelectedValue = uoHiddenFieldRegion.Value; BindCountry(); uoDropDownListCountry.SelectedValue = uoHiddenFieldCountry.Value; uoTextBoxSearchAirport.Text = uoHiddenFieldAirportName.Value; BindAirport(); BindHotel(); uoHotelVendorList.DataBind(); } uoHiddenFieldPopupAdd.Value = "0"; }
///=================================================== /// <summary> /// Modified Created: 03/11/2015 /// Created By: Muhallidin Wali /// (description) Get alternate email list of users ///=================================================== protected void Submit_Click(object sender, EventArgs e) { string alternate = ""; alternate = UserAccountBLL.GetUserInfoAlterEmail(PasswordRecovery1.UserName); MembershipUser mUser = Membership.GetUser(PasswordRecovery1.UserName); if (mUser == null) { Panel2.Visible = true; } else { mUser.UnlockUser(); mUser.LastActivityDate = DateTime.Now.AddMinutes(-Membership.UserIsOnlineTimeWindow); Membership.UpdateUser(mUser); Panel2.Visible = false; string Password = mUser.ResetPassword(); string sEmail = mUser.Email.ToString(); MUser.ChangePasswordInLDAP(mUser.UserName, Password); if (alternate != "") { sEmail = alternate; } SendEmail(sEmail, Password); //Server.Transfer("Login.aspx"); } }
/// <summary> /// Date Created: 20/10/2011 /// Created By: Josephine Gad /// (description) Get user branch details if user is vendor or Service Provider /// </summary> private void GetBranchInfo() { if (uoHiddenFieldRole.Value == TravelMartVariable.RolePortSpecialist || uoHiddenFieldRole.Value == TravelMartVariable.RoleHotelVendor || uoHiddenFieldRole.Value == TravelMartVariable.RoleVehicleVendor) { IDataReader dr = null; try { dr = UserAccountBLL.GetUserBranchDetails(GlobalCode.Field2String(Session["UserName"]), uoHiddenFieldRole.Value); if (dr.Read()) { uoLabelBranchName.Text = dr["BranchName"].ToString().ToUpper(); uoHiddenFieldRoleBranchID.Value = dr["BranchID"].ToString().ToUpper(); Session["UserRoleKey"] = dr["RoleID"].ToString(); Session["UserBranchID"] = dr["BranchID"].ToString(); Session["UserCountry"] = dr["CountryID"].ToString(); Session["UserCity"] = dr["CityID"].ToString(); Session["UserVendor"] = dr["VendorID"].ToString(); } } catch (Exception ex) { throw ex; } finally { if (dr != null) { dr.Close(); dr.Dispose(); } } } }
/// Date Modified: 15/03/2012 /// Modified By: Josephine Gad /// (description) Replace Global Variable with Session /// ------------------------------------------- protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null) { Response.Redirect("~/Login.aspx"); } if (!IsPostBack) { Label SFStatus = (Label)Master.FindControl("uclabelStatus"); SFStatus.Visible = false; string userName = GlobalCode.Field2String(Session["UserName"]); if (Session["UserRole"] == null) { string UserRolePrimary = UserAccountBLL.GetUserPrimaryRole(userName); Session["UserRole"] = UserRolePrimary; } uoHiddenFieldUser.Value = userName; uoHiddenFieldRole.Value = GlobalCode.Field2String(Session["UserRole"]);; GetRoles(); GetUsers("0"); GetRegion(); } if (uoHiddenFieldAdd.Value == "1") { GetRegion(); } uoHiddenFieldAdd.Value = "0"; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["UserRole"] == null) { string UserRolePrimary = UserAccountBLL.GetUserPrimaryRole(GlobalCode.Field2String(Session["UserName"])); Session["UserRole"] = UserRolePrimary; } SetDefaultValues(); GetVessel(); GetNationality(); GetGender(); GetRank(); //Session["strSFStatus"] = Request.QueryString["st"]; //GlobalCode.Field2String(Session["strSFFlightDateRange"]) = Request.QueryString["dt"]; //GetVehicleManifest(GlobalCode.Field2String(Session["strSFStatus"]), GlobalCode.Field2String(Session["strSFFlightDateRange"])); GetVehicleManifest(); Session["strPrevPage"] = Request.RawUrl; if (Session["UserRole"] == TravelMartVariable.RoleHotelVendor || Session["UserRole"] == TravelMartVariable.RoleVehicleVendor) { uoTRVessel.Visible = false; } else { uoTRVessel.Visible = true; } } }
/// Date Modified: 16/03/2012 /// Modified By: Josephine Gad /// (description) Replace Global Variable with Session /// ------------------------------------------- protected void Page_Load(object sender, EventArgs e) { if (GlobalCode.Field2String(Session["UserName"]) == "") { Response.Redirect("~/Login.aspx"); } if (!IsPostBack) { if (Session["UserRole"] == null) { string UserRolePrimary = UserAccountBLL.GetUserPrimaryRole(GlobalCode.Field2String(Session["UserName"])); Session["UserRole"] = UserRolePrimary; } uoHiddenFieldRole.Value = GlobalCode.Field2String(Session["UserRole"]);; uoHiddenFieldUser.Value = GlobalCode.Field2String(Session["UserName"]); SetDefaultValues(); GetVessel(); GetNationality(); GetGender(); GetRank(); Session["strPrevPage"] = Request.RawUrl; } }
/// <summary> /// Date Created: 20/10/2011 /// Created By: Josephine Gad /// (description) Get user branch details if user is vendor or Service Provider /// ------------------------------------------------- /// Date Modified: 27/11/2011 /// Modified By: Josephine Gad /// (description) Change DataTable to IDataReader /// </summary> private void GetBranchInfo() { IDataReader dr = null; try { dr = UserAccountBLL.GetUserBranchDetails(uoHiddenFieldUser.Value, uoHiddenFieldRole.Value); if (dr.Read()) { Session["UserVendor"] = dr["VendorID"].ToString(); Session["UserBranchID"] = dr["BranchID"].ToString(); Session["UserCountry"] = dr["CountryID"].ToString(); Session["UserCity"] = dr["CityID"].ToString(); } } catch (Exception ex) { throw ex; } finally { if (dr != null) { dr.Close(); dr.Dispose(); } } }
public ActionResult ChangePassword(string id = "", string oldPassword = "", string newPassword = "", string reType = "") { if (newPassword == reType && newPassword == oldPassword) { SetAlert("New password must not duplicate Old password", "warning"); } else if (newPassword == reType) { if (UserAccountBLL.UpdatePassword(id, EncodeMD5.EncodeMD5B(oldPassword), EncodeMD5.EncodeMD5B(newPassword))) { SetAlert("Change password success !", "success"); } else { SetAlert("Old password do not match !", "danger"); } } else { SetAlert("Retype password do not match", "warning"); } return(View()); }
/// <summary> /// Profile /// </summary> /// <returns></returns> public ActionResult Index() { WebUserData userData = User.GetUserData(); Employee data = UserAccountBLL.GetProfile(userData.UserID); return(View(data)); }
protected void GenerateButton_Click(object sender, EventArgs e) { try { UserAccountBLL userAccount = new UserAccountBLL(); userAccount.TransferAmount = Convert.ToDecimal(txtbxAmount.Text.Trim()); bool status = userAccount.ReceivePaymentMoney(txtbxAmount.Text.Trim()); if (status) { string message = "Payment <span class='actionTopic'>Received</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/a/account/moneygerate.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { // MyAlertBox("MyOverlayStop();"); } }
public ActionResult ForgotPass(UserAccount data) { if (string.IsNullOrEmpty(data.UserID)) { ModelState.AddModelError("EmptyEmail", "Chưa nhập email để khôi phục mật khẩu"); } if (IsEmailExist(data.UserID) == true) { ModelState.AddModelError("IsNotExistEmailInDb", "Tài khoản này không có trong hệ thống. Hãy kiểm tra xem " + "bạn đã nhập đúng địa chỉ email khôi phục mật khẩu chưa?"); } if (!ModelState.IsValid) { return(View()); } string message = ""; UserAccount account = UserAccountBLL.UserAccount_GetUser(data.UserID); if (account.UserID != null) { string resetCode = Guid.NewGuid().ToString(); SendVerificationLinkEmail(account.UserID, resetCode, "ResetPassword"); account.ResetPasswordCode = resetCode; UserAccountBLL.UserAccount_AddResetCode(data.UserID, resetCode); message = "Đã gửi đường dẫn đến email của bạn. vui lòng check mail để lấy lại mật khẩu!"; } else { message = "account not found"; } ViewBag.Message = message; return(View()); }
/// <summary> /// Date Created: 16/11/2011 /// Created By: Josephine Gad /// (description) Send email /// </summary> /// <param name="sSubject"></param> /// <param name="sMessage"></param> /// <param name="attachment"></param> private void ManifestSendEmail(string sSubject, string sMessage, string attachment) { string sBody; DataTable dt = null; try { dt = UserAccountBLL.GetUserEmail(TravelMartVariable.RoleAdministrator, Session["UserBranchID"].ToString(), GlobalCode.Field2String(Session["Country"])); foreach (DataRow r in dt.Rows) { sBody = "<TABLE style=\"font-family: Tahoma, Arial; font-size: 14px; width:100%\"><TR><TD>"; sBody += "Dear " + TravelMartVariable.RoleAdministrator + ", <br/><br/> " + sMessage; sBody += "</TR></TD></TABLE>"; CommonFunctions.SendEmailWithAttachment("", r["Email"].ToString(), "", sSubject, sBody, attachment); } } catch (Exception ex) { throw ex; } finally { if (dt != null) { dt.Dispose(); } } }
protected string InitializeValues() { string sUserName = GlobalCode.Field2String(Session["UserName"]); if (GlobalCode.Field2String(Session["UserName"]) == "") { sUserName = MUser.GetUserName(); Session["UserName"] = sUserName; } MembershipUser muser = Membership.GetUser(GlobalCode.Field2String(Session["UserName"])); if (muser == null) { Response.Redirect("~/Login.aspx", false); } else { if (muser.IsOnline == false) { Response.Redirect("~/Login.aspx", false); } } Session["strPrevPage"] = Request.RawUrl; if (GlobalCode.Field2String(Session["UserRole"])=="") { Session["UserRole"] = UserAccountBLL.GetUserPrimaryRole(sUserName); } uoHiddenFieldUserRole.Value = GlobalCode.Field2String(Session["UserRole"]);//MUser.GetUserRole(); uoHiddenFieldUser.Value = sUserName;//MUser.GetUserName(); return uoHiddenFieldUserRole.Value; }
protected void InitializeValues() { string userName = ""; if (GlobalCode.Field2String(Session["UserName"]) == "") { Session["UserName"] = User.Identity.Name; } MembershipUser UserName = Membership.GetUser(GlobalCode.Field2String(Session["UserName"])); if (UserName == null) { Response.Redirect("~/Login.aspx"); } else { if (!UserName.IsOnline) { Response.Redirect("~/Login.aspx"); } } userName = GlobalCode.Field2String(Session["UserName"]); if (Session["UserRole"] == null) { string UserRolePrimary = UserAccountBLL.GetUserPrimaryRole(userName); Session["UserRole"] = UserRolePrimary; } uoHiddenFieldUser.Value = userName; uoHiddenFieldRole.Value = GlobalCode.Field2String(Session["UserRole"]);; }
/// <summary> /// Date Created: 18/08/2011 /// Created By: Marco Abejar /// (description) Get user role /// --------------------------------------------------- /// Date Modified: 27/11/2011 /// Modified By: Josephine Gad /// (description) Change DataTable to SqlDataReader /// </summary> /// private void GetRole(string rid) { SqlDataReader dr = null; try { dr = UserAccountBLL.GetRole(rid); if (dr.Read()) { uotextboxRoleName.Text = dr["role"].ToString(); uotextboxRoleDesc.Text = dr["roledesc"].ToString(); } } catch (Exception ex) { AlertMessage(ex.Message); } finally { if (dr != null) { dr.Close(); dr.Dispose(); } } }
/// <summary> /// Date Created: 19/08/2011 /// Created By: Marco Abejar /// (description) Get role list /// ----------------------------- /// Date Modified: 22/11/2011 /// Modified By: Josephine Gad /// (description) Change GetUserRoles to GetUserRolesAccess /// </summary> private void GetRoles() { //DataTable dtRole = UserAccountBLL.GetUserRoles(); DataTable dtRole = UserAccountBLL.GetUserRolesAccess(uoHiddenFieldRole.Value); try { uoDropDownListRoles.Items.Clear(); uoDropDownListRoles.DataSource = dtRole; uoDropDownListRoles.DataBind(); uoDropDownListRoles.Items.Insert(0, new ListItem("--Select Role--", "")); //CommonFunctions.ChangeToUpperCase(uoDropDownListRoles); } catch (Exception ex) { throw ex; } finally { if (dtRole != null) { dtRole.Dispose(); } } }
private void LoadPaymentMethodList() { try { UserAccountBLL account = new UserAccountBLL(); string Type = ""; if (ddlType.SelectedValue == "0") { Type = "0"; } else if (ddlType.SelectedValue == "2") { Type = "1"; } else if (ddlType.SelectedValue == "3") { Type = "2"; } DataTable dt = account.GetPaymentInfoNyIdandType((string)LumexSessionManager.Get("ActiveUserId"), Type); if (ddlType.SelectedValue == "0") { ddlPaymentMethod.Items.Clear(); ddlPaymentMethod.DataSource = dt; ddlPaymentMethod.DataTextField = "BankName"; ddlPaymentMethod.DataValueField = "Account"; ddlPaymentMethod.DataBind(); ddlPaymentMethod.Items.Insert(0, "Select Here.."); ddlPaymentMethod.SelectedIndex = 0; ddlPaymentMethod.Items[0].Value = ""; } else if (ddlType.SelectedValue == "2") { ddlPaymentMethod.Items.Clear(); ddlPaymentMethod.DataSource = dt; ddlPaymentMethod.DataTextField = "CardNo"; ddlPaymentMethod.DataValueField = "CardWoner"; ddlPaymentMethod.DataBind(); ddlPaymentMethod.Items.Insert(0, "Select Here.."); ddlPaymentMethod.SelectedIndex = 0; ddlPaymentMethod.Items[0].Value = ""; } else if (ddlType.SelectedValue == "3") { ddlPaymentMethod.Items.Clear(); ddlPaymentMethod.DataSource = dt; ddlPaymentMethod.DataTextField = "GatewayOwner"; ddlPaymentMethod.DataValueField = "GatewayEmail"; ddlPaymentMethod.DataBind(); ddlPaymentMethod.Items.Insert(0, "Select Here.."); ddlPaymentMethod.SelectedIndex = 0; ddlPaymentMethod.Items[0].Value = ""; } } catch (Exception) { // throw; } }
private void GetUsers(string role) { /// <summary> /// Date Created: 19/08/2011 /// Created By: Marco Abejar /// (description) Get user list /// </summary> DataTable dtUsers = UserAccountBLL.GetUsers(role, "", uoHiddenFieldUser.Value, uoHiddenFieldRole.Value, ""); try { uoDropDownListUsers.Items.Clear(); uoDropDownListUsers.DataSource = dtUsers; uoDropDownListUsers.DataBind(); uoDropDownListUsers.Items.Insert(0, new ListItem("--Select User--", "0")); //CommonFunctions.ChangeToUpperCase(uoDropDownListUsers); } catch (Exception ex) { throw ex; } finally { if (dtUsers != null) { dtUsers.Dispose(); } } }
/// <summary> /// Author: Charlene Remotigue /// Date Created: 07/05/2012 /// Description: initialize session values /// </summary> protected void InitializeValues() { if (GlobalCode.Field2String(Session["UserName"]) == "") { Session["UserName"] = User.Identity.Name; } MembershipUser sUser = Membership.GetUser(GlobalCode.Field2String(Session["UserName"])); if (sUser == null) { Response.Redirect("~/Login.aspx"); } else { if (!sUser.IsOnline) { Response.Redirect("~/Login.aspx"); } } if (GlobalCode.Field2String(Session["UserRole"]) == "") { string UserRolePrimary = UserAccountBLL.GetUserPrimaryRole(GlobalCode.Field2String(Session["UserName"])); Session["UserRole"] = UserRolePrimary; } Session["strPrevPage"] = Request.RawUrl; }
public ActionResult ChangePassword(string email = "", string oldPassword = "", string newPassword = "", string confirmPassword = "") { if (string.IsNullOrEmpty(oldPassword)) { ModelState.AddModelError("oldpassword", "Old Password expected!"); } if (string.IsNullOrEmpty(newPassword)) { ModelState.AddModelError("newpassword", "New Password expected!"); } if (string.IsNullOrEmpty(confirmPassword)) { ModelState.AddModelError("confirmpassword", "Confirm Password expected!"); } if (UserAccountBLL.Authorize(email, Helper.EncodeMD5(oldPassword) , UserAccountTypes.Employee) == null) { ModelState.AddModelError("authorize", "Old Password does not match!"); } if (oldPassword == newPassword) { ModelState.AddModelError("different", "Old Password must be different New Password!"); } if (newPassword != confirmPassword) { ModelState.AddModelError("match", "New Password can't be different Confirm Password!"); } if (!ModelState.IsValid) { return(View()); } newPassword = Helper.EncodeMD5(newPassword); UserAccountBLL.ChangePassword(email, newPassword, UserAccountTypes.Employee); return(RedirectToAction("Index", "Dashboard")); }
private void getmyAccountSummary(string UserId) { try { UserAccountBLL userAccount = new UserAccountBLL(); DataTable dt = new DataTable(); dt = userAccount.getMoneyGenerateAmountById(UserId); if (dt.Rows.Count > 0) { lvlMoneyGenerate.Text = (('$') + dt.Rows[0][0].ToString()); } dt = userAccount.getCommissionById(UserId); if (dt.Rows.Count > 0) { lvlCommission.Text = (('$') + dt.Rows[0][0].ToString()); } dt = userAccount.getDailyBonusById(UserId); if (dt.Rows.Count > 0) { lvlDailyBonus.Text = (('$') + dt.Rows[0][0].ToString()); } } catch (Exception) { // throw; } }
/// <summary> /// Author: Josephine Gad /// Date Created: 02/Jan/2013 /// Description: Load Page for Locked Manifest /// ------------------------------------ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { InitializeValues(); if (!IsPostBack) { uoHiddenFieldUser.Value = GlobalCode.Field2String(Session["UserName"]); if (Session["UserRole"] == null) { string UserRolePrimary = UserAccountBLL.GetUserPrimaryRole(uoHiddenFieldUser.Value); Session["UserRole"] = UserRolePrimary; } uoHiddenFieldUserRole.Value = GlobalCode.Field2String(Session["UserRole"]); BindRegionList(); BindPortList(); GetHotelFilter(); LoadTravelDetails(); BindManifestType(); uoHiddenFieldLoadType.Value = "1"; } else { HiddenField uoHiddenFieldPopupCalendar = (HiddenField)Master.FindControl("uoHiddenFieldPopupCalendar"); if (uoHiddenFieldPopupCalendar.Value == "1" || Request.QueryString["chDate"] != null) { //BindRegionList(); //BindPortList(); //GetHotelFilter(); //BindManifestType(); uoHiddenFieldFromDefaultView.Value = "1"; GetSFHotelTravelDetails(); } } }
public ActionResult SignIn(string email = "", string password = "") { password = MD5.EncodeMD5(password); UserAccount user = UserAccountBLL.Authorize(email, password, UserAccountTypes.Employee); if (user != null) //Đăng nhập thành công { //Ghi nhận phiên đăng nhập WebUserData userData = new WebUserData() { UserID = user.UserID, FullName = user.FullName, GroupName = user.Roles, LoginTime = DateTime.Now, SessionID = Session.SessionID, ClientIP = Request.UserHostAddress, Photo = user.Photo, Title = user.Title }; FormsAuthentication.SetAuthCookie(userData.ToCookieString(), false); return(RedirectToAction("Index", "Dashboard")); } else // Đăng nhập không thành công { ModelState.AddModelError("loginerror", "login fail"); ViewBag.email = email; return(View()); } }
public ActionResult ResetPassword(string email = "", string code = "", string newpassword = "", string retypePassword = "") { ViewBag.Email = email; ViewBag.code = code; if (UserAccountBLL.GetCode(email, UserAccountTypes.Employee) != code) { ViewBag.Eror = "Eror"; return(View()); } if (newpassword != "") { if (newpassword != retypePassword) { ModelState.AddModelError("", "Password incorrect"); return(View()); } else { Account account = new Account(); account.Email = email; account.Password = newpassword; UserAccountBLL.Account_Update(account, UserAccountTypes.Employee); UserAccountBLL.SetCode(email, Guid.NewGuid().ToString(), UserAccountTypes.Employee); return(RedirectToAction("Login", "Account")); } } return(View()); }