Пример #1
0
 public ActionResult MenuInsert(TS_MENUDTO dto)
 {
     dto.Levels    = service.GetMenuLevel();
     dto.MenuItems = service.GetMenu(1);
     dto.Title     = "菜单添加";
     if (!ModelState.IsValid)
     {
         return(View(dto));
     }
     else
     {
         dto.C_EMP_ID   = BaseUser.Id;
         dto.C_EMP_NAME = BaseUser.Name;
         dto.D_MOD_DT   = DateTime.Now;
         dto.N_STATUS   = 1;
         dto.N_TYPE     = 1;
         if (string.IsNullOrWhiteSpace(dto.C_PARENT_ID))
         {
             dto.N_MENULEVEL = 1;
         }
         else
         {
             dto.N_MENULEVEL = 2;
         }
         service.MenuInsert(dto);
         dto.ResultType = 1;
         return(View(dto));
     }
 }
Пример #2
0
        /// <summary>
        /// 查询菜单
        /// </summary>
        /// <returns></returns>
        public ActionResult QueryMenu()
        {
            TS_MENUDTO dto = new TS_MENUDTO();

            dto.Menus = MAPPING.ConvertEntityToDtoList <TS_MENU, TS_MENUDTO>(service.GetMenus());
            return(View(dto));
        }
Пример #3
0
        /// <summary>
        /// 菜单修改
        /// </summary>
        /// <param name="menu"></param>
        public void MenuUpdate(TS_MENUDTO menu)
        {
            var ef = AutoMapper.Mapper.Map <TS_MENU>(menu);

            if (ef != null)
            {
                Update(ef);
            }
        }
Пример #4
0
        /// <summary>
        /// 添加菜单
        /// </summary>
        /// <param name="menu"></param>
        public void MenuInsert(TS_MENUDTO menu)
        {
            var ef = AutoMapper.Mapper.Map <TS_MENU>(menu);

            if (ef != null)
            {
                Insert(ef);
            }
        }
Пример #5
0
 /// <summary>
 /// 获取菜单
 /// </summary>
 /// <returns></returns>
 public List <TS_MENU> GetMenus(TS_MENUDTO dto, int type)
 {
     return(_MenuUser
            .Where(x => x.N_STATUS == 1 &&
                   x.N_TYPE == 1 &&
                   x.N_MENULEVEL == 2
                   )
            .OrderBy(x => x.N_SORT).ToList());
 }
Пример #6
0
        /// <summary>
        /// 添加菜单
        /// </summary>
        /// <returns></returns>
        public ActionResult MenuInsert()
        {
            TS_MENUDTO dto = new TS_MENUDTO();

            dto.Title     = "菜单添加";
            dto.Levels    = service.GetMenuLevel();
            dto.MenuItems = service.GetMenu(1);
            return(View(dto));
        }
Пример #7
0
        /// <summary>
        /// 添加菜单
        /// </summary>
        /// <returns></returns>
        public ActionResult MenuUpdate(string id)
        {
            TS_MENUDTO dto = new TS_MENUDTO();

            dto           = service.GetMenu(id);
            dto.Title     = "菜单修改";
            dto.Levels    = service.GetMenuLevel();
            dto.MenuItems = service.GetMenu(1);
            return(View("MenuInsert", dto));
        }
Пример #8
0
        /// <summary>
        /// 获取菜单信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public TS_MENUDTO GetMenu(string id)
        {
            var        ef  = _MenuUser.FirstOrDefault(x => x.C_ID.Equals(id));
            TS_MENUDTO dto = new TS_MENUDTO();

            if (ef != null)
            {
                dto = AutoMapper.Mapper.Map <TS_MENUDTO>(ef);
            }
            return(dto);
        }
Пример #9
0
        public ActionResult MenuManage(TS_MENUDTO dto)
        {
            //获取完成工差列表
            PageResult <TS_MENU> ef = service.GetMenus(dto);
            //获取分页数据
            BASEPAGE page = AUTOMAPING.Mapping <BASEPAGE>(ef);

            this.HttpContext.Session["Page"] = page;
            //EF实体数据转换为DTO
            dto.Menus = MAPPING.ConvertEntityToDtoList <TS_MENU, TS_MENUDTO>(ef.DataList);
            return(View(dto));
        }
Пример #10
0
        /// <summary>
        /// 获取菜单
        /// </summary>
        /// <param name="dto">菜单实体DTO</param>
        /// <returns></returns>
        public PageResult <TS_MENU> GetMenus(TS_MENUDTO dto)
        {
            Expression <Func <TS_MENU, bool> > where = null;
            where = where.And <TS_MENU>(x => x.N_STATUS == 1);
            // where = where.And<TS_MENU>(x => x.N_TYPE == 1);

            if (!string.IsNullOrWhiteSpace(dto.C_NAME))
            {
                dto.C_NAME = dto.C_NAME.Trim();
                where      = where.And <TS_MENU>(x => x.C_NAME.Contains(dto.C_NAME));
            }

            Expression <Func <TS_MENU, int> > order = null;

            order = t => t.N_SORT ?? 1;

            return(QueryPage <TS_MENU, int>(where, dto.BasePage.PageSize, dto.BasePage.PageIndex, order));
        }
Пример #11
0
 public ActionResult MenuUpdate(TS_MENUDTO dto)
 {
     dto.Title      = "菜单修改";
     dto.Levels     = service.GetMenuLevel();
     dto.MenuItems  = service.GetMenu(1);
     dto.C_EMP_ID   = BaseUser.Id;
     dto.C_EMP_NAME = BaseUser.Name;
     dto.D_MOD_DT   = DateTime.Now;
     if (string.IsNullOrWhiteSpace(dto.C_PARENT_ID))
     {
         dto.N_MENULEVEL = 1;
     }
     else
     {
         dto.N_MENULEVEL = 2;
     }
     service.MenuUpdate(dto);
     dto.ResultType = 2;
     return(View("MenuInsert", dto));
 }