Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["User"] == null)
     {
         Response.Redirect("~/Home.aspx");
     }
     user   = (User)Session["User"];
     game   = (BLL.Game)Application["Game"];
     player = (BLL.Player)Session["Player"];
     if (player == null)
     {
         Response.Redirect("~/Home.aspx");
     }
     if (player.GameEnded)
     {
         Session["Player"] = null;
         Response.Redirect($"~/Summery.aspx?gameId={player.GameID}");
     }
     Pile.card       = player.leadingCard;
     Deck.card       = null;
     Deck.IsButton   = true;
     Deck.Click     += TryDraw;
     Hand.DataSource = player.GetHand();
     Hand.DataBind();
     Users.DataSource = player.players;
     Users.DataBind();
 }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SeoSetting(SeoConfig.Config.DownPageSeo);
            if (!IsPostBack)
            {
                //---游戏简介类别绑定注释掉,因客户自己在页面中嵌入了静态页面,征得了客户的同意
                BindGameList();
                //BindGameType();
                //添加了代理下载地址,因此注释掉
                DataRow dr = new BLL.Game().GetInfoMain();
                if (dr != null)
                {
                    mainImg = dr["Image_URL"].ToString();

                    lteTime.Text = dr["Update_Time"].ToString();
                    lteCopy.Text = dr["Main_Copy"].ToString();
                    LteUse.Text  = dr["Main_use"].ToString();
                    LteSize.Text = dr["FileSize"].ToString();
                    lteInfo.Text = dr["Main_Info"].ToString();

                    /*fullUrl = dr["Down_address"].ToString();
                     * smallUrl = dr["Down_saddress"].ToString();*/
                }
                BLL.Game BllGame = new BLL.Game();
                fullUrl  = BllGame.GetDownUrl("dianxindown");
                smallUrl = BllGame.GetDownUrl("wangtongdown");
            }
        }
Example #3
0
    //游戏名称集合
    public void BindGameNames()
    {
        DataTable dt = new BLL.Game().ListTGameNameInfo(0);

        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ddlNameID.Items.Add(new ListItem(dt.Rows[i]["ComName"].ToString(), dt.Rows[i]["NameID"].ToString()));
            }
        }
        ddlNameID.Items.Insert(0, new ListItem("--请选择--", "-1"));
    }
    protected void CreateHtml(object sender, EventArgs e)
    {
        try
        {
            //文件存放根目录
            string RootFilePath = "/Html/Ranking/";
            //域名
            string domain = Request.Url.OriginalString.ToLower().Replace("/admin/sconfig/createranking.aspx", ""); //System.Configuration.ConfigurationSettings.AppSettings["Domain"].TrimEnd( '/' );

            //Ranking.aspx
            System.Net.WebRequest      rq         = System.Net.WebRequest.Create(domain + "/Ranking2.aspx");
            System.Net.HttpWebResponse rp         = (System.Net.HttpWebResponse)rq.GetResponse();
            System.IO.Stream           pageStream = rp.GetResponseStream();
            using (System.IO.StreamReader sr = new System.IO.StreamReader(pageStream))
            {
                //读取
                string tmp = sr.ReadToEnd();
                //无参数的Ranking.html
                string path = HttpContext.Current.Server.MapPath(RootFilePath + "Ranking.html");
                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false, System.Text.Encoding.UTF8))
                {
                    sw.Write(tmp);
                }
            }
            rq.Abort();
            rp.Close();
            pageStream.Close();

            //RankFascination.aspx
            rq         = System.Net.WebRequest.Create(domain + "/RankFascination2.aspx");
            rp         = (System.Net.HttpWebResponse)rq.GetResponse();
            pageStream = rp.GetResponseStream();
            using (System.IO.StreamReader sr = new System.IO.StreamReader(pageStream))
            {
                //读取
                string tmp = sr.ReadToEnd();
                //无参数的Ranking.html
                string path = HttpContext.Current.Server.MapPath(RootFilePath + "RankFascination.html");
                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false, System.Text.Encoding.UTF8))
                {
                    sw.Write(tmp);
                }
            }
            rq.Abort();
            rp.Close();
            pageStream.Close();

            //RankGameTime.aspx
            rq         = System.Net.WebRequest.Create(domain + "/RankGameTime2.aspx");
            rp         = (System.Net.HttpWebResponse)rq.GetResponse();
            pageStream = rp.GetResponseStream();
            using (System.IO.StreamReader sr = new System.IO.StreamReader(pageStream))
            {
                //读取
                string tmp = sr.ReadToEnd();
                //无参数的Ranking.html
                string path = HttpContext.Current.Server.MapPath(RootFilePath + "RankGameTime.html");
                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false, System.Text.Encoding.UTF8))
                {
                    sw.Write(tmp);
                }
            }
            rq.Abort();
            rp.Close();
            pageStream.Close();

            //RankMoney.aspx
            rq         = System.Net.WebRequest.Create(domain + "/RankMoney2.aspx");
            rp         = (System.Net.HttpWebResponse)rq.GetResponse();
            pageStream = rp.GetResponseStream();
            using (System.IO.StreamReader sr = new System.IO.StreamReader(pageStream))
            {
                //读取
                string tmp = sr.ReadToEnd();
                //无参数的Ranking.html
                string path = HttpContext.Current.Server.MapPath(RootFilePath + "RankMoney.html");
                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false, System.Text.Encoding.UTF8))
                {
                    sw.Write(tmp);
                }
            }
            rq.Abort();
            rp.Close();
            pageStream.Close();

            //RankOnLineTime.aspx
            rq         = System.Net.WebRequest.Create(domain + "/RankOnLineTime2.aspx");
            rp         = (System.Net.HttpWebResponse)rq.GetResponse();
            pageStream = rp.GetResponseStream();
            using (System.IO.StreamReader sr = new System.IO.StreamReader(pageStream))
            {
                //读取
                string tmp = sr.ReadToEnd();
                //无参数的Ranking.html
                string path = HttpContext.Current.Server.MapPath(RootFilePath + "RankOnLineTime.html");
                using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false, System.Text.Encoding.UTF8))
                {
                    sw.Write(tmp);
                }
            }
            rq.Abort();
            rp.Close();
            pageStream.Close();

            //Ranking带参数的页面输出开始

            System.Data.DataTable dt;
            object dtCache = HttpContext.Current.Cache.Get("GameIDList"); //BCST.Cache.BCSTCache.Default.Get<BCST.Cache.AspNetCache>("GameIDList");
            if (dtCache == null)
            {
                //重新读取
                dt = new BLL.Game().ListTGameNameInfo(0);

                HttpContext.Current.Cache.Insert("GameIDList", dt, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(12, 0, 0));
            }
            else
            {
                dt = (System.Data.DataTable)dtCache;
            }

            foreach (System.Data.DataRow row in dt.Rows)
            {
                rq         = System.Net.WebRequest.Create(domain + "/Ranking2.aspx?id=" + row["NameID"].ToString() + "&name=" + Server.UrlEncode(row["ComName"].ToString()));
                rp         = (System.Net.HttpWebResponse)rq.GetResponse();
                pageStream = rp.GetResponseStream();
                using (System.IO.StreamReader sr = new System.IO.StreamReader(pageStream))
                {
                    //读取
                    string tmp = sr.ReadToEnd();
                    //无参数的Ranking.html
                    string path = HttpContext.Current.Server.MapPath(RootFilePath + "Ranking_" + row["NameID"].ToString() + ".html");
                    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false, System.Text.Encoding.UTF8))
                    {
                        sw.Write(tmp);
                    }
                }
                rq.Abort();
                rp.Close();
                pageStream.Close();
            }
            msg.Text      = "全部生成成功!" + DateTime.Now;
            msg.ForeColor = System.Drawing.Color.Green;
        }
        catch (Exception ex)
        {
            msg.Text = "生成失败:" + ex.Message;
        }
    }
Example #5
0
        protected void Page_Load( object sender, EventArgs e )
        {
            SeoSetting( SeoConfig.Config.DownPageSeo );
            if( !IsPostBack )
            {
                //---��Ϸ�������ע�͵����ͻ��Լ���ҳ����Ƕ���˾�̬ҳ�棬�����˿ͻ���ͬ��
                BindGameList();
                //BindGameType();
                //����˴������ص�ַ,���ע�͵�
                DataRow dr = new BLL.Game().GetInfoMain();
                if( dr != null )
                {
                    mainImg = dr["Image_URL"].ToString();

                    lteTime.Text = dr["Update_Time"].ToString();
                    lteCopy.Text = dr["Main_Copy"].ToString();
                    LteUse.Text = dr["Main_use"].ToString();
                    LteSize.Text = dr["FileSize"].ToString();
                    lteInfo.Text = dr["Main_Info"].ToString();

                    /*fullUrl = dr["Down_address"].ToString();
                    smallUrl = dr["Down_saddress"].ToString();*/

                }
                BLL.Game BllGame = new BLL.Game();
                fullUrl = BllGame.GetDownUrl( "dianxindown" );
                smallUrl = BllGame.GetDownUrl( "wangtongdown" );
            }
        }