コード例 #1
0
        public ActionResult Index(DateTime?beginTime, DateTime?endTime, string orgid, int pageIndex = 1, int pageSize = 20, bool export = false)
        {
            CHK_AUTH();                                    //判断权限
            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");
            ViewBag.NAM       = LV.ToString();
            var userorg = DalUser.GetUserORG(UserState.UserID);

            ViewBag.UserORG = new SelectList(userorg.Where(obj => obj.ORG_LEVEL == 4)
                                             , "ORG_ID", "ORG_NAM", orgid);
            if (LV == ENUM_STATLV.省市)
            {
                ViewBag.NAMLink = "/STAT/StatStaffCall?t=2";//如果是省级,点击进入市级
            }
            if (LV == ENUM_STATLV.务厅)
            {
                ViewBag.NAMLink = "/STAT/StatStaffCall?t=3";//如果是省级,点击进入员工报表
            }
            string subTitle = GetStatTitle(orgid, beginTime, endTime);

            ViewBag.subTitle = subTitle;

            List <dynamic> data = null;

            if (LV == ENUM_STATLV.省市)
            {
                data = new STAT_STAFF_BUSI_TOT_D_DAL().Q_STATDATA_GROUP_CITY(null, beginTime, endTime);
            }
            if (LV == ENUM_STATLV.务厅)
            {
                var halllist = new SYS_HALL_DAL().GetOrgHallAndChild(orgid).ToArray();
                data = new STAT_STAFF_BUSI_TOT_D_DAL().Q_STATDATA_GROUP_HALL(halllist, beginTime, endTime);
            }
            if (LV == ENUM_STATLV.员工)
            {
                var halllist = new SYS_HALL_DAL().GetOrgHallAndChild(orgid).ToArray();
                data = new STAT_STAFF_BUSI_TOT_D_DAL().Q_STATDATA_GROUP_STAFF(halllist, beginTime, endTime);
            }

            if (export)//导出
            {
                return(ExportData(StatNAM + "-" + LV.ToString(), subTitle, data));
            }
            else
            {
                DataSet   ds = new DataSet();
                DataTable dt = new DataTable();
                ds.Tables.Add(dt);
                dt.Columns.Add("NAM", typeof(string));
                dt.Columns.Add("呼叫量,P", typeof(string));
                dt.Columns.Add("办理量,P", typeof(string));
                dt.Columns.Add("弃号量,S", typeof(string));
                foreach (var item in data)
                {
                    DataRow r = dt.NewRow();
                    r["NAM"]   = item.NAM;
                    r["呼叫量,P"] = item.CALL_CNT + ";JavaScript:showCNT(\\\"CALLCNT\\\", \\\"" + Request.QueryString["orgid"] + "\\\")";
                    r["办理量,P"] = item.HANDLE_CNT + ";JavaScript:showCNT(\\\"HANDLECNT\\\", \\\"" + Request.QueryString["orgid"] + "\\\")";
                    r["弃号量,S"] = item.ABANDON_CNT + ";JavaScript:showCNT(\\\"ABANDONCNT\\\", \\\"" + Request.QueryString["orgid"] + "\\\")";
                    dt.Rows.Add(r);
                }
                subTitle = subTitle.Replace("<span style='font-size:12px;'>", "")
                           .Replace("</span>", "").Replace(StatNAM, "");
                ViewBag.ChartColumn3DXML = CreateMSColumn3DChart(StatNAM, ds.Tables[0], 420, subTitle, true);
                ViewBag.ChartSplineXML   = CreateMSSplineChart(StatNAM, ds, 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("Index", page));
            }
        }