Пример #1
0
        public ActionResult DepartmentLimit(int departmentid)
        {
            //List<IGrouping<int, V_DepUserLimitInfo>> groupList = ef.V_DepUserLimitInfo.Where(a => a.isDel == 0 && (a.departmentId==departmentid || a.departmentId==null)).GroupBy(m => m.ParentId).ToList();
            //Dictionary<int, List<V_DepUserLimitInfo>> dic = new Dictionary<int, List<V_DepUserLimitInfo>>();

            //List<IGrouping<int, hx_AdminLimitInfo>> groupList = ef.hx_AdminLimitInfo.Where(a => a.isDel == 0).GroupBy(m => m.ParentId).ToList();
            //Dictionary<int, List<hx_AdminLimitInfo>> dic = new Dictionary<int, List<hx_AdminLimitInfo>>();


            //if (groupList != null && groupList.Count() > 0)
            //{
            //    foreach (var item in groupList)
            //    {
            //        dic.Add(item.Key, item.ToList());
            //    }
            //}


            hx_td_department dep = (from a in ef.hx_td_department where a.department_id == departmentid select a).SingleOrDefault();

            if (dep == null || dep.department_id < 1)
            {
                return(Content(StringAlert.Alert("没有找到对应的部门信息!"), "text/html"));
            }

            Dictionary <int, List <hx_AdminLimitInfo> > dic = new ChuanglitouP2P.BLL.EF.UserLimitByEF().GetDepartmentLimit((int)dep.parentid);

            ViewBag.departmentid = departmentid;

            return(View(dic));
        }
Пример #2
0
        public ActionResult UserLimit(int userid)
        {
            Dictionary <int, List <hx_AdminLimitInfo> > dic = new Dictionary <int, List <hx_AdminLimitInfo> >();
            hx_td_adminuser user = (from u in ef.hx_td_adminuser where u.adminuserid == userid select u).SingleOrDefault();

            if (user == null || user.adminuserid < 1)
            {
                return(Content(StringAlert.Alert("没有找到相关的用户信息!"), "text/html"));
            }
            ////var sql = string.Format("", user.department_id);
            //StringBuilder sql = new StringBuilder();
            //sql.Append("WITH treeTB(id) as(");
            //sql.AppendFormat("select limitId from hx_DepUserLimit where departmentId='{0}' ", user.department_id);
            //sql.Append(" union all ");
            //sql.Append("select ParentId from hx_AdminLimitInfo inner join treeTB ON hx_AdminLimitInfo.id=treeTB.id)");
            //sql.Append("select * from treeTB;");
            //DataTable dt = DbHelperSQL.GET_DataTable_List(sql.ToString());

            //if (dt != null && dt.Rows.Count > 0)
            //{
            //    string ids = "";
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        if (ids.Length>0)
            //        {
            //            ids = ids + ",";
            //        }
            //        ids = ids + dr["id"].ToString();
            //    }

            //    List<IGrouping<int, hx_AdminLimitInfo>> groupList = ef.hx_AdminLimitInfo.Where(a => a.isDel == 0 && ids.Contains(a.id.ToString())).GroupBy(m => m.ParentId).ToList();
            //    dic = new Dictionary<int, List<hx_AdminLimitInfo>>();


            //    if (groupList != null && groupList.Count() > 0)
            //    {
            //        foreach (var item in groupList)
            //        {
            //            dic.Add(item.Key, item.ToList());
            //        }
            //    }
            //}
            dic = new ChuanglitouP2P.BLL.EF.UserLimitByEF().GetDepartmentLimit((int)user.department_id);


            ViewBag.userid        = userid;
            ViewBag.department_id = user.department_id;

            return(View(dic));
        }