public ActionResult UpdateInfo(string userProfileName, string screenName, string email, string tel, DateTime?dob, string address) { try { var user = _userBusiness.GetById(long.Parse(SessionUtility.GetSessionUserId(Session))); user.Screenname = screenName; user.UserProfile.Name = userProfileName; user.UserProfile.Phone = tel; user.UserProfile.Dob = dob; user.UserProfile.Address = address; user.UserProfile.Modifieddate = DateTime.Now; _userBusiness.Edit(user); ViewData["ErrMessage"] = "Cập nhật thông tin thành công."; ViewData["code"] = user.UserProfile.Code; ViewData["userProfileName"] = user.UserProfile.Name; ViewData["screenName"] = user.Screenname; ViewData["email"] = user.UserProfile.Email; ViewData["tel"] = user.UserProfile.Phone; ViewData["dob"] = user.UserProfile.Dob; ViewData["address"] = user.UserProfile.Address; } catch (FaultException ex) { var exep = Function.GetExeption(ex); var codeExp = exep[1]; string url = "Error/ErrorFunction/" + codeExp; return(RedirectToActionPermanent(url)); } return(View()); }
public JsonResult LoginShop(long shopid) { var adminid = long.Parse(SessionUtility.GetSessionUserId(Session)); var user = new UserBusiness().GetById(adminid); var url = System.Web.Hosting.HostingEnvironment.MapPath("~/LogFolder/infoAdmin.txt"); var listReadFile = Common.util.Function.ReadFile(url); try { ViewBag.Mes = ""; var entity = new MembersBusiness().GetById(shopid); var shop = _shopsBusiness.GetById(shopid); if (entity != null) { if (entity.Status == 0) { //ViewBag.Mes = "Tài khoản chưa được kích hoạt "; return(Json(0, JsonRequestBehavior.AllowGet)); } else if (entity.Status == 3) { //ViewBag.Mes = "Tài khoản đã bi khóa"; return(Json(3, JsonRequestBehavior.AllowGet)); } else { //listReadFile.Add("start"+DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")); SessionUtility.SetSessionMember(entity, Session); //listReadFile.Add("end"+DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")); #region write log listReadFile.Add("*****************************************************************************************"); listReadFile.Add(string.Format( "Tài khoản {0}, tên đây đủ là {1}, đã đăng nhập vào shop {2}, vào lúc {3}", user.Username, user.UserProfile.Name, shop.ShopName, DateTime.Now)); Common.util.Function.WriteFile(url, listReadFile.ToArray()); #endregion write log return(Json(1, JsonRequestBehavior.AllowGet)); } } else { // ViewBag.mes = "Lỗi thông tin đăng nhập"; return(Json(2, JsonRequestBehavior.AllowGet)); } } catch (Exception) { return(Json(4, JsonRequestBehavior.AllowGet)); } }
public ActionResult UpdateInfo() { var user = _userBusiness.GetById(long.Parse(SessionUtility.GetSessionUserId(Session))); ViewData["code"] = user.UserProfile.Code; ViewData["userProfileName"] = user.UserProfile.Name; ViewData["screenName"] = user.Screenname; ViewData["email"] = user.UserProfile.Email; ViewData["tel"] = user.UserProfile.Phone; ViewData["dob"] = user.UserProfile.Dob; ViewData["address"] = user.UserProfile.Address; return(View()); }
public ActionResult ChangePassword(string pasOld, string password, string password_repeat) { try { if (password.Equals(password_repeat)) { bool isSuccess = _userBusiness.CheckPassword(SessionUtility.GetSessionUserName(Session), pasOld); if (isSuccess) { isSuccess = _userBusiness.ChangePassword(long.Parse(SessionUtility.GetSessionUserId(Session)), password); if (isSuccess) { ViewData["ErrMessage"] = "Thay đổi mật khẩu thành công."; } else { ViewData["ErrMessage"] = "Không thay đổi được mật khẩu, mời bạn thử lại."; } } else { ViewData["ErrMessage"] = "Mật khẩu cũ không chính xác."; ViewData["passwordOld"] = pasOld; ViewData["password"] = password; ViewData["password_repeat"] = password_repeat; } } else { ViewData["ErrMessage"] = "Nhắc lại mật khẩu không chính xác."; ViewData["passwordOld"] = pasOld; ViewData["password"] = password; ViewData["password_repeat"] = password_repeat; } return(View()); } catch (FaultException ex) { var exep = Function.GetExeption(ex); var codeExp = exep[1]; string url = "Error/ErrorFunction/" + codeExp; return(RedirectToActionPermanent(url)); } }