Beispiel #1
0
        public ActionResult Index(string snam, string orgid, string orgnam, int pageIndex = 1, int pageSize = 20)
        {
            ViewBag.SNAM   = snam;
            ViewBag.ORGID  = orgid;
            ViewBag.ORGNAM = orgnam;
            var orgall = new SYS_USER_DAL().GetUserORG(UserState.UserID);

            if (string.IsNullOrEmpty(orgid) && orgall != null)
            {
                orgid = orgall.FirstOrDefault(obj => obj.ORG_LEVEL == 4).ORG_ID;
            }

            ViewBag.UserORG = new SelectList(orgall.Where(obj => obj.ORG_LEVEL == 4)
                                             , "ORG_ID", "ORG_NAM", orgid);

            var orgs = orgall.Select(obj => obj.ORG_ID);

            if (!string.IsNullOrEmpty(orgid))
            {
                orgs = orgs.Where(obj => obj == orgid);
                if (null == orgs || orgs.Count() == 0)
                {
                    orgs = new List <string> {
                        "-1"
                    };
                }
            }
            var halllist = DaoHall.FindList("", "ORG_ID in", orgs);

            var data = dao.GetList(pageIndex, pageSize, "Q_ID desc", "Q_SERIALNAME like", snam, "Q_SYSNO in", null == halllist ? null : halllist.Select(obj => obj.HALL_NO));

            if (data != null && data.Items != null)
            {
                halllist = DaoHall.FindList();
                var orglist = DaoOrganize.FindList();
                foreach (var item in data.Items)
                {
                    item.Hall = halllist.FirstOrDefault(obj => obj.HALL_NO == item.Q_SYSNO);
                    item.Org  = orglist.FirstOrDefault(obj => obj.ORG_ID == item.Hall.ORG_ID);
                }
            }
            return(View(data));
        }
Beispiel #2
0
        public ActionResult Index(string nam, string orgid, string orgnam, int?stafftype, int pageIndex = 1, int pageSize = 20)
        {
            ViewBag.NAM      = nam;
            ViewBag.ORGID    = orgid;
            ViewBag.ORGNAM   = orgnam;
            ViewBag.STAFFTYP = stafftype;
            var orgall = new SYS_USER_DAL().GetUserORG(UserState.UserID);

            if (string.IsNullOrEmpty(orgid) && orgall != null)
            {
                orgid = orgall.FirstOrDefault(obj => obj.ORG_LEVEL == 4).ORG_ID;
            }
            ViewBag.UserORG = new SelectList(orgall.Where(obj => obj.ORG_LEVEL == 4)
                                             , "ORG_ID", "ORG_NAM", orgid);

            GetCreateDT(orgid);

            var orgs = orgall.Select(obj => obj.ORG_ID);

            if (!string.IsNullOrEmpty(orgid))
            {
                orgs = orgs.Where(obj => obj == orgid);
                if (null == orgs || orgs.Count() == 0)
                {
                    orgs = new List <string> {
                        "-1"
                    };
                }
            }
            var data = dao.GetList(pageIndex, pageSize, "", "STAFF_NAM like", nam
                                   , "ORG_ID in", orgs, "STAFF_TYP", stafftype);
            var orglist = DaoOrganize.FindList();

            foreach (var item in data.Items)
            {
                item.ORG = orglist.FirstOrDefault(obj => obj.ORG_ID == item.ORG_ID);
            }

            return(View(data));
        }