public JsonResult Delete(string id) { if (!string.IsNullOrWhiteSpace(id)) { ValidationErrors errors = new ValidationErrors(); OpeCur.ServiceSession.SysModule.DeleteAndClear(ref errors, id); if (errors.Count() > 0) { return OpeCur.AjaxMsgNOOK(errors.Error); } if (OpeCur.ServiceSession.SaveChange() > 0) { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Ids:" + id, "成功", "删除", "模块设置"); return OpeCur.AjaxMsgOK(Resource.DeleteSucceed); //return Json(JsonHandler.CreateMessage(1, Resource.DeleteSucceed), JsonRequestBehavior.AllowGet); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id:" + id + "," + ErrorCol, "失败", "删除", "模块设置"); return OpeCur.AjaxMsgError(Resource.DeleteFail + ":" + ErrorCol); //return Json(JsonHandler.CreateMessage(0, Resource.DeleteFail + ErrorCol), JsonRequestBehavior.AllowGet); } } else { return OpeCur.AjaxMsgNOOK("Id为空!"); //return Json(JsonHandler.CreateMessage(0, Resource.DeleteFail), JsonRequestBehavior.AllowGet); } }
public JsonResult Edit(SysModuleModel model) { if (model != null && ModelState.IsValid) { ValidationErrors errors = new ValidationErrors(); OpeCur.ServiceSession.SysModule.Modify(ref errors, model); if (OpeCur.ServiceSession.SaveChange() > 0) { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id" + model.Id + ",Name" + model.Name, "成功", "修改", "系统菜单"); //return Json(JsonHandler.CreateMessage(1, Resource.EditSucceed)); return OpeCur.AjaxMsgOK(Resource.EditSucceed); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id" + model.Id + ",Name" + model.Name + "," + ErrorCol, "失败", "修改", "系统菜单"); //return Json(JsonHandler.CreateMessage(0, Resource.EditFail + ":" + ErrorCol)); return OpeCur.AjaxMsgError(Resource.EditFail + ":" + ErrorCol); } } else { return OpeCur.AjaxMsgNOOK(Resource.ModelStateValidFail); //return Json(JsonHandler.CreateMessage(0, Resource.EditFail)); } }
public JsonResult GetList(string id) { Apps.IService.Sys.ISysModuleService mService = OpeCur.ServiceSession.SysModule; if (id == null) id = "0"; List<SysModuleModel> list = mService.GetListByParentId(id); if (list.Count<=0) { return OpeCur.AjaxMsgNOOK("没有符合条件的数据!","",list); } //List<SysModuleModel> tempList = new List<SysModuleModel>(); //foreach (var item in list) //{ // if (item.OperationType == 3) // { // tempList.AddRange(mService.GetListByParentId(item.Id)); // } //} //list.AddRange(tempList); return OpeCur.AjaxMsgOK("获取成功!", "", list); }
public JsonResult Delete(string id) { if (!string.IsNullOrWhiteSpace(id)) { Apps.IService.IServiceSession serviceSession = OpeCur.ServiceSession; string userId = OpeCur.AccountNow.Id; string ErrorCol = errors.Error; if (id == "2017admin") { LogHandler.WriteServiceLog(userId, "尝试删除管理员", "失败", "删除", "用户设置"); return(OpeCur.AjaxMsgNOOK("管理员不能被删除" + ErrorCol)); } serviceSession.SysUser.RemoveById(ref errors, id); if (serviceSession.SaveChange() > 0) { LogHandler.WriteServiceLog(userId, "Id:" + id, "成功", "删除", "用户设置"); return(OpeCur.AjaxMsgOK(Resource.DeleteSucceed + ErrorCol)); } else { ErrorCol = errors.Error; LogHandler.WriteServiceLog(userId, "Id:" + id + "," + ErrorCol, "失败", "删除", "用户设置"); return(OpeCur.AjaxMsgNOOK(Resource.DeleteFail + ErrorCol)); } } else { return(OpeCur.AjaxMsgNOOK(Resource.DeleteFail)); } }
public JsonResult Create(SysUserModel model) { if (model != null && ModelState.IsValid) { Apps.IService.IServiceSession serviceSession = OpeCur.ServiceSession; string curUserId = OpeCur.AccountNow.Id; model.Id = ResultHelper.NewId; model.CreateTime = ResultHelper.NowTime; model.Password = ValueConvert.MD5(model.Password); model.CreatePerson = OpeCur.AccountNow.TrueName; model.State = true; serviceSession.SysUser.Create(ref errors, model); if (serviceSession.SaveChange() > 0) { LogHandler.WriteServiceLog(curUserId, "Id:" + model.Id + ",Name:" + model.UserName, "成功", "创建", "用户设置"); return(OpeCur.AjaxMsgOK("创建成功!")); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(curUserId, "Id:" + model.Id + ",Name:" + model.UserName + "," + ErrorCol, "失败", "创建", "用户设置"); return(OpeCur.AjaxMsgNOOK("创建失败!" + ErrorCol)); } } else { return(OpeCur.AjaxMsgNOOK(Resource.ModelStateValidFail)); } }
public JsonResult Edit(SysUserModel info) { if (info != null && ModelState.IsValid) { Apps.IService.IServiceSession serviceSession = OpeCur.ServiceSession; serviceSession.SysUser.Edit(ref errors, info); string ErrorCol = errors.Error; if (serviceSession.SaveChange() > 0) { OpeCur.SetOtherHMC(info.Id); OpeCur.AccountNow.AllMerchant = false; LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id:" + info.Id + ",Name:" + info.UserName, "成功", "修改", "用户设置"); return(OpeCur.AjaxMsgOK("修改成功!" + ErrorCol)); } else { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id:" + info.Id + ",Name:" + info.UserName + "," + ErrorCol, "失败", "修改", "用户设置"); return(OpeCur.AjaxMsgNOOK("修改失败!" + ErrorCol)); } } else { return(OpeCur.AjaxMsgNOOK(Resource.ModelStateValidFail)); } }
public JsonResult Remove(string id) { if (!string.IsNullOrWhiteSpace(id)) { var userId = OpeCur.AccountNow.Id; if (id == "administrator") { LogHandler.WriteServiceLog(userId, "尝试删除管理员组", "失败", "删除", "用户设置"); return(OpeCur.AjaxMsgNOOK("超级管理员组不能被删除")); } OpeCur.ServiceSession.SysRole.RemoveById(ref errors, id); if (OpeCur.ServiceSession.SaveChange() > 0) { LogHandler.WriteServiceLog(userId, "Id:" + id, "成功", "删除", "SysRole"); return(OpeCur.AjaxMsgOK(Resource.DeleteSucceed)); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(userId, "Id" + id + "," + ErrorCol, "失败", "删除", "SysRole"); return(OpeCur.AjaxMsgNOOK(Resource.DeleteFail)); } } else { return(OpeCur.AjaxMsgNOOK("Id为空")); } }
public JsonResult Create(SysModuleModel model) { model.Id = ResultHelper.NewId; model.CreateTime = ResultHelper.NowTime; model.CreatePerson = OpeCur.AccountNow.UserName; ValidationErrors errors = new ValidationErrors(); if (model != null && ModelState.IsValid) { OpeCur.ServiceSession.SysModule.Create(ref errors, model); if (OpeCur.ServiceSession.SaveChange() > 0) { LogHandler.WriteServiceLog(OpeCur.AccountNow.UserName, "Id" + model.Id + ",Name" + model.Name, "成功", "创建", "SysModule"); return OpeCur.AjaxMsgOK(Resource.InsertSucceed); } else { return OpeCur.AjaxMsgError(Resource.InsertFail); } } else { return OpeCur.AjaxMsgNOOK(Resource.ModelStateValidFail); } }
public JsonResult GetTreeByEasyui(string id) { //加入本地化 CultureInfo info = Thread.CurrentThread.CurrentCulture; string infoName = info.Name; if (OpeCur.AccountNow != null) { //加入本地化 AccountModel account = OpeCur.AccountNow; //OpeCur.UsrNowPers.Where(p=>p.ParentId == "0").ToList(); List <PermissionModel> list = OpeCur.UsrNowPers.Where(p => p.ParentId == id && (p.OperationType == 1 || p.OperationType == 2)).ToList(); var json = from r in list select new SysModuleNavModel() { id = r.Id, text = infoName.IndexOf("zh") > -1 || infoName == "" ? r.Name : r.EnglishName, //text attributes = (infoName.IndexOf("zh") > -1 || infoName == "" ? "zh-CN" : "en-US") + "/" + r.AreasName == null ? "" : (r.AreasName + "/") + r.ControllerName + "/" + r.ActionName, iconCls = r.Iconic, //state = (list.Where(p=>p.ParentId==r.Id).Count() > 0) ? "closed" : "open" //state = (OpeCur.ServiceSession.SysModule.GetList(m => m.ParentId == r.Id).Count > 0) ? "closed" : "open" state = r.State, }; //return Json(json); return(OpeCur.AjaxMsgOK("成功获取", "", json)); } else { return(OpeCur.AjaxMsgNoLogin("/Account/Index")); } }
public JsonResult GetTopMenu() { //加入本地化 CultureInfo info = Thread.CurrentThread.CurrentCulture; string infoName = info.Name; if (OpeCur.AccountNow != null) { //加入本地化 AccountModel account = OpeCur.AccountNow; List <PermissionModel> list = OpeCur.UsrNowPers.Where(p => p.ParentId == "0" && p.OperationType == 1).ToList(); var json = from r in list select new SysModuleNavModel() { id = r.Id, text = infoName.IndexOf("zh") > -1 || infoName == "" ? r.Name : r.EnglishName, //text attributes = (infoName.IndexOf("zh") > -1 || infoName == "" ? "zh-CN" : "en-US") + "/" + r.AreasName == null ? "" : (r.AreasName + "/") + r.ControllerName + "/" + r.ActionName, iconCls = r.Iconic }; //return Json(json); return(OpeCur.AjaxMsgOK("成功获取", "", json)); } else { return(OpeCur.AjaxMsgNoLogin("/Account")); } }
public ActionResult LoginAc(string userName, string pwd, string checkNub) { #region 1.判断验证是否正确 if (Session[Sessionvalues.LoginValideCode] != null && !checkNub.IsSame(Session[Sessionvalues.LoginValideCode].ToString())) { return(OpeCur.AjaxMsgNOOK("验证码输入错误")); } #endregion #region 2.判断用户名密码是否正确 pwd = EncryptorManager.EncryptString(pwd, EncryptorType.MD5); UserInfo userInfo = OpeCur.BllServices.UserInfoService.LoadEntities(c => c.UserName == userName && c.Pwd == pwd).SingleOrDefault(); if (userInfo == null) { return(OpeCur.AjaxMsgNOOK("用户名或密码错误")); } //后台是否有权限 if (!IsLoginBackSystem(userName)) { return(OpeCur.AjaxMsgNOOK("没有权限登录后台")); } #region 设置为永久登录 OpeCur.CurrentUserInfo = userInfo; OpeCur.UserMenus = OpeCur.BllServices.MenuService.GetUserPermission(userInfo.UserName); OpeCur.UserNameCookie = userInfo.UserName; #endregion #endregion return(OpeCur.AjaxMsgOK("登录成功了~", "/admin/base/MenuManage")); }
public JsonResult Create(SysPositionModel model) { model.Id = ResultHelper.NewId; model.CreateTime = ResultHelper.NowTime; string userId = OpeCur.AccountNow.Id; if (model != null && ModelState.IsValid) { if (model.Name.IsNullOrEmpty()) { return(OpeCur.AjaxMsgNOOK("职业名不能为空!")); } OpeCur.ServiceSession.SysPosition.Create(ref errors, model); if (OpeCur.ServiceSession.SaveChange() > 0) { LogHandler.WriteServiceLog(userId, "Id" + model.Id + ",Name" + model.Name, "成功", "创建", "SysRole"); //return Json(JsonHandler.CreateMessage(1, Resource.InsertSucceed)); return(OpeCur.AjaxMsgOK(Resource.InsertSucceed)); } else { string ErrorCol = errors.Error; LogHandler.WriteServiceLog(userId, "Id" + model.Id + ",Name" + model.Name + "," + ErrorCol, "失败", "创建", "SysRole"); //return Json(JsonHandler.CreateMessage(0, Resource.InsertFail + ErrorCol)); return(OpeCur.AjaxMsgOK(Resource.InsertFail + ErrorCol)); } } else { return(OpeCur.AjaxMsgNOOK(Resource.ModelStateValidFail)); } }
public JsonResult Delete(string id) { if (!string.IsNullOrWhiteSpace(id) && id != "员工") { Apps.IService.IServiceSession serviceSession = OpeCur.ServiceSession; string userId = OpeCur.AccountNow.Id; string ErrorCol = errors.Error; if (id == "2017admin") { LogHandler.WriteServiceLog(userId, "尝试删除管理员", "失败", "删除", "用户设置"); return(OpeCur.AjaxMsgNOOK("管理员不能被删除" + ErrorCol)); } if (serviceSession.SysPosition.GetById(id).Enable != true) { IEnumerable <SysUserModel> sysUserList = serviceSession.SysUser.GetList().Where(t => t.PosId == id);//1、查找用户 2、更新用户 foreach (var item in sysUserList) { try { item.PosId = "员工"; item.PosName = "员工"; serviceSession.SysUser.EditByPosition(ref errors, item);//更新用户信息 } catch (Exception) { throw; } } serviceSession.SysPosition.RemoveById(ref errors, id); int saveNum = serviceSession.SaveChange(); if (saveNum > 0) { LogHandler.WriteServiceLog(userId, "Id:" + id, "成功", "删除", "用户设置"); return(OpeCur.AjaxMsgOK(Resource.DeleteSucceed + ErrorCol)); } else { ErrorCol = errors.Error; LogHandler.WriteServiceLog(userId, "Id:" + id + "," + ErrorCol, "失败", "删除", "用户设置"); return(OpeCur.AjaxMsgNOOK(Resource.DeleteFail + ErrorCol)); } } else { ErrorCol = errors.Error; LogHandler.WriteServiceLog(userId, "Id:" + id + "," + ErrorCol, "失败", "删除", "用户设置"); return(OpeCur.AjaxMsgNOOK(Resource.DeleteFail + " 职业已启用,请先取消,再删除" + ErrorCol)); } } else { return(OpeCur.AjaxMsgNOOK(Resource.DeleteFail)); } }
public JsonResult GetModuleTreeList(string id, string roleId) { if (id.IsNullOrEmpty() || roleId.IsNullOrEmpty()) { return(OpeCur.AjaxMsgNOOK("Id不能为空")); } List <TreeNode> nodes = OpeCur.ServiceSession.SysRight.GetModuleTreeNodes(id, roleId); return(OpeCur.AjaxMsgOK("获取成功", "", nodes)); }
public JsonResult EditOfWeight(SHIPPING_CONTAINER_MODEL info) { if (info != null && ModelState.IsValid) { Apps.IService.SCV.ISCVServiceSession scvSession = OpeCur.SCVServiceSession; string ErrorCol = errors.Error; List <SHIPPING_CONTAINER_MODEL> modelList = scvSession.SHIPPING_CONTAINER.GetList(t => (t.TRACKING_NUMBER.ToLower()) == info.TRACKING_NUMBER.ToLower() && t.PARENT == 0); if (modelList.Count() == 0) { return(OpeCur.AjaxMsgNOOK("该单号不存在,或数据不可更改!")); } SHIPPING_CONTAINER_MODEL item = modelList.FirstOrDefault(); int saveData = 0; if (info.WEIGHT != null && info.WEIGHT != 0) { info.INTERNAL_CONTAINER_NUM = item.INTERNAL_CONTAINER_NUM; item.WEIGHT = info.WEIGHT; scvSession.SHIPPING_CONTAINER.Modify(ref errors, info, "WEIGHT"); saveData = scvSession.SaveChange(); } if (saveData > 0) { SHIPPING_CONTAINER_HIS_MODEL model = new SHIPPING_CONTAINER_HIS_MODEL(); model.ID = ResultHelper.NewId; model.INTERNAL_CONTAINER_NUM = item.INTERNAL_CONTAINER_NUM; model.UPDATE_DATATIME = DateTime.Now; model.WEIGHT = item.WEIGHT; model.WEIGHT_NUM = item.WEIGHT_UM; model.TRACKING_NUMBER = item.TRACKING_NUMBER; model.CONTAINER_ID = item.CONTAINER_ID; model.UPDATE_USER = OpeCur.AccountNow.Id; model.UPDATE_USERNAME = OpeCur.AccountNow.UserName; model.UPDATE_USERTRUENAME = OpeCur.AccountNow.TrueName; scvSession.SHIPPING_CONTAINER_HIS.Create(ref errors, model); scvSession.SaveChange(); LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "SHIPMENT_ID:" + info.SHIPMENT_ID + "ITEM:" + info.ITEM + "Name:" + info.INTERNAL_SHIPMENT_LINE_NUM, "成功", "修改", "用户设置"); return(OpeCur.AjaxMsgOK("修改成功!" + ErrorCol)); } else { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "SHIPMENT_ID:" + info.SHIPMENT_ID + "ITEM:" + info.ITEM + "Name:" + info.INTERNAL_SHIPMENT_LINE_NUM, "失败", "修改", "用户设置"); return(OpeCur.AjaxMsgNOOK("修改失败!" + ErrorCol)); } } else { return(OpeCur.AjaxMsgNOOK(Resource.ModelStateValidFail)); } }
public JsonResult GetUserListByRole(GridPager pager, string roleId, string depId, string queryStr) { if (string.IsNullOrWhiteSpace(roleId)) { return(OpeCur.AjaxMsgNOOK("角色id为空")); } var userList = OpeCur.ServiceSession.SysRole.GetUserByRoleId(ref pager, roleId, depId, queryStr); var jsonData = new { total = pager.totalRows, rows = userList }; return(OpeCur.AjaxMsgOK("获取成功", "", jsonData)); }
public JsonResult GetList(GridPager pager, string queryStr) { Apps.IService.SCV.ISCVServiceSession serviceSession = OpeCur.SCVServiceSession; List <SHIPPING_CONTAINER_HIS_MODEL> list = serviceSession.SHIPPING_CONTAINER_HIS.GetList(ref pager, queryStr, t => t.UPDATE_USER.ToString() == OpeCur.AccountNow.Id).ToList(); if (list.Count <= 0) { return(OpeCur.AjaxMsgOK(Resource.NoMatchingData)); } var json = new { total = pager.totalRows, rows = list, }; return(OpeCur.AjaxMsgOK(Resource.GetSuccess, "", json)); }
public JsonResult GetList(GridPager pager, string queryStr) { Apps.IService.IServiceSession serviceSession = OpeCur.ServiceSession; List <SysUserModel> list = serviceSession.SysUser.GetUsrList(ref pager, queryStr, u => u.Id == OpeCur.AccountNow.Id); if (list.Count <= 0) { return(OpeCur.AjaxMsgOK(Resource.NoMatchingData)); } var json = new { total = pager.totalRows, rows = list, }; return(OpeCur.AjaxMsgOK(Resource.GetSuccess, "", json)); }
public JsonResult GetRoleList(GridPager pager, string queryStr) { var time = DateTime.Now; List <Apps.Models.Sys.SysRoleModel> list = OpeCur.ServiceSession.SysRole.GetList(ref pager, queryStr); var json = new { total = pager.totalRows, rows = list, }; if (list.Count <= 0) { return(OpeCur.AjaxMsgNOOK("没有符合条件的数据", "", json)); } return(OpeCur.AjaxMsgOK("查询成功", "", json)); }
public JsonResult ReSet(string Id, string Pwd) { Apps.IService.IServiceSession serviceSession = OpeCur.ServiceSession; serviceSession.SysUser.EditPwd(ref errors, Id, Pwd); string ErrorCol = errors.Error; if (serviceSession.SaveChange() > 0) { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id:" + Id + ",密码:********", "成功", "初始化密码", "用户设置"); return(OpeCur.AjaxMsgOK(Resource.EditSucceed + ErrorCol)); } else { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id:" + Id + ",,密码:********" + ErrorCol, "失败", "初始化密码", "用户设置"); return(OpeCur.AjaxMsgNOOK(Resource.EditFail + ErrorCol)); } }
public JsonResult UpdateRight(List <SysRightUpdateModel> data) { //data = "[{ 'id': '201704200905260490999d531a42553','checked':true}]"; //List<TreeNode> datas = JsonConvert.DeserializeObject<List<TreeNode>>(data); ValidationErrors errors = new ValidationErrors(); OpeCur.ServiceSession.SysRight.UpdateRight(ref errors, data); if (errors.Count() > 0) { return(OpeCur.AjaxMsgNOOK(errors.Error)); } //if (OpeCur.ServiceSession.SaveChange() > 0) //{ return(OpeCur.AjaxMsgOK("操作成功")); //} //else //{ // return OpeCur.AjaxMsgNOOK("操作失败"); //} }
public JsonResult AssignUser(string roleId, List <AssignUserModel> users) { //string[] arr = userIds.Split(','); OpeCur.ServiceSession.SysRole.UpdateSysRoleSysUser(roleId, users); if (OpeCur.ServiceSession.SaveChange() > 0) { foreach (var usr in users) { OpeCur.SetOtherUsrPers(usr.UserId); } LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Ids:" + "", "成功", "分配用户", "角色设置"); return(OpeCur.AjaxMsgOK(Resource.SetSucceed)); //return Json(JsonHandler.CreateMessage(1, Resource.SetSucceed), JsonRequestBehavior.AllowGet); } else { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Ids:" + "", "失败", "分配用户", "角色设置"); return(OpeCur.AjaxMsgOK(Resource.SetFail)); //return Json(JsonHandler.CreateMessage(0, Resource.SetFail), JsonRequestBehavior.AllowGet); } }
public JsonResult Edit(SysPositionModel info) { if (info != null && ModelState.IsValid) { Apps.IService.IServiceSession serviceSession = OpeCur.ServiceSession; serviceSession.SysPosition.Modify(ref errors, info, "Name", "Remark", "Sort", "Enable", "MemberCount", "DepId"); string ErrorCol = errors.Error; if (serviceSession.SaveChange() > 0) { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id:" + info.Id + ",Name:" + info.Name, "成功", "修改", "用户设置"); return(OpeCur.AjaxMsgOK("修改成功!" + ErrorCol)); } else { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id:" + info.Id + ",Name:" + info.Name + "," + ErrorCol, "失败", "修改", "用户设置"); return(OpeCur.AjaxMsgNOOK("修改失败!" + ErrorCol)); } } else { return(OpeCur.AjaxMsgNOOK(Resource.ModelStateValidFail)); } }
public JsonResult AssignRole(string userId, string roleIds) { Apps.IService.IServiceSession serviceSession = OpeCur.ServiceSession; string[] arr = roleIds.Split(','); string curId = OpeCur.AccountNow.Id; serviceSession.SysUser.UpdateSysRoleSysUser(userId, arr); string ErrorCol = errors.Error; if (serviceSession.SaveChange() > 0) { OpeCur.SetOtherUsrPers(userId); LogHandler.WriteServiceLog(curId, "Ids:" + roleIds, "成功", "分配角色", "用户设置"); return(OpeCur.AjaxMsgOK(Resource.SetSucceed + ErrorCol)); } else { ErrorCol = errors.Error; LogHandler.WriteServiceLog(curId, "Ids:" + roleIds, "失败", "分配角色", "用户设置"); return(OpeCur.AjaxMsgNOOK(Resource.SetFail + ErrorCol)); } }
public JsonResult ReSet(string Id, string pwd) { Apps.IService.IServiceSession serviceSession = OpeCur.ServiceSession; if (ValueConvert.MD5(pwd) == OpeCur.AccountNow.Password) { return(OpeCur.AjaxMsgNOOK(Resource.EditFail + "密码不能和当前密码相同")); } serviceSession.SysUser.EditPwd(ref errors, Id, pwd); string ErrorCol = errors.Error; if (serviceSession.SaveChange() > 0) { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id:" + Id + ",密码:********", "成功", "初始化密码", "用户设置"); //Session.Abandon(); //Session.Clear(); return(OpeCur.AjaxMsgOK(Resource.EditSucceed + ErrorCol)); } else { LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, "Id:" + Id + ",,密码:********" + ErrorCol, "失败", "初始化密码", "用户设置"); return(OpeCur.AjaxMsgNOOK(Resource.EditFail + ErrorCol)); } }
public JsonResult GetRoleList(GridPager pager) { List <SysRoleModel> list = OpeCur.ServiceSession.SysRole.GetList(ref pager, ""); if (list.Count <= 0) { return(OpeCur.AjaxMsgNOOK("没有符合条件的数据!")); } var json = new { total = pager.totalRows, rows = (from r in list select new SysRoleModel() { Id = r.Id, Name = r.Name, Description = r.Description, CreateTime = r.CreateTime, CreatePerson = r.CreatePerson }).ToArray() }; return(OpeCur.AjaxMsgOK("获取成功!", "", json)); }
public ActionResult ClearFlush() { OpeCur.ClearFlush(); return(OpeCur.AjaxMsgOK("清楚缓存成功")); }
public ActionResult LoginExit() { OpeCur.ExitLogin(); return(OpeCur.AjaxMsgOK("退出成功", "/admin/login/index")); }
public JsonResult Delete(string id) { if (!string.IsNullOrWhiteSpace(id) && id != "root") { Apps.IService.IServiceSession serviceSession = OpeCur.ServiceSession; string userId = OpeCur.AccountNow.Id; string ErrorCol = errors.Error; var structModel = serviceSession.SysStruct.GetById(id); if (id == "2017admin") { LogHandler.WriteServiceLog(userId, "尝试删除管理员", "失败", "删除", "用户设置"); return(OpeCur.AjaxMsgNOOK("管理员不能被删除" + ErrorCol)); } if (structModel.Enable != true) { IEnumerable <SysUserModel> sysUserList = serviceSession.SysUser.GetList(t => t.DepId == id); //1、查找用户 2、更新用户信息 IEnumerable <SysPositionModel> sysPositionList = serviceSession.SysPosition.GetList(t => t.DepId == id); //1、查找职位 2、更新职位信息 IEnumerable <SysStructModel> sysStructList = serviceSession.SysStruct.GetList(t => t.ParentId == id); //获取子部门信息 //更新关联--用户信息 foreach (var item in sysUserList) { try { item.DepId = structModel.ParentId; item.DepName = serviceSession.SysStruct.GetById(structModel.ParentId).Name; serviceSession.SysUser.UpdateByStruct(ref errors, item);//更新用户信息 } catch (Exception) { throw; } } //更新关联--职位信息 foreach (var item in sysPositionList) { try { item.DepId = structModel.ParentId; item.DepName = serviceSession.SysStruct.GetById(structModel.ParentId).Name; serviceSession.SysPosition.UpdateByStruct(ref errors, item);//更新职业信息 } catch (Exception) { throw; } } //更新struct foreach (var item in sysStructList) { try { item.ParentId = serviceSession.SysStruct.GetById(id).ParentId; serviceSession.SysStruct.Modify(ref errors, item, "ParentId");//更新部门所属信息 } catch (Exception) { throw; } } serviceSession.SysStruct.RemoveById(ref errors, id); int saveNum = serviceSession.SaveChange(); if (saveNum > 0) { LogHandler.WriteServiceLog(userId, "Id:" + id, "成功", "删除", "用户设置"); return(OpeCur.AjaxMsgOK(Resource.DeleteSucceed + ErrorCol)); } else { ErrorCol = errors.Error; LogHandler.WriteServiceLog(userId, "Id:" + id + "," + ErrorCol, "失败", "删除", "用户设置"); return(OpeCur.AjaxMsgNOOK(Resource.DeleteFail + ErrorCol)); } } else { ErrorCol = errors.Error; LogHandler.WriteServiceLog(userId, "Id:" + id + "," + ErrorCol, "失败", "删除", "用户设置"); return(OpeCur.AjaxMsgNOOK(Resource.DeleteFail + " 部门已启用,请禁用,再删除 " + ErrorCol)); } } else { return(OpeCur.AjaxMsgNOOK(Resource.DeleteFail)); } }
public JsonResult Login(Apps.Models.ViewModel.LoginModel usrLoginModel) { string userAgent = HttpContext.Request.UserAgent.ToLower();//compatible if ((userAgent.Contains("mozilla/4.0") || userAgent.Contains("compatible") || userAgent.Contains("msie 7.0") || userAgent.Contains("msie 6.0") || userAgent.Contains("msie 8.0") || userAgent.Contains("msie 9.0"))) { return(OpeCur.AjaxMsgNOOK(Resource.BrowserCompatibility)); } if (ModelState.IsValid) { if (Session["VCode"] != null && usrLoginModel.LoginCode.IsSame(Session["VCode"].ToString())) { string loginName = usrLoginModel.LoginName; AccountModel account = OpeCur.ServiceSession.SysUser.GetAccountByUserName(loginName); if (account == null) { return(OpeCur.AjaxMsgNOOK("用户名错误!")); } else if (!Convert.ToBoolean(account.State))//被禁用 { return(OpeCur.AjaxMsgNOOK("账户被禁用!")); } else { if (account.Password.IsSame(ValueConvert.MD5(usrLoginModel.Password))) { //AccountModel account = new AccountModel(); //account.Id = usr.Id; //account.UserName = usr.UserName; //account.TrueName = usr.TrueName; //account.Photo = string.IsNullOrEmpty(usr.Photo) ? "/Images/Photo.jpg" : usr.Photo; //OpeCur.AccountNow = account; //Session["uinfo"] = account; GetThemes(account.Id); OpeCur.AccountNow = account; OpeCur.UsrHasMerchantCode = account.HasMerchantCode; OpeCur.UsrNowPers = OpeCur.ServiceSession.SysUser.GetUserPermission(account.Id); OpeCur.SetRedisSession(); LogHandler.WriteServiceLog(account.UserName, ResultHelper.NowTime + "登录系统,IP:" + ResultHelper.GetUserIP(), "成功", "登录", "系统入口"); OpeCur.ServiceSession.SaveChange(); return(OpeCur.AjaxMsgOK("登录成功了!", "/Home/index")); } //d.2 登录失败 else { return(OpeCur.AjaxMsgNOOK("登录密码错误!")); } } } else { return(OpeCur.AjaxMsgNOOK("验证码输入错误!")); } } else { return(OpeCur.AjaxMsgNOOK(Resource.ModelStateValidFail)); } }