예제 #1
0
        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 + "转换的过程中发生了错误!");
            }
        }
예제 #2
0
        public SYS_Button Get(JObject json)
        {
            var        model  = JsonToObject <SYS_Button>(json);
            SYS_Button _model = DPBase.Get <SYS_Button>(model.BTN_Id);

            return(_model);
        }
예제 #3
0
        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) ? "新增成功!" : "新增失败");
        }
예제 #4
0
        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);
        }
예제 #5
0
        public SYS_Account Get(JObject json)
        {
            var         model  = JsonToObject <SYS_Account>(json);
            SYS_Account _model = DPBase.Get <SYS_Account>(model.ACC_Id);

            return(_model);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        public string Delete(JObject json)
        {
            SetDefaultValue(json);
            var model = JsonToObject <SYS_FunctionTree>(json);

            return(DPBase.Delete <SYS_FunctionTree>(model.FT_Id) ? "删除成功!" : "删除失败");
        }
예제 #9
0
        public string EditButtonGroup(JObject json)
        {
            SYS_ButtonGroup bGroup = (SYS_ButtonGroup)(JsonConvert.DeserializeObject(json.ToString(), typeof(SYS_ButtonGroup)));

            DPBase.Update(bGroup);
            return("保存成功!");
        }
예제 #10
0
        public string DelBtnInformation(JObject json)
        {
            int BG_Id = Convert.ToInt32(json["BG_Id"].ToString());

            DPBase.Delete <SYS_ButtonGroup>(BG_Id);
            return("删除成功!");
        }
예제 #11
0
        public string Edit(JObject json)
        {
            SetDefaultValue(json);
            SYS_FunctionTree model = JsonToObject <SYS_FunctionTree>(json);

            return(DPBase.Update(model) ? "修改成功!" : "修改失败");
        }
예제 #12
0
        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);
        }
예제 #13
0
        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));
        }
예제 #14
0
        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));
        }
예제 #15
0
        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("保存成功!");
        }
예제 #16
0
        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);
        }
예제 #17
0
        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));
        }
예제 #18
0
        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);
        }
예제 #19
0
 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 + "转换的过程中发生了错误!");
     }
 }
예제 #20
0
 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 + "转换的过程中发生了错误!");
     }
 }
예제 #21
0
 string IExcuteModel <T> .UpdateModel(T t)
 {
     DPBase.Update(t);
     return("保存成功!");
 }
예제 #22
0
 string IExcuteModel <T> .AddModel(T t)
 {
     DPBase.Add(t);
     return("新增成功!");
 }
예제 #23
0
        T IExcuteModel <T> .GetModel(string id)
        {
            T _returnT = DPBase.Get <T>(id);

            return(_returnT);
        }
예제 #24
0
        bool IExcuteModel <T> .DelModel(T t)
        {
            bool flag = DPBase.Delete(t);

            return(flag);
        }
예제 #25
0
        public string Delete(JObject json)
        {
            var model = JsonToObject <SYS_Button>(json);

            return(DPBase.Delete <SYS_Button>(model.BTN_Id) ? "删除成功!" : "删除失败");
        }
예제 #26
0
        public string Delete(JObject json)
        {
            var model = JsonToObject <SYS_Account>(json);

            return(DPBase.Delete <SYS_Account>(model.ACC_Id) ? "删除成功!" : "删除失败");
        }
예제 #27
0
        public string Edit(JObject json)
        {
            SYS_SystemRole model = JsonToObject <SYS_SystemRole>(json);

            return(DPBase.Update(model) ? "新增成功!" : "新增失败");
        }
예제 #28
0
        public List <SYS_SystemRole> GetAllRoleInfo()
        {
            List <SYS_SystemRole> _list = DPBase.Get <SYS_SystemRole>().ToList();

            return(_list);
        }
예제 #29
0
        public string Edit(JObject json)
        {
            SYS_Button model = JsonToObject <SYS_Button>(json);

            return(DPBase.Update(model) ? "新增成功!" : "新增失败");
        }
예제 #30
0
        public string Delete(JObject json)
        {
            var model = JsonToObject <SYS_SystemRole>(json);

            return(DPBase.Delete <SYS_SystemRole>(model.ROLE_Id) ? "删除成功!" : "删除失败");
        }