public ActionResult GameTimer() { ContentResult cres = new ContentResult(); cres.ContentType = "text/html"; string cont = null; string game = Request.Form["gtype"].ToString(); switch (Convert.ToInt32(game)) { case 1: cont = "GameOneTimer"; break; case 2: cont = "GameTwoTimer"; break; default: cont = "ERROR"; break; } HttpContext.Application.Lock(); if (HttpContext.Application[cont] != null) { cont = HttpContext.Application[cont].ToString(); } HttpContext.Application.UnLock(); Manage_T_Game mtg = new Manage_T_Game(); int pid = mtg.GetNewPhases(Convert.ToInt32(game)); cres.Content ="{\"id\":\""+pid.ToString()+"\",\"timer\":\""+cont+"\"}"; return cres; }
public void GameOnePro() { lock (this) { int tnum = DBHelper.RunProc("sp_CheckGame"); if (tnum <= 0) { Manage_T_Game mtg = new Manage_T_Game(); mtg.CreateGameOne(); } Application.Lock(); Application["GameOneTimer"] = tnum.ToString(); Application.UnLock(); } }
public void GameTwoPro() { lock (this) { SqlParameter[] parameters = { new SqlParameter("@type",SqlDbType.Int,4) }; parameters[0].Value = 2; int tnum = DBHelper.RunProc("sp_CheckGame", parameters); if (tnum <= 0) { Manage_T_Game mtg = new Manage_T_Game(); mtg.CreateGameTwo(); } Application.Lock(); Application["GameTwoTimer"] = tnum.ToString(); Application.UnLock(); } }
public ActionResult GameEditFun() { if (!CheckLogin()) { ContentResult cr = new ContentResult(); cr.ContentType = "text/html"; cr.Content = "请先登陆<a href='../Admin/Login'>Login</a>"; return cr; } //TempData["Info"] Manage_T_Game mtg; T_Game t_g; string strid = Request.Form.Get("id").ToString(); int id = 0; if (Int32.TryParse(strid, out id) && id > 0) //判断ID是否合法 { mtg = new Manage_T_Game(); t_g = mtg.GetModelById(id); ViewData["GameInfo"] = t_g; t_g.F_NumOne = GetInt("txt_num1"); t_g.F_NumTwo = GetInt("txt_num2"); t_g.F_NumThree = GetInt("txt_num3"); t_g.F_Bonus = GetInt("txt_boun"); t_g.F_InvolvedNum = GetInt("txt_inv"); t_g.F_WinningNum = GetInt("txt_win"); int row=mtg.Update(t_g); if (row > 0) { TempData["Info"] = "Update Success"; } else { TempData["Info"] = "Update Row Zero"; } } else { TempData["Info"] = "ID VALUE ERROR"; return View("GameInfo"); } return View("Index"); }
/// <summary> /// 游戏编辑加载页 /// </summary> /// <returns></returns> public ActionResult GameEdit(int? id) { if (!CheckLogin()) { ContentResult cr = new ContentResult(); cr.ContentType = "text/html"; cr.Content = "请先登陆<a href='../Admin/Login'>Login</a>"; return cr; } TempData["PageTitle"] = "游戏编辑"; if (id!=null) { Manage_T_Game mtg = new Manage_T_Game(); T_Game tg = mtg.GetModelById(id.Value); if (tg == null) { throw new Exception("没有获取到模型!!!"); } ViewData["GameInfo"] = tg; } else { throw new Exception("没有获取到ID.........."); } return View("GameEdit2"); }