示例#1
0
        private void GetStatistic_Model_Chart(int count,  List<ViewModel_StatisticsLast10> list_statistics,out ViewModel_Statistics_Chart viewModel_chart)
        {
            int[] array_total = new int[count];
            int[] array_receive = new int[count];
            DateTime[] array_datetime = new DateTime[count];
            for (int i = 0; i < count; i++)
            {
                //if (list_statistics.Count > i)
                //{
                    array_total[i] = list_statistics[i].TotalOfReceiveNum;
                    array_receive[i] = list_statistics[i].TotalOfReceiveNum - list_statistics[i].NotReceiveNum;
                    array_datetime[i] = list_statistics[i].SendDateTime;
                //}
                //else
                //{
                //    array_total[i] = 0;
                //    array_receive[i] = 0;
                //    array_datetime[i] = DateTime.Now;
                //}

            }
            //3 转成datagrid识别的json格式数据
            viewModel_chart = new ViewModel_Statistics_Chart()
            {
                Array_total = array_total,
                Array_revice = array_receive,
                Arrat_DataTime = array_datetime
            };
        }
示例#2
0
        /// <summary>
        /// 获取该用户的发送的最后10条短信统计对象(使用图表的方式)
        /// </summary>
        /// <returns></returns>
        public ActionResult GetStatisticLast10_Chart()
        {
            //1 获取当前登录的用户4
            var userInfo = base.LoginUser;
            var userTemp = userBLL.GetListBy(u => u.ID == userInfo.ID).FirstOrDefault();

            //2 获取该用户所发送的短信内容——只获取发送最近的前十条短信
            var list_last10 = userTemp.S_SMSContent.OrderByDescending(c => c.SendDateTime).Take(10).ToList();

            List<ViewModel_StatisticsLast10> list_statisticslast10 = new List<ViewModel_StatisticsLast10>();
            //2.1 将短信内容实体对象集合转成要在datagrid中显示的统计对象集合
            //2.2 需要统计该短信发送的人员个数以及未收到的人员个数
            GetStatisticList(list_last10, ref list_statisticslast10);

            var model = new ViewModel_Statistics_Chart();
            GetStatistic_Model_Chart(list_statisticslast10.Count, list_statisticslast10, out model);

            //4 序列化
            return Content(Common.SerializerHelper.SerializerToString(model));
        }