Пример #1
0
 public int Edit(SysModule entity)
 {
     using (AppDBContainer db = new AppDBContainer())
     {
         db.SysModule.Attach(entity);
         db.Entry <SysModule>(entity).State = System.Data.EntityState.Modified;
         return(db.SaveChanges());
     }
 }
Пример #2
0
 public int Create(SysModule entity)
 {
     using (AppsDBEntities db = new AppsDBEntities())
     {
         //db.SysModule.AddObject(entity);
         db.SysModule.Add(entity);
         return(db.SaveChanges());
     }
 }
Пример #3
0
        public JsonResult MakeMenu()
        {
            AjaxResult <int> result = new AjaxResult <int>();
            var s = SysModule.InitPermission();
            int i = sysMenuManager.MakeMenu(s);

            result.data = i;
            return(Json(result));
        }
        /// <summary>
        /// 刷新应用模块
        /// </summary>
        public void RefreshModules()
        {
            applications = new ReadOnlyCollection <SysApplication>(SysApplication.FindAll());
            modules      = new ReadOnlyCollection <SysModule>(SysModule.FindAll(Expression.Eq(SysModule.Prop_Status, 1)));

            auths  = new ReadOnlyCollection <SysAuth>(SysAuth.FindAll());
            roles  = new ReadOnlyCollection <SysRole>(SysRole.FindAll());
            groups = new ReadOnlyCollection <SysGroup>(SysGroup.FindAll());
        }
Пример #5
0
        public void UpdateModule(SysModule module)
        {
            SysModule oldModule = RetrieveById(module.ModuleId);

            context.Entry(oldModule).State = EntityState.Deleted;
            context.Entry(module).State    = EntityState.Modified;
            module.UpdatedAt = DateTime.Now;
            context.SaveChanges();
        }
Пример #6
0
        public void AddRoleModuleOpera(int roleId, int moduleId, int operaId, DBContainer db)
        {
            SysModule moduleModel = db.SysModule.SingleOrDefault(x => x.Id == moduleId);

            db.P_Sys_RolePermSet(roleId, moduleId, operaId);
            if (moduleModel.ParentId != 0)
            {
                AddRoleModuleOpera(roleId, moduleModel.ParentId, operaId, db);
            }
        }
Пример #7
0
 public int Edit(SysModule entity)
 {
     using (SysMgr_DBEntities db = new SysMgr_DBEntities())
     {
         db.SysModule.Attach(entity);
         //db.ObjectStateManager.ChangeObjectState(entity, EntityState.Modified);
         db.Entry <SysModule>(entity).State = System.Data.Entity.EntityState.Modified;
         return(db.SaveChanges());
     }
 }
Пример #8
0
        public HttpResponseMessage Post([FromBody] SysModule sysModuleInfo)
        {
            return(ActionWarpper.Process(sysModuleInfo, OperationCodes.ASYSMDL, () =>
            {
                var repo = RepositoryManager.GetRepository <ISysModuleRepository>();
                repo.Insert(sysModuleInfo);

                return Request.CreateResponse(HttpStatusCode.OK, sysModuleInfo);
            }, this));
        }
Пример #9
0
        public JsonResult MakeMenu()
        {
            AjaxResult        result      = new AjaxResult();
            var               s           = SysModule.InitPermission();
            WebSYSMenuManager menuManager = new WebSYSMenuManager();
            int               i           = menuManager.MakeMenu(s);

            result.data = i;
            return(Json(result));
        }
        private void superGridControl2_CellMouseDown(object sender, GridCellMouseEventArgs e)
        {
            SysModule sysModule = Dbers.GetInstance().SelfDber.Get <SysModule>(superGridControl2.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl2.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            if (sysModule != null)
            {
                this.CurrSysModule = sysModule;
                BindDataRes();
            }
        }
Пример #11
0
        public ActionResult Edit(string id)
        {
            TransactionalInformation    transaction;
            SysModuleApplicationService sysModuleApplicationService = new SysModuleApplicationService(sysModuleDataService);

            ViewBag.Perm = GetPermission();
            SysModule sysModule = sysModuleApplicationService.GetSysModuleBySysModuleID(id, out transaction);

            return(View(sysModule));
        }
        public bool IsExist(string id)
        {
            SysModule entity = GetSysModuleById(id);

            if (entity != null)
            {
                return(true);
            }
            return(false);
        }
Пример #13
0
 public bool IsExist(string id)
 {
     using (OriginEntities db = new OriginEntities())
     {
         SysModule entity = GetById(id);
         if (entity != null)
             return true;
         return false;
     }
 }
Пример #14
0
        public ActionResult GetModules()
        {
            List <SysModule> modules = OperContext.CurrentOperContext.CurrentUser.PermissionModule;
            string           json    = string.Empty;

            if (modules != null && modules.Count > 0)
            {
                json = DataHelper.ObjectToJson(SysModule.GetTreeNode(modules));
            }
            return(Content(json));
        }
Пример #15
0
 public int Edit(SysModule entity)
 {
     using (DBContainer db = new DBContainer())
     {
         //  db.SysModule.Attach(entity);
         //  db.ObjectStateManager.ChangeObjectState(entity, EntityState.Modified);
         db.Set <SysModule>().Attach(entity);
         db.Entry(entity).State = EntityState.Modified;
         return(db.SaveChanges());
     }
 }
Пример #16
0
        private string GetAncestorPath(SysModule m)
        {
            string ret = "";

            if (m.ParentCode != "root")
            {
                var pm = RoleVM.SysModules.Find(sm => sm.Code == m.ParentCode);
                ret = GetAncestorPath(pm) + pm.Name + "﹥";
            }
            return(ret);
        }
Пример #17
0
        /// <summary>
        /// 欢迎页
        /// </summary>
        /// <returns></returns>
        public ActionResult Welcome()
        {
            try
            {
                using (DataWallContext db = new DataWallContext())
                {
                    List <SysLog> logList = db.SysLogs.Where(s => s.Modular != "User").OrderByDescending(u => u.CrateTime).Take(5).AsNoTracking().ToList();
                    ViewData["datalist"] = logList;
                    TimeSpan Time = DateTime.Now - db.SysProgramInfos.AsNoTracking().FirstOrDefault().FirstRunTime;
                    ViewBag.Time = Math.Round(Time.TotalHours, 0);

                    //获取软件信息
                    SysProgramInfo sysProgramInfo = db.SysProgramInfos.AsNoTracking().FirstOrDefault();
                    ViewBag.ProgramVersion = sysProgramInfo.ProgramVersion;
                    string Msg = string.Empty;
                    if (sysProgramInfo.Type == 1)
                    {
                        if (sysProgramInfo.ExpirationDate > DateTime.Now)
                        {
                            Msg = "当前版本为<span style='color:red;font-size:16px'><strong>试用版</strong></span>,到期时间:<span style='color:red;font-size:16px'><strong>" + sysProgramInfo.ExpirationDate.ToString("f") + "</strong></span>";
                        }
                        else
                        {
                            Msg = "当前版本<span style='color:red;font-size:16px'><strong>已过期</strong></span>,到期时间:<span style='color:red;font-size:16px'><strong>" + sysProgramInfo.ExpirationDate.ToString("f") + "</strong></span>";
                        }
                    }
                    ViewBag.Msg = Msg;

                    //获取服务器信息
                    ViewModels.SystemInfo systemInfo = JsonConvert.DeserializeObject <ViewModels.SystemInfo>(Common.SystemInfo.GetSystemInfo());

                    //可用模块
                    List <SysModule> Module = db.SysModules.Where(m => m.IsEnable == 0 & m.DelState == 0).AsNoTracking().ToList();
                    List <SysMenu>   Menu   = db.SysMenus.Where(m => m.IsEnable == 0 & m.DelState == 0).AsNoTracking().ToList();
                    foreach (var item in Menu)
                    {
                        SysModule sysModule = new SysModule()
                        {
                            Title    = item.MenuName,
                            Describe = item.Describe,
                            Sort     = item.Sort
                        };
                        Module.Add(sysModule);
                    }
                    ViewData["modulelist"] = Module.OrderBy(m => m.Sort).ToList();
                    return(View(systemInfo));
                }
            }
            catch (Exception ex)
            {
                LogHelper.ErrorLog("欢迎页加载失败:" + ex.Message);
                return(Json(new { error = "页面加载失败,请联系管理员" }));
            }
        }
Пример #18
0
        public HttpResponseMessage Put(int id, [FromBody] SysModule sysModuleInfo)
        {
            return(ActionWarpper.Process(sysModuleInfo, OperationCodes.MSYSMDL, () =>
            {
                sysModuleInfo.ModuleID = id;
                var repo = RepositoryManager.GetRepository <ISysModuleRepository>();
                repo.Update(sysModuleInfo);

                return Request.CreateResponse(HttpStatusCode.OK);
            }, this));
        }
Пример #19
0
        public override void Update(SysModule item, bool saveImmediately = true)
        {
            var editModel = CurrentDbSet.Find(item.MId);

            TypeExtend <SysModule> .CopyTo(item, editModel);

            if (saveImmediately)
            {
                SaveChanges();
            }
        }
Пример #20
0
 public void SubmitForm(SysModule SysModule, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         SysModule.Id = keyValue;
         _Respository.Update(SysModule);
     }
     else
     {
         _Respository.Insert(SysModule);
     }
 }
Пример #21
0
 public int Delete(string id)
 {
     using (SysMgr_DBEntities db = new SysMgr_DBEntities())
     {
         SysModule entity = db.SysModule.SingleOrDefault(a => a.Id == id);
         if (entity != null)
         {
             db.SysModule.Remove(entity);
         }
         return(db.SaveChanges());
     }
 }
Пример #22
0
 public SysModule GetById(string id)
 {
     if (IsExist(id))
     {
         SysModule entity = SysModuleDAL.GetById(id);
         return(entity);
     }
     else
     {
         return(null);
     }
 }
Пример #23
0
 public bool IsExist(string id)
 {
     using (SysMgr_DBEntities db = new SysMgr_DBEntities())
     {
         SysModule entity = GetById(id);
         if (entity != null)
         {
             return(true);
         }
         return(false);
     }
 }
Пример #24
0
        public static bool Update(SysModule sysModule)
        {
            using (var context = db.Context())
            {
                return(context.Update <SysModule>("SysModule", sysModule)
                       .AutoMap(x => x.Id)

                       .Where("Id", sysModule.Id)

                       .Execute() > 0);
            }
        }
 /// <summary>
 /// 判断一个实体是否存在
 ///
 /// </summary>
 /// <param name="id">id</param>
 /// <returns>是否存在 true or false</returns>
 public bool IsExist(int id)
 {
     using (DBContainer db = new DBContainer())
     {
         SysModule entity = db.SysModule.SingleOrDefault(model => model.Id == id);
         if (entity != null)
         {
             return(true);
         }
         return(false);
     }
 }
Пример #26
0
 public int Edit(SysModule entity)
 {
     using (AppsDBEntities db = new AppsDBEntities())
     {
         db.SysModule.Attach(entity);
         //db.SysModule.m
         db.Entry <SysModule>(entity).State = EntityState.Modified;
         //db.ObjectStateManager.ChangeObjectState(entity, EntityState.Modified);
         //db.sta
         return(db.SaveChanges());
     }
 }
Пример #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            op = RequestData.Get <string>("op");
            id = RequestData.Get <string>("id");
            string AuthIds = RequestData.Get <string>("AuthIds");

            if (!string.IsNullOrEmpty(id))
            {
                ent = MyShortCut.Find(id);
            }
            switch (RequestActionString)
            {
            case "update":
                ent = GetMergedData <MyShortCut>();
                ent.DoUpdate();
                break;

            case "create":
                ent = GetPostedData <MyShortCut>();
                sql = @"delete from BJKY_IntegratedManage..MyShortCut where CreateId='{0}' and PatIndex('%'+AuthId+'%','{1}')>0";
                sql = string.Format(sql, UserInfo.UserID, ent.AuthId);
                DataHelper.ExecSql(sql);    //删除快捷中已经存在权限模块ID
                if (ent.AuthId.Length > 36)
                {
                    string[] authIdArray   = ent.AuthId.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    string[] authNameArray = ent.AuthName.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 0; i < authIdArray.Length; i++)
                    {
                        MyShortCut mscEnt = new MyShortCut();
                        mscEnt.AuthId   = authIdArray[i];
                        mscEnt.AuthName = authNameArray[i];
                        SysAuth   saEnt = SysAuth.Find(ent.AuthId);
                        SysModule smEnt = SysModule.Find(saEnt.ModuleID);
                        mscEnt.ModuleUrl    = smEnt.Url;
                        mscEnt.IconFileId   = ent.IconFileId;
                        mscEnt.IconFileName = ent.IconFileName;
                        mscEnt.DoCreate();
                    }
                }
                else
                {
                    SysAuth   saEnt = SysAuth.Find(ent.AuthId);
                    SysModule smEnt = SysModule.Find(saEnt.ModuleID);
                    ent.ModuleUrl = smEnt.Url;
                    ent.DoCreate();
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Пример #28
0
        public JsonResult ChangeSubmit(SysModule Model)
        {
            var jsonm = new ResultJson();

            jsonm.data = Model;
            var model = new SysModule();

            try
            {
                using (var db = SugarBase.GetIntance())
                {
                    if (!string.IsNullOrEmpty(Model.ID))
                    {
                        model = db.Queryable <SysModule>().Where(m => m.ID == Model.ID).First();
                    }
                    if (model == null)
                    {
                        model = new SysModule();
                    }
                    model.Icon     = Model.Icon;
                    model.Href     = Model.Href;
                    model.Sort     = Model.Sort;
                    model.Type     = Model.Type;
                    model.Remarks  = Model.Remarks;
                    model.Business = Model.Business;
                    model.ParentID = Model.ParentID;
                    if (string.IsNullOrEmpty(Model.ID))
                    {
                        SetSysLog("【添加菜单】" + Model.Name, 3, 1);
                        model.Name = Model.Name;
                        db.Insertable(model).ExecuteCommand();
                        jsonm.status = 200;
                    }
                    else
                    {
                        SetSysLog("【编辑菜单】" + model.Name + " --> " + Model.Name, 3, 1);
                        model.Name = Model.Name;
                        db.Updateable(model).ExecuteCommand();
                        jsonm.status = 200;
                    }
                }
            }
            catch (Exception ex)
            {
                LogProvider.Error("编辑菜单", ex.StackTrace, ex.Message);

                jsonm.status = 500;
                jsonm.msg    = "保存失败";
            }


            return(Json(jsonm));
        }
Пример #29
0
        //////[SupportFilter]
        public ActionResult Create(string id)
        {
            SysModule entity = new SysModule()
            {
                ParentId = id,
                Iconic   = "fa fa-puzzle-piece",
                Enable   = "true",
                Sort     = "0"
            };

            return(View(entity));
        }
Пример #30
0
 public bool IsExist(string id)
 {
     using (DBContainer db = new DBContainer())
     {
         SysModule entity = GetById(id);
         if (entity != null)
         {
             return(true);
         }
         return(false);
     }
 }
Пример #31
0
 public async Task<IHttpActionResult> Save(SysModule model)
 {
     if (!ModelState.IsValid)
     {
         return ValidError();
     }
     var module = await _moduleRepository.GetByKeyAsync(model.Id);
     if (module == null)
     {
         //添加
         await _moduleRepository.InsertAsync(model);
     }
     else
     {
         module.Name = model.Name;
         module.Code = model.Code;
         module.Url = model.Url;
         module.Icon = model.Icon;
         module.IsLock = model.IsLock;
         module.ParentId = model.ParentId;
         module.Sort = model.Sort;
         module.Remark = model.Remark;
         //修改
         await _moduleRepository.UpdateAsync(module);
     }
     await _unitOfWork.CommitAsync();
     return Ok();
 }