public ActionResult Create(string Id = null) { var resultMsg = string.Empty; var model = new ModelUser(); if (!string.IsNullOrWhiteSpace(Id)) { LogicUser logic = new LogicUser(); model = logic.UserDetail(out resultMsg, int.Parse(Id)); ViewBag.Orgs = GetOrgs(model.Organization.ToString()); } else { ViewBag.Orgs = GetOrgs(); } return View(model); }
public ActionResult Login(ModelUser user) { var resultMsg = string.Empty; var logic = new LogicUser(); var model = logic.UserDetail(out resultMsg, user.Account); if (model != null && user.Account.ToLower().Equals("admin") && model.Account.ToLower().Equals(user.Account.ToLower()) && model.Password.Equals(user.Password)) { Session["admin"] = model.Account; ViewBag.CustomScript = UtilityScript.ShowMessage("登录成功!", isCreate: true, isSuccess: true, funName: "Goto"); } else { Session["admin"] = null; ViewBag.CustomScript = UtilityScript.ShowMessage("登录失败!", isCreate: true, isSuccess: false); } return View(user); }
public ActionResult Delete(string Id) { int idx = 0; int.TryParse(Id, out idx); var result = new ResultBase(); var resultMsg = string.Empty; var logic = new LogicUser(); var res = logic.UserDelete(out resultMsg, idx); if (res > 0) { result.result = 1; result.resultMsg = "删除成功!"; } else { result.result = -1; result.resultMsg = string.IsNullOrWhiteSpace(resultMsg) ? "删除失败!" : resultMsg; } return Json(result); }
public ActionResult Create(ModelUser model) { var resultMsg = string.Empty; var result = new ResultBase(); ViewBag.Orgs = GetOrgs(model.Organization.ToString()); var logic = new LogicUser(); model.Status = 1; var res = logic.UserInsertUpdate(out resultMsg, model); if (res > 0 || resultMsg.Contains(BaseDict.SuccessPrefix)) { resultMsg = "操作成功!"; ViewBag.CustomScript = UtilityScript.ShowMessage(resultMsg, isCreate: true, isSuccess: true, funName: "Goto"); } else { resultMsg = string.IsNullOrWhiteSpace(resultMsg) ? "操作失败,请检查数据是否正确后重新操作!" : resultMsg.Replace(BaseDict.ErrorPrefix,""); ViewBag.CustomScript = UtilityScript.ShowMessage(resultMsg, isCreate: true, isSuccess: true, funName: "BtnShow"); } return View(model); }
public ActionResult Index(string KeyWord, string Organization, string PagerIndex, string PagerSize) { var pageIndex = 1; var pageSize = 0; int.TryParse(PagerIndex, out pageIndex); int.TryParse(PagerSize, out pageSize); var resultMsg = string.Empty; var recordCount = decimal.Zero; var logic = new LogicUser(); var criteria = new CriteriaUser.Pager(); var model = new ModelPagerAccount(); ViewBag.Orgs = GetOrgs(Organization); criteria.KeyWord = model.KeyWord; var list = logic.QueryUserListPager(out resultMsg, out recordCount, criteria, pageSize: pageSize, pageIndex: pageIndex); model.PagerRowCount = recordCount; model.PagerCount = pageSize == 0 ? 0 : Math.Ceiling(recordCount / pageSize); model.PagerIndex = pageIndex; model.AccList = list; return View(model); }