public string Allocate(JObject json) { try { int AR_AccountId = Convert.ToInt32(json["ACC_ID"].ToString()); using (NERPEntities context = new NERPEntities()) { //删除已有的数据集合 List <SYS_AccountRole> tempList = context.SYS_AccountRole.Where(c => c.AR_AccountId == AR_AccountId).ToList(); context.SYS_AccountRole.RemoveRange(tempList); context.SaveChanges(); //循环添加 for (int i = 0; i < json["RoleValueArray"].Count(); i++) { string tempRoleName = json["RoleValueArray"][i].ToString(); SYS_AccountRole _role = new SYS_AccountRole(); _role.AR_AccountId = AR_AccountId; int AR_SystemRoleId = context.SYS_SystemRole.Where(c => c.ROLE_Name == tempRoleName).FirstOrDefault().ROLE_Id; _role.AR_SystemRoleId = AR_SystemRoleId; DPBase.Add(_role); } return("保存成功!"); } } catch (Exception ex) { throw new Exception(ex.Message + "转换的过程中发生了错误!"); } }
public SYS_Button Get(JObject json) { var model = JsonToObject <SYS_Button>(json); SYS_Button _model = DPBase.Get <SYS_Button>(model.BTN_Id); return(_model); }
public string Edit(JObject json) { SYS_Account model = JsonToObject <SYS_Account>(json); model.ACC_Password = model.ACC_Password == "" ? "" : ANTPower.Security.Encrypt.StrToMd5Encrypt(model.ACC_Password); return(DPBase.Update(model) ? "新增成功!" : "新增失败"); }
public Flexigride GetJson(JObject json) { SearchMod <SYS_Button> searchModel = new SearchMod <SYS_Button>(); searchModel.page = Convert.ToInt32(json["page"].ToString()); //当前页 searchModel.rp = Convert.ToInt32(json["rp"].ToString()); //页面大小 searchModel.sortorder = json["sortorder"].ToString(); //排序字段 searchModel.sortname = json["sortname"].ToString(); //排序方式 SYS_Button model = JsonToObject <SYS_Button>(json); IQueryable <SYS_Button> query = DPBase.db.SYS_Button; query = string.IsNullOrEmpty(searchModel.sortorder) ? query.OrderByDescending(c => searchModel.sortorder) : query.OrderBy(c => searchModel.sortorder); if (!string.IsNullOrEmpty(model.BTN_Name)) { query = query.Where(c => c.BTN_Name.Contains(model.BTN_Name)); } if (!string.IsNullOrEmpty(model.BTN_Name_En)) { query = query.Where(c => c.BTN_Name_En.Contains(model.BTN_Name_En)); } searchModel.query = query; Flexigride grid = new Flexigride(); grid.rows = DPBase.DPGetQueryLst(searchModel, out searchModel); grid.page = searchModel.page; grid.total = searchModel.total; return(grid); }
public SYS_Account Get(JObject json) { var model = JsonToObject <SYS_Account>(json); SYS_Account _model = DPBase.Get <SYS_Account>(model.ACC_Id); return(_model); }
public Flexigride GetButtonGroup(JObject json) { SearchMod <SYS_ButtonGroup> searchModel = new SearchMod <SYS_ButtonGroup>(); searchModel.page = Convert.ToInt32(json["page"].ToString()); searchModel.rp = Convert.ToInt32(json["rp"].ToString()); SYS_ButtonGroup bGroup = (SYS_ButtonGroup)(JsonConvert.DeserializeObject(json.ToString(), typeof(SYS_ButtonGroup))); IQueryable <SYS_ButtonGroup> query = DPBase.db.SYS_ButtonGroup; query = string.IsNullOrEmpty(searchModel.sortorder) ? query.OrderByDescending(c => searchModel.sortname) : query.OrderBy(c => searchModel.sortname); if (!string.IsNullOrEmpty(bGroup.BG_Name)) { query = query.Where(c => c.BG_Name.Contains(bGroup.BG_Name)); } if (!string.IsNullOrEmpty(bGroup.BG_Name_En)) { query = query.Where(c => c.BG_Name_En.Contains(bGroup.BG_Name_En)); } //aa.query = query.Select(c => new { BG_Name = c.BG_Name, BG_Name_En = c.BG_Name_En, BG_OrderIndex = c.BG_OrderIndex, BG_Desc = c.BG_Desc,BG_Id = c.BG_Id }); searchModel.query = query.OrderBy(c => c.BG_CreatedOn); Flexigride grid = new Flexigride(); grid.rows = DPBase.DPGetQueryLst(searchModel, out searchModel); grid.page = searchModel.page; grid.total = searchModel.total; return(grid); }
public Flexigride GetJson(JObject json) { SearchMod <SYS_Dics> searchModel = new SearchMod <SYS_Dics>(); searchModel.page = Convert.ToInt32(json["page"].ToString()); //当前页 searchModel.rp = Convert.ToInt32(json["rp"].ToString()); //页面大小 searchModel.sortorder = json["sortorder"].ToString(); //排序字段 searchModel.sortname = json["sortname"].ToString(); //排序方式 var model = JsonToObject <SYS_Dics>(json); IQueryable <SYS_Dics> query = DPBase.db.SYS_Dics; //query = string.IsNullOrEmpty(searchModel.sortorder) ? query.OrderByDescending(c => searchModel.sortorder) : query.OrderBy(c => searchModel.sortorder); query = query.OrderBy(c => c.Sortnum); if (model.CategoryId != 0) { query = query.Where(c => c.CategoryId == model.CategoryId); } searchModel.query = query; Flexigride grid = new Flexigride(); grid.rows = DPBase.DPGetQueryLst(searchModel, out searchModel); grid.page = searchModel.page; grid.total = searchModel.total; return(grid); }
public string Delete(JObject json) { SetDefaultValue(json); var model = JsonToObject <SYS_FunctionTree>(json); return(DPBase.Delete <SYS_FunctionTree>(model.FT_Id) ? "删除成功!" : "删除失败"); }
public string EditButtonGroup(JObject json) { SYS_ButtonGroup bGroup = (SYS_ButtonGroup)(JsonConvert.DeserializeObject(json.ToString(), typeof(SYS_ButtonGroup))); DPBase.Update(bGroup); return("保存成功!"); }
public string DelBtnInformation(JObject json) { int BG_Id = Convert.ToInt32(json["BG_Id"].ToString()); DPBase.Delete <SYS_ButtonGroup>(BG_Id); return("删除成功!"); }
public string Edit(JObject json) { SetDefaultValue(json); SYS_FunctionTree model = JsonToObject <SYS_FunctionTree>(json); return(DPBase.Update(model) ? "修改成功!" : "修改失败"); }
public SYS_FunctionTree Get(JObject json) { SetDefaultValue(json); var model = JsonToObject <SYS_FunctionTree>(json); var _model = DPBase.Get <SYS_FunctionTree>(model.FT_Id); return(_model); }
public int Add(JObject json) { SYS_Account model = JsonToObject <SYS_Account>(json); model.ACC_CreatedBy = UserSession.userid; //当前用户 model.ACC_CreatedOn = DateTime.Now; return(DPBase.Add(model)); }
public int Add(JObject json) { SYS_SystemRole model = JsonToObject <SYS_SystemRole>(json); model.ROLE_CreatedBy = UserSession.userid; //当前用户 model.ROLE_CreatedOn = DateTime.Now; return(DPBase.Add(model)); }
public string AddNewButtonGroup(JObject json) { json["BG_OrderIndex"] = 0; SYS_ButtonGroup bGroup = (SYS_ButtonGroup)(JsonConvert.DeserializeObject(json.ToString(), typeof(SYS_ButtonGroup))); bGroup.BG_CreatedOn = DateTime.Now; bGroup.BG_IsSuspended = false; DPBase.Add(bGroup); return("保存成功!"); }
public JObject GetBtnInformation(JObject json) { //SYS_ButtonGroup bGroup = (SYS_ButtonGroup)(JsonConvert.DeserializeObject(json.ToString(), typeof(SYS_ButtonGroup))); int BG_Id = Convert.ToInt32(json["BG_Id"].ToString()); SYS_ButtonGroup _btnGroup = DPBase.Get <SYS_ButtonGroup>(BG_Id); JObject ret = new JObject(); ret.Add("group", JObject.FromObject(_btnGroup)); return(ret); }
public int Add(JObject json) { SYS_Button model = JsonToObject <SYS_Button>(json); model.BTN_IsSuspended = false; //默认为false model.BTN_Mark = model.BTN_Name_En; model.BTN_CreatedBy = UserSession.username; //当前用户 model.BTN_CreatedOn = DateTime.Now; return(DPBase.Add(model)); }
public SYS_SystemRole Get(JObject json) { if (string.IsNullOrEmpty(json["ROLE_Level"].ToString())) { json["ROLE_Level"] = 0; } var model = JsonToObject <SYS_SystemRole>(json); SYS_SystemRole _model = DPBase.Get <SYS_SystemRole>(model.ROLE_Id); return(_model); }
public Array GetMenuItem1(string FT_Id) { try { int _id = Convert.ToInt32(FT_Id); IQueryable <SYS_FunctionTree> query = DPBase.Get <SYS_FunctionTree>().Where(c => c.FT_ParentId == _id); Array _array = query.ToArray(); return(_array); } catch (Exception ex) { throw new Exception(ex.Message + "转换的过程中发生了错误!"); } }
public List <Array> GetMenuItem0() { try { List <Array> ret = new List <Array>(); IQueryable <SYS_FunctionTree> query = DPBase.Get <SYS_FunctionTree>(); Array _array0 = query.Where(c => c.FT_ParentId == 0).ToArray(); Array _array1 = query.Where(c => c.FT_ParentId == 1).ToArray(); ret.Add(_array0); ret.Add(_array1); return(ret); } catch (Exception ex) { throw new Exception(ex.Message + "转换的过程中发生了错误!"); } }
string IExcuteModel <T> .UpdateModel(T t) { DPBase.Update(t); return("保存成功!"); }
string IExcuteModel <T> .AddModel(T t) { DPBase.Add(t); return("新增成功!"); }
T IExcuteModel <T> .GetModel(string id) { T _returnT = DPBase.Get <T>(id); return(_returnT); }
bool IExcuteModel <T> .DelModel(T t) { bool flag = DPBase.Delete(t); return(flag); }
public string Delete(JObject json) { var model = JsonToObject <SYS_Button>(json); return(DPBase.Delete <SYS_Button>(model.BTN_Id) ? "删除成功!" : "删除失败"); }
public string Delete(JObject json) { var model = JsonToObject <SYS_Account>(json); return(DPBase.Delete <SYS_Account>(model.ACC_Id) ? "删除成功!" : "删除失败"); }
public string Edit(JObject json) { SYS_SystemRole model = JsonToObject <SYS_SystemRole>(json); return(DPBase.Update(model) ? "新增成功!" : "新增失败"); }
public List <SYS_SystemRole> GetAllRoleInfo() { List <SYS_SystemRole> _list = DPBase.Get <SYS_SystemRole>().ToList(); return(_list); }
public string Edit(JObject json) { SYS_Button model = JsonToObject <SYS_Button>(json); return(DPBase.Update(model) ? "新增成功!" : "新增失败"); }
public string Delete(JObject json) { var model = JsonToObject <SYS_SystemRole>(json); return(DPBase.Delete <SYS_SystemRole>(model.ROLE_Id) ? "删除成功!" : "删除失败"); }