public ActionResult ProfileUser(cms_Account _Account) { AddPageHeader("Profile", ""); AddBreadcrumb("Hệ thống", ""); AddBreadcrumb("Profile", "/Account/ProfileUser"); if (ModelState.IsValid) { var UserInfo = ((cms_Account)Session["UserInfo"]); ImpCms_Account impCms_Account = new ImpCms_Account(); _Account.LastLogin = DateTime.Now; _Account.Password = string.Empty; bool validate = true; try { if (!string.IsNullOrEmpty(_Account.NgaysinhText.Trim())) { _Account.Ngaysinh = DateTime.ParseExact(_Account.NgaysinhText.Trim(), "dd/MM/yyyy", new CultureInfo("en-US")); } if (_Account.Ngaysinh > DateTime.Now) { validate = false; ViewBag.TitleSuccsess = "Ngày sinh lớn hơn ngày ngày hiện tại."; ViewBag.TypeAlert = CMSLIS.Common.Constant.typeError; } if (_Account.Ngaysinh.Year < 1920) { validate = false; ViewBag.TitleSuccsess = "Năm sinh nhỏ hơn năm 1920"; ViewBag.TypeAlert = CMSLIS.Common.Constant.typeError; } } catch { validate = false; } #region Check input data try { if (validate) { _Account.Hoten = _Account.Hoten.Trim(); _Account.UpdateBy = UserInfo.uid; _Account.Update_date = DateTime.Now; _Account.IsFirstLogin = false; _Account.LastLogin = DateTime.Now; string result = impCms_Account.UpdateProfile(_Account); if (!string.IsNullOrEmpty(result)) { ViewBag.TitleSuccsess = "Cập nhật thông tin thành công"; ViewBag.TypeAlert = CMSLIS.Common.Constant.typeSuccsess; AddLogAction(result, Constant.ActionUpdateOK.ToString()); } else { ViewBag.TitleSuccsess = "Cập nhật thông tin không thành công"; ViewBag.TypeAlert = CMSLIS.Common.Constant.typeError; AddLogAction(result, Constant.ActionUpdateNOK.ToString()); } } } catch (Exception ex) { ViewBag.TitleSuccsess = "Có lỗi xẩy ra trong quá trình thực hiện, Mời bạn thực hiện lại!"; ViewBag.TypeAlert = CMSLIS.Common.Constant.typeError; logIn.Info("ProfileUser: "******"ProfileUser: " + ex.ToString()); } #endregion } return(View(_Account)); }
public AccountController() { impAccount_Login = new ImpAccount_Login(); impCms_Account = new ImpCms_Account(); }