Exemplo n.º 1
0
        public JsonResult GetAreaMapBySearch(int dimension, int year = 0, int month = 0)
        {
            if (year == 0)
            {
                year = DateTime.Now.Year;
            }
            if (month == 0)
            {
                month = DateTime.Now.Month;
            }
            var data = StatisticApplication.GetAreaOrderChart((OrderDimension)dimension, year, month);

            return(Json(new { successful = true, chart = data }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult ExportAreaMap(int year = 0, int month = 0, DateTime?begin = null, DateTime?end = null)
        {
            MapChartDataModel <decimal> orderCounts  = new MapChartDataModel <decimal>();
            MapChartDataModel <decimal> orderAmounts = new MapChartDataModel <decimal>();
            var title = string.Empty;

            if (begin.HasValue && end.HasValue)
            {
                orderCounts  = StatisticApplication.GetAreaOrderChart(SaleDimension.Count, begin.Value, end.Value);
                orderAmounts = StatisticApplication.GetAreaOrderChart(SaleDimension.Amount, begin.Value, end.Value);
                title        = string.Format("区域统计_{0}至{1}", begin.Value.ToString("yyyy-MM-dd"), end.Value.ToString("yyyy-MM-dd"));
            }
            else
            {
                if (year == 0)
                {
                    year = DateTime.Now.Year;
                }
                if (month == 0)
                {
                    month = DateTime.Now.Month;
                }
                orderCounts  = StatisticApplication.GetAreaOrderChart(SaleDimension.Count, year, month);
                orderAmounts = StatisticApplication.GetAreaOrderChart(SaleDimension.Amount, year, month);
                title        = string.Format("区域统计_{0}年{1}月", year, month);
            }
            var list = new List <AreaMapExportSubModel>();

            for (int i = 0; i < orderCounts.Data.Count; i++)
            {
                list.Add(new AreaMapExportSubModel
                {
                    RegionName  = orderCounts.Data[i].Name,
                    OrderCount  = (int)orderCounts.Data[i].Value,
                    OrderAmount = orderAmounts.Data[i].Value
                });
            }
            ViewData.Model = list;
            ViewData.Add("Title", title);
            string viewHtml = RenderPartialViewToString(this, "ExportAreaMap");

            return(File(System.Text.Encoding.UTF8.GetBytes(viewHtml), "application/ms-excel", title + ".xls"));
        }
Exemplo n.º 3
0
 public JsonResult GetAreaMapBySearch(SaleDimension dimension, int year = 0, int month = 0, DateTime?begin = null, DateTime?end = null)
 {
     if (begin.HasValue && end.HasValue)
     {
         end = end.Value.AddDays(1);
         var data = StatisticApplication.GetAreaOrderChart(dimension, begin.Value, end.Value);
         return(Json(new { success = true, chart = data }, true));
     }
     else
     {
         if (year == 0)
         {
             year = DateTime.Now.Year;
         }
         if (month == 0)
         {
             month = DateTime.Now.Month;
         }
         var data = StatisticApplication.GetAreaOrderChart(dimension, year, month);
         return(Json(new { success = true, chart = data }, true));
     }
 }