public ActionResult MemberCenter() { if (Session["CustomerId"] != null) { int id = int.Parse(Session["CustomerId"].ToString()); AdsCustomer customer = unitOfWork.adsCustomersRepository.GetByID(id); AdsBaby baby = new AdsBaby(); 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; ViewBag.baby = true; } else { ViewBag.baby = false; } return(View(customer)); } else { return(RedirectToAction("Login")); } }
public ActionResult DeleteConfirmed(int id) { AdsBaby adsbaby = db.AdsBabys.Find(id); db.AdsBabys.Remove(adsbaby); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "BabyId,CustomerId,BabyName,BabyAvatar,BabySex,BabyBirthday,BabyRegTime,BabyExpiredTime")] AdsBaby adsbaby) { if (ModelState.IsValid) { db.Entry(adsbaby).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(adsbaby)); }
public ActionResult Create([Bind(Include = "BabyId,CustomerId,BabyName,BabyAvatar,BabySex,BabyBirthday,BabyRegTime,BabyExpiredTime")] AdsBaby adsbaby) { if (ModelState.IsValid) { db.AdsBabys.Add(adsbaby); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(adsbaby)); }
public ActionResult BaogaoDetail(int id) { Baogao baogao = unitOfWork.baogaoRepository.GetByID(id); AdsBaby baby = unitOfWork.adsBabysRepository.GetByID(baogao.BabyId); // string babyName = unitOfWork.adsBabysRepository.GetByID(baogao.BabyId).BabyName; string str = baogao.BaogaoDementionScore; string[] sArray = str.Split(','); List <BaogaoDemention> demlist = new List <BaogaoDemention>(); string chartscategories = "["; string chartsdata = "["; foreach (string s in sArray) { // string dem=s.ToString(); BaogaoDemention dem = new BaogaoDemention(); dem.demName = s.Substring(0, s.IndexOf(":")); dem.demScore = int.Parse(s.Substring(s.IndexOf(":") + 1)); if (dem.demName == "感觉能力") { dem.demReference = 30; } if (dem.demName == "交往能力") { dem.demReference = 44; } if (dem.demName == "运动能力") { dem.demReference = 29; } if (dem.demName == "语言能力") { dem.demReference = 31; } if (dem.demName == "自理能力") { dem.demReference = 25; } demlist.Add(dem); chartscategories = chartscategories + "\"" + dem.demName + "\"" + ","; chartsdata = chartsdata + dem.demScore + ","; } chartscategories = chartscategories.TrimEnd(',') + "]"; chartsdata = chartsdata.TrimEnd(',') + "]"; ViewData["dem"] = demlist; ViewBag.categories = chartscategories; ViewBag.chartsdata = chartsdata; ViewBag.babyName = baby.BabyName; ViewBag.babysex = baby.BabySex; ViewBag.babyage = DateTime.Now.Year - Convert.ToDateTime(baby.BabyBirthday).Year; return(View(baogao)); }
public ActionResult StarBabyEdit(int id) { if (Session["CustomerId"] != null) { AdsBaby baby = unitOfWork.adsBabysRepository.GetByID(id); ViewData["customerid"] = Session["CustomerId"].ToString(); return(View(baby)); } else { return(RedirectToAction("Login")); } }
public ActionResult StarBabyPay(int bid) { if (Session["CustomerId"] != null) { AdsBaby baby = unitOfWork.adsBabysRepository.GetByID(bid); return(View(baby)); } else { return(RedirectToAction("Login")); } }
// GET: /AdsBaby/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AdsBaby adsbaby = db.AdsBabys.Find(id); if (adsbaby == null) { return(HttpNotFound()); } return(View(adsbaby)); }
public static string GetBabyNameById(int id) { UnitOfWork unitOfWork = new UnitOfWork(); string bname = string.Empty; AdsBaby baby = unitOfWork.adsBabysRepository.GetByID(id); if (baby == null) { bname = "查无此人"; } else { bname = unitOfWork.adsBabysRepository.GetByID(id).BabyName; } unitOfWork.Dispose(); return(bname); }
public JsonResult PaySuccess(bool status) { int bid = int.Parse(Session["babyId"].ToString()); Message msg = new Message(); AdsBaby baby = unitOfWork.adsBabysRepository.GetByID(bid); baby.Babystatus = true; if (ModelState.IsValid) { unitOfWork.adsBabysRepository.Update(baby); unitOfWork.Save(); msg.MessageStatus = "true"; msg.MessageInfo = "付款成功,正在为您制定训练计划。"; } return(Json(msg, JsonRequestBehavior.AllowGet)); }
public ActionResult StarBabyEdit(AdsBaby baby) { if (ModelState.IsValid) { baby.BabyAvatar = "~/wechat/img/star.jpg"; baby.BabyRegTime = System.DateTime.Now; baby.BabyExpiredTime = System.DateTime.Now.AddYears(1); unitOfWork.adsBabysRepository.Update(baby); unitOfWork.Save(); Session["babyId"] = baby.BabyId; //注意这里大小写敏感需要与微信支付目录统一一致 // return Redirect("/Wechat/StarBabyPay/?bid=" + baby.BabyId); return(Redirect("/wechatpay/pay/")); } return(View(baby)); }
public ActionResult Pay(int bid) { if (Session["CustomerId"] != null) { AdsBaby baby = unitOfWork.adsBabysRepository.GetByID(bid); if (baby.Babystatus) { return(RedirectToAction("Calendar")); } else { return(RedirectToAction("NoPay")); } } else { return(RedirectToAction("Login")); } }
public ActionResult PingjiaTongji(int babyid) { if (Session["CustomerId"] != null) { AdsBaby baby = unitOfWork.adsBabysRepository.GetByID(babyid); ViewBag.pingjiaA = StatisticsServices.GetPingjiaCountByBabyId(baby.BabyId, 0.3f); ViewBag.pingjiaB = StatisticsServices.GetPingjiaCountByBabyId(baby.BabyId, 0.5f); ViewBag.pingjiaC = StatisticsServices.GetPingjiaCountByBabyId(baby.BabyId, 0.8f); ViewBag.babyId = baby.BabyId; ViewBag.babyName = baby.BabyName; string A1 = "", B1 = "", C1 = "", catName = ""; //这里需要循环Category List <Category> listcat = CategoryServices.GetCategoryListByParentID(3); foreach (Category cat in listcat) { catName = catName + "'" + cat.CategoryName + "'" + ","; A1 = A1 + unitOfWork.pingjiasRepository.Get(filter: u => u.VideoCategory == cat.ID && u.BabyId == babyid && u.PingjiaValue == 0.3f).Count().ToString() + ","; B1 = B1 + unitOfWork.pingjiasRepository.Get(filter: u => u.VideoCategory == cat.ID && u.BabyId == babyid && u.PingjiaValue == 0.5f).Count().ToString() + ","; C1 = C1 + unitOfWork.pingjiasRepository.Get(filter: u => u.VideoCategory == cat.ID && u.BabyId == babyid && u.PingjiaValue == 0.8f).Count().ToString() + ","; } catName = catName.TrimEnd(','); A1 = A1.TrimEnd(','); B1 = B1.TrimEnd(','); C1 = C1.TrimEnd(','); ViewBag.A = A1; ViewBag.B = B1; ViewBag.C = C1; ViewBag.catName = catName; return(View()); } else { return(RedirectToAction("Login")); } }
public ActionResult Pingjia(int?page, float?sid) { float status = sid ?? 0; 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) { AdsBaby baby = babys.First() as AdsBaby; Pager pager = new Pager(); pager.table = "Pingjia"; pager.strwhere = "BabyId=" + baby.BabyId; if (status != 0) { pager.strwhere = pager.strwhere + " and PingjiaValue=" + status; } pager.PageSize = 20; pager.PageNo = page ?? 1; pager.FieldKey = "PingjiaId"; pager.FiledOrder = "PingjiaId desc"; pager = CommonDal.GetPager(pager); IList <Pingjia> pingjias = DataConvertHelper <Pingjia> .ConvertToModel(pager.EntityDataTable); var pingjiasAsIPageList = new StaticPagedList <Pingjia>(pingjias, pager.PageNo, pager.PageSize, pager.Amount); ViewBag.babyId = baby.BabyId; ViewBag.babyName = baby.BabyName; return(View(pingjiasAsIPageList)); } else { return(RedirectToAction("NoBaby")); } } else { return(RedirectToAction("Login")); } }
//这里不能有参数,有参数容易导致问题的发生。 public ActionResult Pay() { int babyid = int.Parse(Session["babyId"].ToString()); AdsBaby baby = unitOfWork.adsBabysRepository.GetByID(babyid); if (Session["openid"] == null) { try { //调用【网页授权获取用户信息】接口获取用户的openid和access_token GetOpenidAndAccessToken(); } catch (Exception ex) { Response.Write(ex.ToString()); throw; } } return(View(baby)); }
public JsonResult UpdateStatus(int id, bool status) { Message msg = new Message(); if (id == null) { msg.MessageStatus = "false"; msg.MessageInfo = "找不到ID"; } AdsBaby adsbaby = unitOfWork.adsBabysRepository.GetByID(id); adsbaby.Babystatus = status; if (ModelState.IsValid) { unitOfWork.adsBabysRepository.Update(adsbaby); unitOfWork.Save(); msg.MessageStatus = "true"; msg.MessageInfo = "已经更改为" + adsbaby.Babystatus.ToString(); } return(Json(msg, JsonRequestBehavior.AllowGet)); }
public ActionResult StarBaby() { if (Session["CustomerId"] != null) { int cid = int.Parse(Session["CustomerId"].ToString()); var babys = unitOfWork.adsBabysRepository.Get(filter: u => u.CustomerId == cid); if (babys.Count() > 0) { AdsBaby baby = babys.First() as AdsBaby; return(RedirectToAction("StarBabyEdit", "Wechat", new { id = baby.BabyId })); } else { ViewData["customerid"] = Session["CustomerId"].ToString(); ViewBag.cusid = Session["CustomerId"].ToString(); return(View()); } } else { return(RedirectToAction("Login")); } }
//测量相关的页面 #region 心理测评页面 public ActionResult Scale() { 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; return(View(baby)); } else { return(RedirectToAction("NoBaby")); } } else { return(RedirectToAction("Login")); } }
//底部导航5个页面 #region 1量表测评列表 public ActionResult Ceping(int?page) { 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) { AdsBaby baby = babys.First() as AdsBaby; Pager pager = new Pager(); pager.table = "Baogao"; pager.strwhere = "BabyId=" + baby.BabyId; pager.PageSize = 20; pager.PageNo = page ?? 1; pager.FieldKey = "BaogaoId"; pager.FiledOrder = "BaogaoId desc"; pager = CommonDal.GetPager(pager); IList <Baogao> baogaos = DataConvertHelper <Baogao> .ConvertToModel(pager.EntityDataTable); var baogaosAsIPageList = new StaticPagedList <Baogao>(baogaos, pager.PageNo, pager.PageSize, pager.Amount); ViewBag.babyname = baby.BabyName; return(View(baogaosAsIPageList)); } else { return(RedirectToAction("NoBaby")); } } else { return(RedirectToAction("Login")); } }
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")); } }