public ActionResult DeleteScore(IceHockeySchedules ih)
 {
     if (_IIceHockeySchedulesService.DeleteScore(ih) > 0)
     {
         return Json("成功");
     }
     else
     {
         return Json("失败");
     }
 }
 public ActionResult EditScore(IceHockeySchedules ih, FormCollection collection)
 {
     string rA = null, rB = null;
     for (int i = 1; i <= 3; i++)
     {
         rA += collection["txtRunsA_" + i];
         rB += collection["txtRunsB_" + i];
         if (i != 3)
         {
             rA += ",";
             rB += ",";
         }
     }
     for (int i = 4; i <= 5; i++)
     {
         if (!string.IsNullOrWhiteSpace(collection["txtRunsA_" + i]))
         {
             rA += "," + collection["txtRunsA_" + i];
         }
         if (!string.IsNullOrWhiteSpace(collection["txtRunsB_" + i]))
         {
             rB += "," + collection["txtRunsB_" + i];
         }
     }
     ih.RunsA = rA;
     ih.RunsB = rB;
     if (_IIceHockeySchedulesService.EditScoreByIHBF(ih) > 0)
     {
         return Json("成功"); ;
     }
     else
         return Json("失敗");
 }
        //
        // GET: /IceHockey/BBSchedules/Create
        /// <summary>
        ///  新增赛程主页
        /// </summary>
        public ActionResult Create(string gameType, DateTime GameDate, string wsbz = "")
        {
            ViewBag.IsAdd = true;
            ViewBag.GameType = gameType;
            ViewBag.msg = wsbz;
            var all = _IIceHockeyAllianceService.QueryByCondition(p => p.GameType == gameType && p.Display);
            //大联盟
            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.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 = _IIceHockeyTeamService.QueryByCondition(p => p.GameType == gameType && p.Display).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();

            IceHockeySchedules bs = new IceHockeySchedules();
            bs.Number = 0;
            bs.GameDate = GameDate.Date;
            bs.GameTime = new TimeSpan(00, 00, 00);
            bs.GameStates = "X";
            bs.ShowJS = true;
            bs.OrderBy = 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 EditScore(IceHockeySchedules ih)
 {
     int r = _IIceHockeySchedulesService.EditScore(ih);
     if (r > 0)
     {
         return Json("成功"); ;
     }
     else
         return Json("失敗" + r);
 }
 public ActionResult Edit(int gid, IceHockeySchedules ih, string DDLGameStates, int DDLCtrlStates)
 {
     ih.GameStates = DDLGameStates;
     ih.CtrlStates = DDLCtrlStates;
     int c = _IIceHockeySchedulesService.EditSchedules(ih);
     if (c > 0)
     {
         return RedirectToAction("Index", new { date = ih.GameDate.ToString("yyyy-MM-dd"), gameType = ih.GameType });
     }
     else
     {
         return RedirectToAction("Edit", new { GID = ih.GID, wsbz = HttpUtility.UrlEncode(c == -3 ? "队伍选取重复" : c == -2 ? "大聯盟不存在" : c == 0 || c == -1 ? "隊伍不存在" : "修改賽事失敗") });
     }
 }
 public ActionResult Create(IceHockeySchedules ih, string gameType, string DDLGameStates, int DDLCtrlStates)
 {
     ih.GameStates = DDLGameStates;
     ih.CtrlStates = DDLCtrlStates;
     ih.Display = true;
     int c = _IIceHockeySchedulesService.CreateSchedules(ih, gameType);
     if (c > 0)
     {
         return RedirectToAction("Index", new { date = ih.GameDate.ToString("yyyy-MM-dd"), gameType = gameType });
     }
     else
     {
         return RedirectToAction("Create", new { gameType = gameType, GameDate = ih.GameDate.ToString("yyyy-MM-dd"), wsbz = HttpUtility.UrlEncode(c == -3 ? "队伍选取重复" : c == -2 ? "大聯盟不存在" : c == 0 || c == -1 ? "隊伍不存在" : "修改賽事失敗") });
     }
 }