示例#1
0
        public ActionResult OtherIndex(DateTime?beginTime, DateTime?endTime, string orgid, int pageIndex = 1, int pageSize = 20, bool export = false)
        {
            base.DateTimeInit(ref beginTime, ref endTime);

            ViewBag.beginTime = beginTime == null ? "" : beginTime.Value.ToString("yyyy-MM-dd");
            ViewBag.endTime   = endTime == null ? "" : endTime.Value.ToString("yyyy-MM-dd");
            var t = 3;//员工报表

            ViewBag.NAM = "员工";
            if (string.IsNullOrEmpty(Request.QueryString["t"]) ||
                !int.TryParse(Request.QueryString["t"], out t))
            {
                t = 1;
            }
            if (t == 1)
            {
                ViewBag.NAM     = "省市";
                ViewBag.NAMLink = "/STAT/statstaffqueuebusid/otherindex?t=2";//如果是省级,点击进入市级
            }
            if (t == 2)
            {
                ViewBag.NAM     = "服务厅";
                ViewBag.NAMLink = "/STAT/statstaffqueuebusid/otherindex?t=3"; //如果是省级,点击进入员工报表
            }
            if (GetHighLV == model.Enums.UserLV_ENUM.市级 && t < 2)             //判断是否有权限
            {
                return(Redirect("/STAT/statstaffqueuebusid/otherindex?t=2"));
            }
            if (GetHighLV == model.Enums.UserLV_ENUM.区级 && t < 2)//判断是否有权限
            {
                return(Redirect("/STAT/statstaffqueuebusid/otherindex?t=2"));
            }
            if (GetHighLV == model.Enums.UserLV_ENUM.务厅级 && t < 3) //判断是否有权限
            {
                return(Redirect("/STAT/statstaffqueuebusid/otherindex?t=3"));
            }
            if (GetHighLV == model.Enums.UserLV_ENUM.无权限)//判断是否有权限
            {
                return(NoAuth);
            }
            var re     = base.UserHall;
            var orgall = new SYS_USER_DAL().GetUserORG(UserState.UserID);

            ViewBag.UserORG = new SelectList(orgall.Where(obj => obj.ORG_LEVEL == 4)
                                             , "ORG_ID", "ORG_NAM", orgid);
            if (!string.IsNullOrEmpty(orgid))
            {
                orgall = orgall.Where(obj => obj.ORG_ID == orgid).ToList();
                if (null == orgall || orgall.Count() == 0)
                {
                    orgall = new List <SYS_ORGANIZE> {
                        new SYS_ORGANIZE {
                            ORG_ID = "-1"
                        }
                    };
                }
            }

            if (export)
            {
                pageIndex = 0;
            }
            List <dynamic> data = null;

            if (t == 1)
            {
                data = new STAT_STAFF_QUEUE_BUSI_D_DAL().Q_STATDATA_GROUP_CITY(null, beginTime, endTime, t);
            }
            if (t == 2)
            {
                var halllist = new SYS_HALL_DAL().GetOrgHallAndChild(orgid).ToArray();
                data = new STAT_STAFF_QUEUE_BUSI_D_DAL().Q_STATDATA_GROUP_CITY(halllist, beginTime, endTime, t);
            }
            if (t == 3)
            {
                var halllist = new SYS_HALL_DAL().GetOrgHallAndChild(orgid).ToArray();
                data = new STAT_STAFF_QUEUE_BUSI_D_DAL().Q_STATDATA_GROUP_CITY(halllist, beginTime, endTime, t);
            }
            string subTitle = "";

            if (beginTime == null && endTime == null)
            {
                subTitle = GetSubTitle(orgid, data.Select(o => o.MIN_STAT_DT).Min(), data.Select(o => o.MAX_STAT_DT).Max());
            }
            else
            {
                subTitle = GetSubTitle(orgid, beginTime, endTime);
            }
            ViewBag.subTitle = subTitle;
            if (export)//导出
            {
                string xlnam = "人流量对比分析-省市";
                if (t == 2)
                {
                    xlnam = "人流量对比分析-服务厅";
                }
                if (t == 3)
                {
                    xlnam = "人流量对比分析-排队业务";
                }
                return(ExportData(xlnam, subTitle, data));
            }
            else
            {
                subTitle = subTitle.Replace("<span style='font-size:12px;'>", "")
                           .Replace("</span>", "").Replace("人流量对比分析", "");
                DataTable dtCHART = null;
                dtCHART = GroupByNAM(data, t);
                ViewBag.ChartColumn3DXML = CreateMSColumn3DChart("人流量对比分析", dtCHART, 420, subTitle, true);
                ViewBag.ChartSplineXML   = CreateMSSplineChart("人流量对比分析", dtCHART, 420, null, null, subTitle);
                var page = new Page <dynamic>()
                {
                    Items = data.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(), ItemsPerPage = pageSize, CurrentPage = pageIndex, TotalItems = data.Count
                };

                return(View(page));
            }
        }