Ejemplo n.º 1
0
        public JsonResult LineChart(string type)
        {
            //WFMDBDataContext db = new WFMDBDataContext();
            WFMDBDataContext db = new WFMDBDataContext(string.Format(System.Configuration.ConfigurationManager.ConnectionStrings["SpecialConnection"].ConnectionString, DBServer));
            List<tblChart> lstCalls = db.uspWFMGetHistoryInboundCallForChart(this.TenantID, type).ToList();
            LineChart line = new LineChart();
            List<Dataset> datasets = new List<Dataset>();
            Dataset inCallDs = new Dataset();
            Dataset inCompletedCallDs = new Dataset();
            string lables = "";
            int[] dataInCalls = new int[lstCalls.Count];
            int[] dataCompleteds = new int[lstCalls.Count];
            int index = 0;
            foreach (var item in lstCalls)
            {
                lables += "," + item.dtCreatedCall.ToString("MM/dd")+"("+AppConst.Const_Weekday[Convert.ToInt16(item.dtCreatedCall.DayOfWeek)]+")";
                dataInCalls[index] = item.iCountOfInboundCall;
                dataCompleteds[index] = item.iCountOfCompletedInCall;
                index++;
            }
            line.labels = lables.Substring(1).Split(',');

            inCallDs.data = dataInCalls;
            inCallDs.fillColor = "rgba(151,187,205,0.2)";
            inCallDs.strokeColor = "rgba(151,187,205,1)";
            inCallDs.pointColor = "rgba(151,187,205,1)";
            inCallDs.pointStrokeColor = "#fff";
            inCallDs.label = "総着信";

            inCompletedCallDs.data = dataCompleteds;
            inCompletedCallDs.fillColor = "rgba(220,220,220,0.5)";
            inCompletedCallDs.strokeColor = "rgba(220,220,220,1)";
            inCompletedCallDs.pointColor = "rgba(220,220,220,1)";
            inCompletedCallDs.pointStrokeColor = "#fff";
            inCompletedCallDs.label = "完了呼";

            datasets.Add(inCallDs);
            datasets.Add(inCompletedCallDs);
            line.datasets = datasets;

            return this.Json(line, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 2
0
        public JsonResult LineChart(string date,int shiftId,int skillGroupid,int skillAggregationId)
        {
            WFMDBDataContext db = new WFMDBDataContext();
            List<tblChart> lstCalls = db.uspWFMGetPredictionAndActualInboundCallForChart(this.TenantID, date, shiftId, skillGroupid, skillAggregationId).ToList();
            LineChart line = new LineChart();
            List<Dataset> datasets = new List<Dataset>();
            Dataset inCallDs = new Dataset();
            Dataset inCompletedCallDs = new Dataset();
            string lables = "";
            int[] dataInCalls = new int[lstCalls.Count];
            int[] dataCompleteds = new int[lstCalls.Count];
            int index = 0;
            foreach (var item in lstCalls)
            {
                lables += "," + item.dtCreatedCall.ToString("HH:mm");
                dataInCalls[index] = item.iCountOfInboundCall;
                dataCompleteds[index] = item.iCountOfCompletedInCall;
                index++;
            }
            if (!string.IsNullOrEmpty(lables))
                line.labels = lables.Substring(1).Split(',');

            inCallDs.data = dataInCalls;
            inCallDs.fillColor = "rgba(151,187,205,0.2)";
            inCallDs.strokeColor = "rgba(151,187,205,1)";
            inCallDs.pointColor = "rgba(151,187,205,1)";
            inCallDs.pointStrokeColor = "#fff";
            inCallDs.label = "実績";

            inCompletedCallDs.data = dataCompleteds;
            inCompletedCallDs.fillColor = "rgba(220,220,220,0.5)";
            inCompletedCallDs.strokeColor = "rgba(220,220,220,1)";
            inCompletedCallDs.pointColor = "rgba(220,220,220,1)";
            inCompletedCallDs.pointStrokeColor = "#fff";
            inCompletedCallDs.label = "予測";

            datasets.Add(inCallDs);
            datasets.Add(inCompletedCallDs);
            line.datasets = datasets;

            return this.Json(line, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 3
0
        //public JsonResult LineChart(string txtTargetDate, int ddlShift, int Interval, int agentCount)
        //{
        //    WFMDBDataContext db = new WFMDBDataContext();
        //    List<tblChart> lstCalls = db.uspWFMGetMinInboundCallPrediction(this.TenantID, txtTargetDate, txtTargetDate, ddlShift, Interval, 0, 0).ToList();
        //    LineChart line = new LineChart();
        //    List<Dataset> datasets = new List<Dataset>();
        //    Dataset inCallDs = new Dataset();
        //    string lables = "";
        //    int[] datas = new int[lstCalls.Count];
        //    int index = 0;
        //    foreach (var item in lstCalls)
        //    {
        //        lables += "," + item.dtCreatedCall.ToString("HH:mm");
        //        datas[index] = item.iCountOfInboundCall;
        //        index++;
        //    }
        //    inCallDs.data = datas;
        //    line.labels = lables.Substring(1).Split(',');
        //    inCallDs.fillColor = "rgba(151,187,205,0.2)";
        //    inCallDs.strokeColor = "rgba(151,187,205,1)";
        //    inCallDs.pointColor = "rgba(151,187,205,1)";
        //    inCallDs.pointStrokeColor = "#fff";
        //    inCallDs.label = "予測着信数";
        //    datasets.Add(inCallDs);
        //    line.datasets = datasets;
        //    HttpRuntime.Cache.Insert("chatLine", lstCalls);
        //    return this.Json(line, JsonRequestBehavior.AllowGet);
        //}
        public JsonResult LineChartForAgent(string txtTargetDate, int ddlShift, int Interval, int agentCount,bool needRefresh)
        {
            var cacheValue = HttpRuntime.Cache.Get("chatLine");
            List<tblChart> lstCalls = null;
            if (cacheValue == null || needRefresh)
            {
                WFMDBDataContext db = new WFMDBDataContext();
                lstCalls = db.uspWFMGetMinInboundCallPrediction(this.TenantID, txtTargetDate, txtTargetDate, ddlShift, Interval, 0, 0).ToList();
            }
            else
            {
                lstCalls = cacheValue as List<tblChart>;
            }

            LineChart line = new LineChart();
            List<Dataset> datasets = new List<Dataset>();
            Dataset inCallDs = new Dataset();
            Dataset zero = new Dataset();
            string lables = "";
            int[] datas = new int[lstCalls.Count];
            int[] zeroDatas = new int[lstCalls.Count];
            int index = 0;
            foreach (var item in lstCalls)
            {
                lables += "," + item.dtCreatedCall.ToString("HH:mm");
                datas[index] = item.iCountOfInboundCall - agentCount;
                zeroDatas[index] = 0;
                index++;
            }

            inCallDs.data = datas;
            line.labels = lables.Substring(1).Split(',');

            inCallDs.fillColor = "rgba(151,187,205,0.2)";
            inCallDs.strokeColor = "rgba(151,187,205,1)";
            inCallDs.pointColor = "rgba(151,187,205,1)";
            inCallDs.pointStrokeColor = "#fff";
            inCallDs.label = "予測着信数";

            zero.data = zeroDatas;
            zero.fillColor = "rgba(255,0,0,1)";
            zero.strokeColor = "rgba(255,0,0,1)";
            zero.pointColor = "rgba(255,0,0,1)";
            zero.pointStrokeColor = "#FF0";
            zero.label = "基准";
            datasets.Add(inCallDs);
            datasets.Add(zero);
            line.datasets = datasets;
            HttpRuntime.Cache.Insert("chatLine", lstCalls);
            return this.Json(line, JsonRequestBehavior.AllowGet);
        }