예제 #1
0
 public Boolean UpdateServer()
 {
     if (Session[Keys.SESSION_ADMIN_INFO] == null)
     {
         return(false);
     }
     else
     {
         Master master = Session[Keys.SESSION_ADMIN_INFO] as Master;
         if (rcm.GetRoleCompetence(master.RoleId, 11241))
         {
             GameServer gs = new GameServer();
             gs.Id         = int.Parse(Request["ServerId"]);
             gs.GameId     = int.Parse(Request["GameId"]);
             gs.ServerNo   = Request["ServerNo"];
             gs.QuFu       = Request["QuFu"];
             gs.Name       = Request["ServerName"];
             gs.Line       = Request["Line"];
             gs.State      = int.Parse(Request["State"]);
             gs.StartTime  = DateTime.Parse(Request["StartTime"]);
             gs.Sort_Id    = int.Parse(Request["Sort_Id"]);
             gs.Img        = Request["Img"];
             gs.ServerDesc = Request["ServerDesc"];
             return(sm.UpdateServer(gs));
         }
         else
         {
             return(false);
         }
     }
 }
예제 #2
0
        public ActionResult InitServers(string GameNo)
        {
            ViewData["GameCenterOn"] = "current ";
            g = gm.GetGame(GameNo);
            ViewData["Title"]      = g.Name + "服务器列表";
            ViewData["IndexHbImg"] = g.IndexHbImg;
            string      NewsGG = "";
            List <News> GGlist = new List <News>();

            GGlist = nm.GetNews(5, 2, g.Id);
            foreach (News n in GGlist)
            {
                NewsGG += "<li><span style=\"margin: 20px;\"><a href=\"/NewsCenter/News?N=" + n.Id + "\" style=\"text-decoration: none;\">" + n.Title + "</a></span></li>";
            }
            ViewData["NewsGG"] = NewsGG;
            string[] Str = g.GameProperty.Split('|');
            ViewData["GameLx"]   = Str[0];
            ViewData["GameTz"]   = Str[1];
            ViewData["GameCzlx"] = Str[2];
            ViewData["GameHm"]   = Str[3];
            ViewData["GameSfms"] = Str[4];

            string ServerHtml = "";
            string SelHtml    = "";

            gsList = sm.GetServersByGame(g.Id);
            for (int i = 0; i < Math.Ceiling(gsList.Count / 20f); i++)
            {
                SelHtml    += " <a>" + (i * 20 + 1) + "-" + ((i + 1) * 20) + "</a>";
                ServerHtml += "<div style=\"display: none\">";
                for (int j = (i * 20); j <= ((20 * i + 19) >= gsList.Count ? gsList.Count - 1 : (20 * i + 19)); j++)
                {
                    if (gsList[j].StartTime < DateTime.Now && gsList[j].State == 1)
                    {
                        gsList[j].State = 4;
                        sm.UpdateServer(gsList[j]);
                    }
                    else if (gsList[j].StartTime > DateTime.Now && gsList[j].State != 1)
                    {
                        gsList[j].State = 1;
                        sm.UpdateServer(gsList[j]);
                    }
                    switch (gsList[j].State)
                    {
                    case 1:
                        ServerHtml += "<a class=\"li_jikai\">" + gsList[j].Name + "</a>";
                        break;

                    case 2:
                        ServerHtml += "<a class=\"li_weihu\">" + gsList[j].Name + "</a>";
                        break;

                    case 3:
                        ServerHtml += "<a class=\"li_liuchang\" href=\"/" + g.GameNo + "/LoginGame?S=" + gsList[j].QuFu + "\" target=\"_blank\">" + gsList[j].Name + "</a>";
                        break;

                    case 4:
                        ServerHtml += "<a class=\"li_hot\" href=\"/" + g.GameNo + "/LoginGame?S=" + gsList[j].QuFu + "\" target=\"_blank\">" + gsList[j].Name + "</a>";
                        break;

                    default:
                        break;
                    }
                }
                ServerHtml += "</div>";
            }
            ViewData["SelHtml"]    = SelHtml;
            ViewData["ServerHtml"] = ServerHtml;

            string      ZlHtml = "";
            List <News> zlList = new List <News>();

            zlList = nm.GetNews(200, 5, g.Id);
            foreach (News zl in zlList)
            {
                ZlHtml += "<li><a href=\"/NewsCenter/News?N=" + zl.Id + "\" target=\"_blank\">" + zl.Title + "</a></li>";
            }
            ViewData["ZlHtml"] = ZlHtml;

            ViewData["Pic1"] = g.Pic1;
            ViewData["Pic2"] = g.Pic2;
            ViewData["Pic3"] = g.Pic3;
            ViewData["Pic4"] = g.Pic4;

            ViewData["GameCom"]     = g.GameCom;
            ViewData["BBS"]         = g.GameBBS;
            ViewData["game_url_hd"] = g.game_url_hd;
            ViewData["Dlq"]         = string.IsNullOrEmpty(g.game_url_xzq) ? "" : "<a href=\"" + g.game_url_xzq + "\" class=\"dlq\" target=\"_blank\">&gt; 登录器地址 </a>";
            return(View("~/Views/GameCenter/GameServer.cshtml"));
        }