Пример #1
0
 // GET: Menu
 public ActionResult Index()
 {
     using (BizDbContext bizDb = new BizDbContext())
     {
         List <DX_Menus> parentMenus = bizDb.DX_Menus.ToList();
     }
     return(View());
 }
Пример #2
0
        // [DoodlAuthAttrbute]
        // GET: Index
        public ActionResult Index()
        {
            List <UserInfo> user = null;

            using (BizDbContext bizDb = new BizDbContext())
            {
                user = bizDb.UserInfo.ToList();
            }
            return(View(user));
        }
Пример #3
0
        public ActionResult getList(string pageIndex, string pSize)
        {
            string currentUser = GetCurrentUser();

            this.pageIndex = Convert.ToInt32(pageIndex);
            if (pSize != "-1")
            {
                this.pageSize = Convert.ToInt32(pSize);
            }
            using (BizDbContext bizDb = new BizDbContext())
            {
                SqlParameter[] sqlp1    = new SqlParameter[4];
                string         tablsSql = "(select * from DX_User) as t"; //如果是多表联合查询,把语句包裹起来,创建别名

                sqlp1[0]           = new SqlParameter("@page_size", pageSize);
                sqlp1[1]           = new SqlParameter("@page_index", pageIndex);
                sqlp1[2]           = new SqlParameter("@table", tablsSql);
                sqlp1[3]           = new SqlParameter("@ISCOUNT", 0);
                sqlp1[3].Direction = System.Data.ParameterDirection.Output;
                //执行存储过程,返回list结果
                user = bizDb.DX_User.SqlQuery("[Proc_TablePage] @page_size,@page_index,@table,@ISCOUNT out", sqlp1).ToList();
                //返回总数据条数
                CountNum = Convert.ToInt32(sqlp1[3].Value); //总条数
                                                            //计算总页数
                if (CountNum <= pageSize && CountNum > 0)
                {
                    pageNum = 1;
                }
                else if (CountNum % pageSize > 0)
                {
                    pageNum = (CountNum / pageSize) + 1;
                }
                else if (CountNum % pageSize == 0)
                {
                    pageNum = CountNum / pageSize;
                }
            }
            var json = Json(new
            {
                data      = user,
                pageNums  = pageNum,
                CountNums = CountNum,
                pageSizes = pageSize
            }, JsonRequestBehavior.AllowGet);

            return(json);
        }
Пример #4
0
        public ActionResult getTreeView()
        {
            List <DX_MenusEx> menusExList = new List <DX_MenusEx>();

            string currentUser = GetCurrentUser();

            using (BizDbContext bizDb = new BizDbContext())
            {
                List <DX_Menus> parentMenus = bizDb.DX_Menus.Where(me => me.ParentId <= 0 && me.IsDeleted == false && me.IsEnable == true).ToList();

                foreach (DX_Menus pmenus in parentMenus)
                {
                    DX_MenusEx menusEx = new DX_MenusEx();
                    menusEx.Id         = pmenus.Id;
                    menusEx.MenuChName = pmenus.MenuChName;
                    menusEx.MenuEnName = pmenus.MenuEnName;
                    menusEx.MenuIcon   = pmenus.MenuIcon;
                    menusEx.MenuLevel  = pmenus.MenuLevel;

                    menusEx.ParentId  = pmenus.ParentId;
                    menusEx.CreatedOn = pmenus.CreatedOn;
                    menusEx.CreatedBy = pmenus.CreatedBy;
                    menusEx.UpdatedOn = pmenus.UpdatedOn;
                    menusEx.UpdatedBy = pmenus.UpdatedBy;
                    menusEx.IsDeleted = pmenus.IsDeleted;
                    menusEx.IsEnable  = pmenus.IsEnable;
                    menusEx.SortBy    = pmenus.SortBy;
                    List <DX_Menus> childMenus = bizDb.DX_Menus.Where(me => me.ParentId == pmenus.Id && me.IsDeleted == false && me.IsEnable == true).ToList();
                    menusEx.DXMenus = childMenus;
                    //如果包含子菜单项,则修改父项的显示方式和地址:地址为空,点击时,不进行页面切换
                    menusEx.LinkAddress = childMenus.Count > 0 ? "" : pmenus.LinkAddress;
                    menusEx.MenuTarget  = childMenus.Count > 0 ? "_blank" : pmenus.MenuTarget;
                    menusExList.Add(menusEx);
                }
            }
            var json = Json(new
            {
                data = menusExList
            }, JsonRequestBehavior.AllowGet);

            return(json);
            //  return Json("11");
        }
Пример #5
0
 public DashboardController(BizDbContext context)
 {
     _context = context;
 }
Пример #6
0
 public UploadController(BizDbContext context)
 {
     _context = context;
 }