コード例 #1
0
ファイル: PlayerList.aspx.cs プロジェクト: yjtang/AutoBws
 public void bindGridView()
 {
     string jurisdiction = getUserType(Page);
     UserInfo userInfo = null;
     string loginName = string.Empty;
     if (HttpContext.Current.Session["currentUser"] == null)
     {
         HttpContext.Current.Response.Redirect("~/Default.aspx");
     }
     else
     {
         userInfo = ((UserInfo) HttpContext.Current.Session["currentUser"]);
         loginName = userInfo.LoginName;
     }
     DataTable dt = new AutoBwsBLL.PlayerBLL().getList("noName", "all");
     if (jurisdiction.EndsWith("S"))
     {
         GridView1.DataSource = dt;
         GridView1.DataBind();
     }
     else if (jurisdiction.EndsWith("A"))
     {
         List<Player> players = new List<Player>();
         if (dt != null && dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (DBNull.Value != dt.Rows[i]["parentId"] && userInfo.Id == Convert.ToInt32(dt.Rows[i]["parentId"]))
                 {
                     DataRow r = dt.Rows[i];
                     Player player = new Player();
                     player.Admin = r["Admin"].ToString();
                     player.Id = Convert.ToInt32(r["id"].ToString());
                     player.LoginName = r["loginName"].ToString();
                     player.AccountState = r["accountState"].ToString();
                     player.GhostName = r["GhostName"].ToString();
                     player.PartnerName = r["PartnerName"].ToString();
                     player.LoginState = r["loginState"].ToString();
                     players.Add(player);
                 }
             }
         }
         this.GridView1.DataSource = players;
         this.GridView1.DataBind();
     }
     else
     {
         List<Player> players = new List<Player>();
         if (dt != null && dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (null != dt.Rows[i]["PartnerName"] && loginName == dt.Rows[i]["PartnerName"].ToString())
                 {
                     DataRow r = dt.Rows[i];
                     Player player = new Player();
                     player.Admin = r["Admin"].ToString();
                     player.Id = Convert.ToInt32(r["id"].ToString());
                     player.LoginName = r["loginName"].ToString();
                     player.AccountState = r["accountState"].ToString();
                     if (String.IsNullOrEmpty(r["GhostOwnerId"].ToString()))
                     {
                         player.GhostName = "";
                     }
                     else if (Convert.ToInt32(r["GhostOwnerId"].ToString()) != userInfo.Id)
                     {
                         player.GhostName = r["GhostMask"].ToString();
                     }
                     else
                     {
                         player.GhostName = r["GhostName"].ToString();
                     }
                     player.PartnerName = r["PartnerName"].ToString();
                     player.LoginState = r["loginState"].ToString();
                     players.Add(player);
                 }
             }
             GridView1.DataSource = players;
             GridView1.DataBind();
         }
     }
     // DataTable dt = new AutoBwsBLL.PlayerBLL().getList();
     //IList<AutoBwsModel.Player> plist = new List<AutoBwsModel.Player>();
     //plist = new AutoBwsBLL.PlayerBLL().GetPlayerList(CurrentUser);
     //this.GridView1.DataSource = plist;
     //this.GridView1.DataBind();
     //switch (CurrentUser)
     //{
     //    case "superadmin":
     //        //dt=dt.Select(
     //        break;
     //}
     //if (dt != null && dt.Rows.Count > 0)
     //{ this.GridView1.DataSource = dt; this.GridView1.DataBind(); }
     //else
     //{ this.GridView1.DataSource = null; this.GridView1.DataBind(); }
 }
コード例 #2
0
ファイル: NewPlayer.aspx.cs プロジェクト: yjtang/AutoBws
        public void playerDetail()
        {
            Player player = new AutoBwsBLL.PlayerBLL().getPlayerDetail(Request.QueryString["uid"]);
            if (player != null && !string.IsNullOrEmpty(player.LoginName))
            {
                hiddenPlayerId.Value = Convert.ToString(player.Id);
                txtloginName.Text = player.LoginName;
                txtloginPwd.Text = player.LoginPwd;
                txtperMatchTarget.Text = player.PerMatchTarget;
                if (IsWritable())
                {
                    bindddlURL(player.Urltype);
                }
                ddlurl.Items.Insert(0, player.Url);
                if (player.Attachment2Ghost.ghostId == 0)
                {
                    ddlghost.SelectedIndex = ddlghost.Items.Count - 1;
                }
                else
                {
                    foreach (ListItem item in ddlghost.Items)
                    {
                        if (Convert.ToInt32(item.Value) == player.Attachment2Ghost.ghostId)
                        {
                            item.Selected = true;
                            break;
                        }
                    }
                }
                txtloginPwd.Attributes.Add("value", player.LoginPwd);
            //				txtName.Text = player.LoginName;
            //				txtName.ReadOnly = true;
                txtloginName.ReadOnly = true;

                if (!IsWritable())
                {
                    this.btnSubmit.Visible = false;
                    this.txtloginName.ReadOnly = true;
                    this.txtloginPwd.ReadOnly = true;
                    this.txtloginName.Attributes["class"] = "";
                    this.txtloginPwd.Attributes["class"] = "";
            //					this.txtpercentageHolding.ReadOnly = true;
            //					this.txtpercentageHolding.Attributes["class"] = "";
                    this.txtperMatchTarget.ReadOnly = true;
                    this.txtperMatchTarget.Attributes["class"] = "";
                    this.ddlurl.Enabled = false;
            //					this.ddlip.Enabled = false;
                    this.ddlghost.Enabled = false;
            //					this.txtName.Attributes["class"] = "";
                }

                if ("closed".Equals(player.AccountState))
                {
                    btnSubmit.Visible = false;
                    txtloginPwd.ReadOnly = true;
                    ddlurl.Enabled = false;
                    txtperMatchTarget.ReadOnly = true;
                    ddlghost.Enabled = false;
                }
            }
        }
コード例 #3
0
ファイル: PlayerList.aspx.cs プロジェクト: yjtang/AutoBws
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList dop = (DropDownList)sender;
            GridViewRow gvr = (GridViewRow)dop.NamingContainer;
            string playerName = Convert.ToString(GridView1.DataKeys[gvr.RowIndex][2].ToString());
            string newStatus = dop.SelectedValue;
            Player player = new AutoBwsBLL.PlayerBLL().getPlayerByPlayerName(playerName);
            if (newStatus == player.AccountState)
            {
                return;
            }
            player.AccountState = newStatus;
            if (new AutoBwsBLL.PlayerBLL().UpdatePlayerStatus(player))
            {
                bindGridView();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "",
                                "<script>alert('Changed successfully');func();</script>", false);

            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "<script>alert('failed!');func();</script>",
                                                    false);
            }

            //关闭player引擎
            if ("closed" == newStatus || "suspended" == newStatus)
            {
                betEngine.LogoutPlayer(player);
            }
            else if ("active" == newStatus) // 重置状态
            {
                betEngine.LoginPlayers(new List<Player>() { player });
            }
        }