// // GET: /Baseball/BBSchedules/Create /// <summary> /// 新增赛程主页 /// </summary> public ActionResult Create(string gameType, DateTime GameDate, string wsbz = "") { ViewBag.IsAdd = true; ViewBag.GameType = gameType; ViewBag.msg = wsbz; var all = _IBaseballAllianceService.QueryByCondition(p => p.GameType == gameType && !p.IsDeleted); //大联盟 ViewBag.DAllian = all.Where(p => p.Lever == 1).ToList().Select(c => new SelectListItem { Text = c.AllianceName, Value = c.AllianceID.ToString() }).ToList(); //默认选择第一个大联盟ID int dlm = all.Where(c => c.Lever == 1).First().AllianceID; //队伍联盟列表 第一个大联盟 + 此大联盟下级 var teamAll = all.ToList().Where(p => (p.LeverOther != null && p.LeverOther.Contains(dlm.ToString())) || p.AllianceID == dlm); ViewBag.AllianListB = ViewBag.AllianListA = teamAll.ToList().Select(c => new SelectListItem { Text = c.AllianceName, Value = c.AllianceID.ToString() }).ToList(); //第一次加载队伍列表 ViewBag.TeamB = ViewBag.TeamA = _IBaseballTeamService.QueryByCondition(p => p.GameType == gameType && !p.IsDeleted).OrderBy(o => o.ShowName).ToList().Select(c => new SelectListItem { Text = c.ShowName, Value = c.TeamID.ToString() }).ToList(); ViewBag.GameStates = AppData.GetAllGameStatus().Select(c => new SelectListItem { Text = c.StatusText, Value = c.Status }).ToList(); ViewBag.CtrlStates = AppData.GetCtrlState().Select(c => new SelectListItem { Text = c.CtrlText, Value = c.CtrlValue }).ToList(); BaseballSchedules bs = new BaseballSchedules(); bs.Number = 0; bs.GameDate = GameDate.Date; bs.GameTime = new TimeSpan(00, 00, 00); bs.GameStates = "X"; bs.IsReschedule = false; bs.IsDeleted = false; bs.ShowJS = true; bs.OrderBy = 1; bs.B = bs.S = bs.O = bs.Bases = 0; ViewBag.navigation = new Navigation { Level = new List<string> { AppData.GetGameTypeName(gameType), "新增赛程" }, Area = RouteData.DataTokens["area"].ToString(), Controller = RouteData.Values["controller"].ToString(), Action = "Index", HaveButton = true, Parameter = new List<Models.ViewModel.Parameter> { new Parameter("date", GameDate.ToString("yyyy-MM-dd")), new Parameter("gameType", gameType) }, ButtonText = "返回賽程" }; return View("SchedulesEdit", bs); }
public ActionResult UpdateFollow(BaseballSchedules bb, int type) { bb.RunsA = bb.RunsA ?? ""; bb.RunsB = bb.RunsB ?? ""; bb.RunsA = string.Join(",", bb.RunsA.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)); bb.RunsB = string.Join(",", bb.RunsB.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)); if (!string.IsNullOrWhiteSpace(bb.TrackerText)) { bb.TrackerText = HttpUtility.UrlDecode(bb.TrackerText); } if (_IBaseballSchedulesService.UpdateFollow(bb, type) > 0) { return Json("ok"); } else { return Json("失败!"); } }
public ActionResult Edit(int gid, BaseballSchedules bb, string DDLGameStates, int DDLCtrlStates) { bb.GameStates = DDLGameStates; bb.CtrlStates = DDLCtrlStates; int c = _IBaseballSchedulesService.EditSchedules(bb); if (c > 0) { return RedirectToAction("Index", new { date = bb.GameDate.ToString("yyyy-MM-dd"), gameType = bb.GameType }); } else { return RedirectToAction("Edit", new { GID = bb.GID, wsbz = HttpUtility.UrlEncode(c == -3 ? "队伍选取重复" : c == -2 ? "大聯盟不存在" : c == 0 || c == -1 ? "隊伍不存在" : "修改賽事失敗") }); } }
public ActionResult EditScore(BaseballSchedules bb) { int r = _IBaseballSchedulesService.EditScore(bb); if (r > 0) { return Json("成功"); ; } else return Json("失敗" + r); }
public ActionResult Create(BaseballSchedules bb, string gameType, string DDLGameStates, int DDLCtrlStates) { bb.GameStates = DDLGameStates; bb.CtrlStates = DDLCtrlStates; int c = _IBaseballSchedulesService.CreateSchedules(bb, gameType); if (c > 0) { return RedirectToAction("Index", new { date = bb.GameDate.ToString("yyyy-MM-dd"), gameType = gameType }); } else { return RedirectToAction("Create", new { gameType = gameType, GameDate = bb.GameDate.ToString("yyyy-MM-dd"), wsbz = HttpUtility.UrlEncode(c == -3 ? "队伍选取重复" : c == -2 ? "大聯盟不存在" : c == 0 || c == -1 ? "隊伍不存在" : "新增賽事失敗") }); } }