public ActionResult getCounty(int?year)
        {
            if (year == null)
            {
                year = DateTime.Now.Year;
            }
            CountyDao dao    = new CountyDao();
            var       county = dao.getByLevel((int)Level.County);

            dao.Dispose();
            if (county.Count == 0)
            {
                throw new ApplicationException("未找到县区");
            }
            List <ChartData> list = new List <ChartData>();
            PetitionDao      dao2 = new PetitionDao();

            foreach (var item in county)
            {
                ChartData chart = new ChartData();
                chart.name  = item.Name;
                chart.value = dao2.getCountByParentAndYear(item.Id, year.Value);
                list.Add(chart);
            }
            dao2.Dispose();
            return(Json(list, JsonRequestBehavior.AllowGet));
        }
        public ActionResult getxAxis(int?type)
        {
            if (type == null)
            {
                throw new ApplicationException("统计类型不正确");
            }
            List <string> list = new List <string>();

            if (type == StatisticsType.County)      //县区
            {
                CountyDao dao = new CountyDao();
                list = dao.getByLevel((int)Level.County).Select(t => t.Name).ToList();
                dao.Dispose();
            }
            else if (type == StatisticsType.Category)     //类别
            {
                CategoryDao dao = new CategoryDao();
                list = dao.getAll(null).Select(t => t.Name).ToList();
                dao.Dispose();
            }
            else
            {
                throw new ApplicationException("未知类型");
            }
            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        /// <summary>
        /// 县区下拉表数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetCountyList()
        {
            CountyDao     dao     = new CountyDao();
            List <County> countys = dao.getByLevel((int)Level.County);

            dao.Dispose();
            return(Json(countys, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        /// <summary>
        /// 乡镇下拉表数据
        /// </summary>
        /// <param name="county"></param>
        /// <returns></returns>
        public ActionResult GetTown(string county)
        {
            if (string.IsNullOrEmpty(county))
            {
                throw new ApplicationException("未选择县区");
            }
            CountyDao     dao  = new CountyDao();
            List <County> list = dao.getChildren(county);

            dao.Dispose();
            return(Json(list, JsonRequestBehavior.AllowGet));
        }