public ActionResult List() { T_ActivityAreaBll bll = new T_ActivityAreaBll(); var model = bll.GetList(); return(View(model)); }
public ActionResult AreaList() { T_ActivityAreaBll bll = new T_ActivityAreaBll(); var list = bll.GetList(); return(View(list)); }
//全国经销商活动场次统计 public Dictionary <string, object> GetAgencyStatisticsList() { T_SaleActivityTypeBll typebll = new T_SaleActivityTypeBll(); T_AgencyBll t_agencybll = new T_AgencyBll(); T_ActivityAreaBll areabll = new T_ActivityAreaBll(); var arealist = areabll.GetList(); var typelist = typebll.GetList(); var agencylist = t_agencybll.GetList(); string begintime = HttpContext.Current.Request.Form["begintime"].ToString(); string endtime = HttpContext.Current.Request.Form["endtime"].ToString(); string areaid = HttpContext.Current.Request.Form["areaid"].ToString(); string strwhere = "IsDelete=0"; if (!string.IsNullOrEmpty(begintime)) { strwhere += " and ActivityDate>='" + begintime + "'"; } if (!string.IsNullOrEmpty(endtime)) { strwhere += " and ActivityDate<='" + endtime + "'"; } if (!string.IsNullOrEmpty(areaid)) { strwhere += " and saleactivitytypeid=" + areaid; } else { strwhere += " and saleactivitytypeid=" + arealist[0]; } string date = DateTime.Now.Year.ToString() + "-01-01"; int indexmonth = DateTime.Now.Month; var listmonth = new List <int>(); for (int i = 1; i < indexmonth + 1; i++) { listmonth.Add(i); } var database = DataFactory.Database(); var dsaverage = database.FindDataSetBySql("select DATEPART(month, ActivityDate) as nmonth,agencyid,saleactivitytypeid from T_SaleActivity where datediff(year, ActivityDate, '" + date + "') = 0 group by AgencyId, DATEPART(month, ActivityDate),SaleActivityTypeId order by DATEPART(month, ActivityDate)"); List <AgencyStatisticsViewModel> listview = new List <AgencyStatisticsViewModel>(); foreach (var item in agencylist) { var model = new AgencyStatisticsViewModel(); model.AgencyName = item.AgencyName; model.AgencyId = item.AgencyId; List <Months> listmonthview = new List <Months>(); foreach (var item1 in listmonth) { var monthview = new Months(); monthview.Month = item1.ToString(); List <int> listid = new List <int>(); var dsselect = dsaverage.Tables[0].Select("nmonth=" + item1.ToString() + " and agencyid=" + item.AgencyId + ""); foreach (var item2 in dsselect) { if (!listid.Contains(int.Parse(item2["saleactivitytypeid"].ToString()))) { listid.Add(int.Parse(item2["saleactivitytypeid"].ToString())); } } monthview.SaleActivityTypeIdList = listid; listmonthview.Add(monthview); } model.listmonth = listmonthview; listview.Add(model); } return(new Dictionary <string, object> { { "code", 1 }, { "typelist", typelist.Select(a => new { saleactivitytypeid = a.SaleActivityTypeId, saleactivitytypename = a.SaleActivityTypeName }) }, { "agencylist", agencylist.Select(a => new { agencyid = a.AgencyId, agencyname = a.AgencyName }) }, { "list", listview }, { "monthlist", listmonth }, { "arealist", arealist } }); }