Example #1
0
        public ActionResult ClubTypeList()
        {
            C_ClubActivityTypeBll bll = new C_ClubActivityTypeBll();
            var list = bll.GetList();

            return(View(list));
        }
        public Dictionary <string, object> GetEveryMonthClubAverageCost()
        {
            C_ClubActivityTypeBll typebll = new C_ClubActivityTypeBll();
            var    typelist   = typebll.GetList();
            string date       = DateTime.Now.Year.ToString() + "-01-01";
            var    database   = DataFactory.Database();
            int    indexmonth = DateTime.Now.Month;
            var    listmonth  = new List <int>();

            for (int i = 1; i < indexmonth + 1; i++)
            {
                listmonth.Add(i);
            }
            //车主俱乐部活动按照类型统计每月平均成本价格
            var dsaverage     = database.FindDataSetBySql("select clubactivitytypeid, DATEPART(month, ActivityDate) as nmonth, sum(ActivityCost) / count(ClubActivityInfoId)  as costaverage from C_ClubActivityInfo   where datediff(year, ActivityDate, '" + date + "') = 0 group by ClubActivityTypeId, DATEPART(month, ActivityDate) order by DATEPART(month, ActivityDate)");
            var dsaveragelist = database.FindDataSetBySql("select DATEPART(month, ActivityDate) as nmonth, sum(ActivityCost) / count(ClubActivityInfoId)  as costaverage from C_ClubActivityInfo   where datediff(year, ActivityDate, '" + date + "') = 0 group by DATEPART(month, ActivityDate) order by DATEPART(month, ActivityDate)");

            return(new Dictionary <string, object>
            {
                { "code", 1 },
                { "typelist", typelist.Select(a => new { saleactivitytypeid = a.ClubActivityTypeId, saleactivitytypename = a.ClubActivityTypeName }) },
                { "averagelist", dsaverage.Tables[0] },
                { "allaveragelist", dsaveragelist },
                { "monthlist", listmonth }
            });
        }
Example #3
0
        public ActionResult ClubTypeAdd()
        {
            var model = new C_ClubActivityType();
            var bll   = new C_ClubActivityTypeBll();

            if (Request.QueryString["TypeId"] != null)
            {
                model = bll.GetModel(int.Parse(Request.QueryString["TypeId"].ToString()));
            }
            else
            {
                model.IsShow = 1;
            }
            return(View(model));
        }