Beispiel #1
0
        public ActionResult Calendar(int?page, int?cid, int?orderid)
        {
            int oid = orderid ?? 1;

            AdsBaby baby = new AdsBaby();

            if (Session["CustomerId"] != null)
            {
                int id    = int.Parse(Session["CustomerId"].ToString());
                var babys = unitOfWork.adsBabysRepository.Get(filter: u => u.CustomerId == id && u.Babystatus == true);
                int count = babys.Count();
                if (count > 0)
                {
                    baby = babys.First() as AdsBaby;
                    ViewData["videocat"] = CategoryServices.GetCategoryListByParentID(2);
                    ViewBag.babyName     = baby.BabyName;
                    ViewBag.babyId       = baby.BabyId;
                    ViewBag.cepingcount  = StatisticsServices.GetCepingCountByBabyId(baby.BabyId);
                    ViewBag.pingjiacount = StatisticsServices.GetPingjiaCountByBabyId(baby.BabyId, 0);
                    ViewBag.days         = StatisticsServices.GetDaysByCustomerId(baby.BabyRegTime);

                    List <BaogaoDemention> demlist = PlanServices.PlanCategory(baby.BabyId);
                    if (demlist.Count() == 0)
                    {
                        return(RedirectToAction("NoScale", new { name = baby.BabyName }));
                    }

                    int categoryid = cid ?? demlist[0].demcategoryid;

                    Pager pager = new Pager();
                    pager.table      = "AdsVideo";
                    pager.strwhere   = "VideoCategory=" + categoryid;
                    pager.PageSize   = 15;
                    pager.PageNo     = page ?? 1;
                    pager.FieldKey   = "VideoId";
                    pager.FiledOrder = "VideoId desc";


                    pager = CommonDal.GetPager(pager);
                    IList <AdsVideo> videos = DataConvertHelper <AdsVideo> .ConvertToModel(pager.EntityDataTable);

                    var videosAsIPageList = new StaticPagedList <AdsVideo>(videos, pager.PageNo, pager.PageSize, pager.Amount);

                    ViewBag.orderid = oid;

                    if (oid == 1 || oid == 2)
                    {
                        ViewBag.ctitle    = "必修任务";
                        ViewBag.cminTitle = "每次需训练30分钟";
                    }
                    if (oid == 3 || oid == 4)
                    {
                        ViewBag.ctitle    = "选修任务";
                        ViewBag.cminTitle = "每次需训练20分钟";
                    }
                    if (oid == 5)
                    {
                        ViewBag.ctitle    = "一般任务";
                        ViewBag.cminTitle = "自行安排训练";
                    }
                    ViewData["dem"] = demlist;



                    return(View(videosAsIPageList));
                }
                else
                {
                    return(RedirectToAction("NoBaby"));
                }
            }
            else
            {
                return(RedirectToAction("Login"));
            }
        }