public ActionResult DayDataAnalyse(string selectMonth) { if (String.IsNullOrEmpty(selectMonth)) { XphpTool.ShowMsg("请输入要查询的年月份!"); return(View()); } if (selectMonth.Equals("1")) { XphpTool.ShowMsg(analyseDataServise.msg); return(View()); } return(Redirect("/DataCenter/DataAnalysePrint/" + selectMonth.Replace("-", ""))); }
public ActionResult Login(string loginName, string loginPwd, string checkbox) { //如果将Cookies设置Expires为DataTime.Now,则该Cookie过期,自动会被删除,此时为null if (loginPwd == "******" && Request.Cookies["pwd"] != null) { loginPwd = Request.Cookies["pwd"].Value; } adminService = new AdminService(); if (!adminService.Login(loginName, loginPwd)) { XphpTool.ShowMsg(adminService.msg); } else { //登录成功跳转到管理员首页 admin = adminService.GetModel(loginName); if (admin != null) { Session["CurrentUser"] = admin; //登录成功后设置Cookies SetCookies(loginName, loginPwd, checkbox); //如果是打开页面时,Session过期,则登录后返回原页面 string url = (string)Session["url"]; if (!string.IsNullOrEmpty(url)) { Session["url"] = null; return(Redirect(url)); } return(RedirectToAction("TakeOrder", "TakeOrder")); } } ViewData["LoginName"] = Request.Cookies["LoginName"] == null ? null : Request.Cookies["LoginName"].Value; return(View()); }
/// <summary> /// 点击修改个人信息按钮后转到的页面 /// </summary> /// <returns>修改页面后重新刷新页面</returns> public ActionResult Save() { string loginName = Request.Form["LoginName"].Trim(); //获得用户名 string address = Request.Form["Address"].Trim(); //获得地址 string phoneNum = Request.Form["PhoneNum"].Trim(); //获得固定电话号码 string mobilNum = Request.Form["MobilePhone"].Trim(); //获得手机号码 string fax = Request.Form["Fax"].Trim(); //获得传真 string email = Request.Form["E-mail"].Trim(); //获得邮箱 string oldPwd = Request.Form["OldPwd"].Trim(); //获得旧密码 string newPwd = Request.Form["NewPwd"].Trim(); //获得新密码 string surePwd = Request.Form["SureNewPwd"].Trim(); //获得新密码的确认密码 string previousLoginName = this.currentUser.LoginName; Admins admins = adminService.GetAdminsMessageByAID(this.currentUser.AID); if (adminService.WhetherExistLoginName(loginName, this.currentUser.AID)) { return(Content("<script>alert('所更改的用户名已存在,请重新输入');window.location.href='/ManagerCenter/PersonMsg';</script>", "text/html")); //XphpTool.ShowMsg("所更改的用户名已存在,请重新输入"); //return View(); } if (address.Length < 0 || phoneNum.Length < 0 || mobilNum.Length < 0 || fax.Length < 0 || email.Length < 0 || oldPwd.Length < 0) { //return Content("<script>alert('所有字段都不能为空');window.location.href='/ManagerCenter/PersonMsg';</script>", "text/html"); XphpTool.ShowMsg("所有字段都不能为空"); return(View()); } if (loginName.Length < 2 || loginName.Length > 15) { return(Content("<script>alert('用户名必须在2-15位之间');window.location.href='/ManagerCenter/PersonMsg';</script>", "text/html")); //XphpTool.ShowMsg("用户名必须在2-15位之间"); //return View(); } if (email.IndexOf("@") <= 0 || email.IndexOf(".") <= 0 || email.LastIndexOf("@") > email.LastIndexOf(".")) { return(Content("<script>alert('必须包含@和.,且.需要在@后面');window.location.href='/ManagerCenter/PersonMsg';</script>", "text/html")); //XphpTool.ShowMsg("必须包含@和.,且.需要在@后面"); //return View(); } if (oldPwd != admins.Pwd) { return(Content("<script>alert('旧密码错误,请重新输入');window.location.href='/ManagerCenter/PersonMsg';</script>", "text/html")); //XphpTool.ShowMsg("旧密码错误,请重新输入"); //return View(); } if (newPwd == "" || newPwd == null || newPwd.Length > 12 || newPwd.Length < 6) { return(Content("<script>alert('新密码不能为空,且必须在6-12位之间');window.location.href='/ManagerCenter/PersonMsg';</script>", "text/html")); //XphpTool.ShowMsg("新密码不能为空,且必须在6-12位之间"); //return View(); } if (newPwd != surePwd) { return(Content("<script>alert('两次密码必须相等');window.location.href='/ManagerCenter/PersonMsg';</script>", "text/html")); //XphpTool.ShowMsg("两次密码必须相等"); //return View(); } if (adminService.GetUpdateAdminMsg(loginName, newPwd, address, phoneNum, mobilNum, fax, email, previousLoginName)) { return(Content("<script>alert('修改个人信息成功');window.location.href='/ManagerCenter/PersonMsg';</script>", "text/html")); //XphpTool.ShowMsg("修改个人信息成功"); } return(RedirectToAction("PersonMsg")); }