public ActionResult Create(FunctionalAuthority obj, string isContinue = "0") { var rm = new ReturnMessage(false); if (ModelState.IsValid) { try { //var list = BusinessContext.FunctionalAuthority.GetList("Module_Name ='" + obj.Module_Name + "'"); var list = BusinessContext.FunctionalAuthority.GetList(Query <FunctionalAuthority> .EQ(t => t.Module_Name, obj.Module_Name)); //var list = BusinessContext.FunctionalAuthority.Where(p => p.Module_Name == obj.Module_Name).ToList(); if (list != null && list.Count > 0) { obj.Module_Id = list.First().Module_Id; var group = list.FirstOrDefault(p => p.Group_Name == obj.Group_Name); var right = list.FirstOrDefault(p => p.Right_Name == obj.Right_Name); if (right != null) { rm.Message = "页面名称重复"; return(Json(rm)); } if (group == null) { obj.Group_Id = list.Max(p => p.Group_Id) + 1; obj.Right_Id = 1; } else { obj.Group_Id = group.Group_Id; obj.Right_Id = Convert.ToInt32(list.Where(p => p.Group_Id == obj.Group_Id).Max(p => p.Right_Id)) + 1; } } else { int maxModule = Convert.ToInt32(BusinessContext.FunctionalAuthority.GetMaxId()); obj.Module_Id = maxModule + 1; obj.Group_Id = 1; obj.Right_Id = 1; } obj.CreateOn = DateTime.Now; obj.CreateBy = CurrentHelper.CurrentUser.User.UserName; var res = BusinessContext.FunctionalAuthority.Add(obj); rm.IsSuccess = res; if (rm.IsSuccess) { rm.IsContinue = isContinue == "1"; } } catch (Exception ex) { rm.Message = ex.Message; } } return(Json(rm)); }
/// <summary> /// 编辑 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Edit(int id) { FunctionalAuthority dpt = BusinessContext.FunctionalAuthority.GetModel(id); if (dpt == null) { return(HttpNotFound()); } return(View(dpt)); }
// // GET: /System/GroupButton/ public ActionResult Index(int id) { FunctionalAuthority obj = BusinessContext.FunctionalAuthority.GetModel(id); ViewBag.Functional = obj; //获取已有的按钮 List <int> HasButtonIdList = BusinessContext.tblGroupButton.GetModelList("Group_NameId=" + id).Select(p => p.ButtonNameId).ToList(); ViewBag.HasButtonIdList = HasButtonIdList; List <tblButtonName> list = BusinessContext.tblButtonName.GetModelList("1=1"); return(View(list)); }
// // GET: /System/GroupButton/ public ActionResult Index(int id) { FunctionalAuthority obj = BusinessContext.FunctionalAuthority.Get(Query <FunctionalAuthority> .EQ(t => t.Rid, id)); ViewBag.Functional = obj; //获取已有的按钮 List <int?> HasButtonIdList = BusinessContext.tblGroupButton.GetList(Query <tblGroupButton> .EQ(t => t.Group_NameId, id)) .Select(p => p.ButtonNameId) .ToList(); ViewBag.HasButtonIdList = HasButtonIdList; List <tblButtonName> list = BusinessContext.tblButtonName.GetList(); return(View(list)); }
public ActionResult Edit(FunctionalAuthority collection) { var rm = new ReturnMessage(false); if (ModelState.IsValid) { try { collection.ModifyOn = DateTime.Now; collection.ModifyBy = CurrentHelper.CurrentUser.User.UserName; rm.IsSuccess = BusinessContext.FunctionalAuthority.Update(collection); } catch (Exception ex) { rm.Message = ex.Message; } } return(Json(rm)); }
public ActionResult Edit(FunctionalAuthority collection) { ReturnMessage RM = new ReturnMessage(false); if (ModelState.IsValid) { try { FunctionalAuthority old = BusinessContext.FunctionalAuthority.GetModel(collection.TblRcdId); RM.IsSuccess = BusinessContext.FunctionalAuthority.Update(collection); if (RM.IsSuccess) { OperateLogHelper.Edit <FunctionalAuthority>(collection, old); } } catch (Exception ex) { RM.Message = ex.Message; } } return(Json(RM)); }
public ActionResult Create(FunctionalAuthority obj, string IsContinue = "0") { ReturnMessage RM = new ReturnMessage(false); if (ModelState.IsValid) { try { //var list = BusinessContext.FunctionalAuthority.GetList("Module_Name ='" + obj.Module_Name + "'"); List <FunctionalAuthority> list = BusinessContext.FunctionalAuthority.GetModelList("Module_Name ='" + obj.Module_Name + "'"); //var list = BusinessContext.FunctionalAuthority.Where(p => p.Module_Name == obj.Module_Name).ToList(); if (list != null && list.Count() > 0) { obj.Module_Id = list.First().Module_Id; var group = list.FirstOrDefault(p => p.Group_Name == obj.Group_Name); var right = list.FirstOrDefault(p => p.Right_Name == obj.Right_Name); if (right != null) { RM.Message = "页面名称重复"; return(Json(RM)); } if (group == null) { obj.Group_Id = list.Max(p => p.Group_Id) + 1; obj.Right_Id = 1; } else { obj.Group_Id = group.Group_Id; obj.Right_Id = Convert.ToInt32(list.Where(p => p.Group_Id == obj.Group_Id).Max(p => p.Right_Id)) + 1; } } else { int maxModule = Convert.ToInt32(BusinessContext.FunctionalAuthority.GetMaxId()); obj.Module_Id = maxModule + 1; obj.Group_Id = 1; obj.Right_Id = 1; } int tblRcdid = BusinessContext.FunctionalAuthority.Add(obj); RM.IsSuccess = tblRcdid > 0; if (RM.IsSuccess) { obj.TblRcdId = tblRcdid; OperateLogHelper.Create <FunctionalAuthority>(obj); if (IsContinue == "1") { RM.IsContinue = true; } else { RM.IsContinue = false; } } } catch (Exception ex) { RM.Message = ex.Message; } } return(Json(RM)); }