public void bindGVBetStatus() { string jurisdiction = AutoBwsWeb.Common.BasePage.getUserType(this.Page); List<Player> playerList = new List<Player>(); DataTable tb = bvBLL.getBetFailure(); if (null != tb && tb.Rows.Count > 0) { for (int i = 0; i < tb.Rows.Count; i++) { Player player = new Player(); player.Id = Convert.ToInt32(tb.Rows[i]["betId"]); player.LoginName = Convert.ToString(tb.Rows[i]["UserId"]); UserInfo partner = new UserInfo(); partner.ParentId = Convert.ToInt32(tb.Rows[i]["parentId"]); partner.LoginName = Convert.ToString(tb.Rows[i]["PartnerName"]); player.Partner = partner; player.Logintime = Convert.ToDateTime(tb.Rows[i]["loginTime"]); player.Result = Convert.ToString(tb.Rows[i]["result"]); player.Remark = Convert.ToString(tb.Rows[i]["remarks"]); if (jurisdiction.EndsWith("S")) { playerList.Add(player); } else if (jurisdiction.EndsWith("A")) { UserInfo currentUser = (Session["currentUser"]) as UserInfo; if (null != currentUser && currentUser.Id == partner.ParentId) { playerList.Add(player); } } else { UserInfo currentUser = (Session["currentUser"]) as UserInfo; if (null != currentUser && currentUser.LoginName == partner.LoginName) { playerList.Add(player); } } } } this.GVBetStatus.DataSource = bvBLL.getBetFailure(); this.GVBetStatus.DataBind(); }
public Player getPlayerDetail(string loginName) { DataTable dt = pService.getPlayerDetails(loginName); Player player = new Player(); player.Id = Convert.ToInt32(dt.Rows[0]["id"]); //player.Name = Convert.ToString(dt.Rows[0]["name"]); player.LoginName = loginName; player.LoginPwd = Convert.ToString(dt.Rows[0]["loginPwd"]); player.Ip = Convert.ToString(dt.Rows[0]["IP"]); player.Attachment2Ghost.GhostName = Convert.ToString(dt.Rows[0]["ghostName"]); player.Attachment2Ghost.ghostId = Convert.ToInt32(dt.Rows[0]["attachment2Ghost"]); player.PerMatchTarget = Convert.ToString(dt.Rows[0]["perMatchTarget"]); player.Url = Convert.ToString(dt.Rows[0]["URL"]); player.PercentageHolding = Convert.ToInt32(dt.Rows[0]["percentageHolding"]); player.Partner.LoginName = Convert.ToString(dt.Rows[0]["belong2Partner"]); player.AccountState = Convert.ToString(dt.Rows[0]["accountState"]); player.Urltype = Convert.ToString(dt.Rows[0]["urlType"]); return player; }
public bool AddNewPlayer(Player player) { bool flag = false; MySqlParameter[] parms = new MySqlParameter[] { new MySqlParameter("@yloginName", MySqlDbType.VarChar, 20), //登录名 new MySqlParameter("@yloginPwd", MySqlDbType.VarChar, 20), //密码 new MySqlParameter("@yURL", MySqlDbType.VarChar, 20), new MySqlParameter("@yperMatchTarget", MySqlDbType.VarChar, 20), // new MySqlParameter("@yIP", MySqlDbType.VarChar,25), new MySqlParameter("@yattachment2Ghost", MySqlDbType.Int32, 20), new MySqlParameter("@ypercentageHolding", MySqlDbType.Int32, 8), new MySqlParameter("@yURLType", MySqlDbType.VarChar, 8), new MySqlParameter("@ybelong2Partner", MySqlDbType.VarChar, 20), new MySqlParameter("@_accountState", MySqlDbType.VarChar, 20) }; //new MySqlParameter("@yname", MySqlDbType.VarChar,12), parms[0].Value = player.LoginName.ToLower(); parms[1].Value = player.LoginPwd.ToLower(); parms[2].Value = player.Url; parms[3].Value = player.PerMatchTarget; // parms[4].Value = player.Ip; parms[4].Value = player.Attachment2Ghost.ghostId; parms[5].Value = player.PercentageHolding; parms[6].Value = player.Urltype; //UserInfo ui = new UserInfo(); parms[7].Value = player.Partner.LoginName; parms[8].Value = player.AccountState; try { if (DBHelper.ExecuteNonQuery(connectStr, CommandType.StoredProcedure, "addNewPlayer", parms) != 0) flag = true; } catch { throw; } return flag; }
public ProfitReport(int id) { Id = id; Player = new Player(); Ghost = new Ghost(); }
public ProfitReport() { Player = new Player(); Ghost = new Ghost(); }
/// <summary> /// 更新玩家账户 /// </summary> /// <param name="player">玩家对象</param> /// <returns>更新是否成功</returns> public static bool UpdatePlayerAmount(Player player) { bool isSuccess = false; try { // 创建Agent数据访问对象 PlayerService playerService = new PlayerService(); isSuccess = playerService.UpdatePlayerAmount(player); } catch (Exception e) { throw; } return isSuccess; }
public void SetFollowRelationship(Player player, Ghost ghost, Agent agent) { }
public void SetFollowRelationship(Player player, Ghost ghost, Agent agent) { Dictionary<string, PlayerConvert> playerConverts = gamerVariable.getGamerList(); Dictionary<string, AgentConvert> agentConverts = agentVariable.getAgentList(); // player、agent已注册到引擎中 if (playerConverts.ContainsKey(player.LoginName) && agentConverts.ContainsKey(agent.LoginName)) { AgentConvert agentConvert = agentConverts[agent.LoginName]; Dictionary<string, GhostConvert> oldGhost = agentConvert.Ghosts; if (oldGhost.ContainsKey(ghost.GhostName)) { PlayerConvert playerConvert = playerConverts[player.LoginName]; // 清除玩家更新前跟注的ghost GhostConvert belongGhost = playerConvert.GhostConvert; if(null != belongGhost) { belongGhost.Gamers.Remove(player.LoginName); } GhostConvert ghostConvert = oldGhost[ghost.GhostName]; // 设置玩家当前跟注的ghost if (!ghostConvert.Gamers.ContainsKey(player.LoginName)) { playerConvert.GhostConvert = ghostConvert; ghostConvert.Gamers.Add(player.LoginName, playerConvert); } } } }
protected void btnSubmit_Click(object sender, EventArgs e) { string loginname = txtloginName.Text.Trim().ToLower(); // Mofify Aorta //if (new AutoBwsBLL.PlayerBLL().AddNewPlayer_checkLoginName(loginname)) //{ // Common.yvonYmPrompt.AlertError("ID already exist!", this.Page); return; //} //else //{ #region 实体 string loginpwd = this.txtloginPwd.Text.Trim().ToLower(); // string name = this.txtName.Text.Trim(); // int percentageholding = Convert.ToInt32(this.txtpercentageHolding.Text.Trim()); string permatchtarget = this.txtperMatchTarget.Text.Trim(); string attachment2ghost = this.ddlghost.Text; // Add Aorta // 0 means there is no ghost to follow int attachment2Id = 0; if (!string.IsNullOrEmpty(this.ddlghost.SelectedValue)) { attachment2ghost = this.ddlghost.SelectedItem.Text; attachment2Id = Convert.ToInt32(this.ddlghost.SelectedValue); } // end Aorta string url = this.ddlurl.SelectedValue; // string ip = this.ddlip.SelectedValue; Player player = new Player(); player.LoginName = loginname; player.LoginPwd = loginpwd; if (!String.IsNullOrEmpty(hiddenPlayerId.Value)) { player.Id = Convert.ToInt32(hiddenPlayerId.Value); } // player.PercentageHolding = percentageholding; player.PerMatchTarget = permatchtarget; player.Attachment2Ghost.GhostName = attachment2ghost; if (HttpContext.Current.Session["currentUser"] == null) HttpContext.Current.Response.Redirect("~/Default.aspx"); else player.Partner.LoginName = ((UserInfo) HttpContext.Current.Session["currentUser"]).LoginName; player.Url = url; var query = from yvon in (new AutoBwsBLL.IPURLBLL().getURLs(false)).AsEnumerable() where yvon.Field<string>("url") == url select yvon.Field<string>("type"); foreach (var item in query) { player.Urltype = item.ToString(); } // player.Ip = ip; #endregion // New player is not attachmented any ghost if (attachment2Id == 0) { player.AccountState = "active"; if (new AutoBwsBLL.PlayerBLL().AddNewPlayer_checkLoginName(loginname)) { if (this.lblNew2.Text.Contains("ADD")) { Common.yvonYmPrompt.AlertError("This player already exists!", this.Page); } else { if (new AutoBwsBLL.PlayerBLL().UpdatePlayer(player)) { //player.Attachment2Ghost.ghostId = attachment2Id Common.yvonYmPrompt.AlertSuccess("Player updated!", this.Page, "cleanyvon"); betEngine.LoginPlayers(new List<Player> {player}); HttpContext.Current.Response.Redirect("~/files/PlayerList.aspx"); } else { Common.yvonYmPrompt.AlertError("Failed to update player!", this.Page); } } } else { if (! Restrictions.canCreateMorePlayers(CurrentUser.Id)) { Common.yvonYmPrompt.AlertError("You are not allowed to create more players!", this.Page, "cleanyvon"); } else if (new AutoBwsBLL.PlayerBLL().AddNewPlayer(player)) { Common.yvonYmPrompt.AlertSuccess("Player created!", this.Page, "cleanyvon"); betEngine.LoginPlayers(new List<Player> {player}); } else { Common.yvonYmPrompt.AlertError("Failed to create player!", this.Page); } } } else { // New player is intended to be attachmented a ghost player.Attachment2Ghost.ghostId = attachment2Id; player.AccountState = "active"; string message; if (!Restrictions.canAttachToGhost(out message, CurrentUser.Id, player.Id, attachment2Id)) { Common.yvonYmPrompt.AlertError(message, this.Page); } else if (!new AutoBwsBLL.PlayerBLL().AddNewPlayer_checkLoginName(loginname)) { player.Attachment2Ghost.ghostId = attachment2Id; if (! Restrictions.canCreateMorePlayers(CurrentUser.Id)) { Common.yvonYmPrompt.AlertSuccess("You are not allowed to create more players!", this.Page, "cleanyvon"); } else if (new AutoBwsBLL.PlayerBLL().AddNewPlayer(player)) { Common.yvonYmPrompt.AlertSuccess("Player created!", this.Page, "cleanyvon"); betEngine.LoginPlayers(new List<Player> {player}); Ghost g = engineBll.getEngineGhostByPlayerID(attachment2Id); Agent a = engineBll.getEngineAgentByID(g.Belong2Agent.Id); betEngine.SetFollowRelationship(player, g, a); } else { Common.yvonYmPrompt.AlertError("Failed to create player!", this.Page); } } else { if (this.lblNew2.Text.Contains("ADD")) { Common.yvonYmPrompt.AlertError("This player already exists!", this.Page); } else { if (new AutoBwsBLL.PlayerBLL().UpdatePlayer(player)) { Common.yvonYmPrompt.AlertSuccess("Player updated!", this.Page, "cleanyvon"); betEngine.LoginPlayers(new List<Player> {player}); Ghost g = engineBll.getEngineGhostByPlayerID(attachment2Id); Agent a = engineBll.getEngineAgentByID(g.Belong2Agent.Id); betEngine.SetFollowRelationship(player, g, a); HttpContext.Current.Response.Redirect("~/files/PlayerList.aspx"); } else { Common.yvonYmPrompt.AlertError("Failed to update player!", this.Page); } } } } // Modify Aorta // if (new AutoBwsBLL.PlayerBLL().AddNewPlayer(player)) //{ //Common.yvonYmPrompt.AlertSuccess("Success!", this.Page, "cleanyvon"); // 添加玩家_引擎 // 1.登录所有玩家 LoginPlayers(List<Player> 玩家列表); // 4.设置player跟随的ghost(一对一) SetFollowRelationship(Player 玩家对象,Ghost 玩家跟注的ghost,Agent ghost所属的agent); // Modify Aorta //List<Player> listPlayer = engineBll.getEnginePlayerFollowGhost(); //if (listPlayer.Count > 0) //{ // betEngine.LoginPlayers(listPlayer); // Ghost g = null; Agent a = null; // for (int i = 0; i < listPlayer.Count; i++) // { // if (listPlayer[i].Attachment2Ghost != null && listPlayer[i].Attachment2Ghost.ghostId > 0) // { // g = engineBll.getEngineGhostByPlayerID(listPlayer[i].Attachment2Ghost.ghostId); // if (g != null && g.ghostId > 0) // { // a = engineBll.getEngineAgentByID(g.Belong2Agent.Id); // if (g.Belong2Agent != null && g.Belong2Agent.Id > 0 && a != null && a.Id > 0) betEngine.SetFollowRelationship(listPlayer[i], g, a); // } // } // } //} //} //else { Common.yvonYmPrompt.AlertError("Add not Success!", this.Page); } //} }
/// <summary> /// 重载构造方法 /// </summary> /// <param name="id"></param> public PlayerBet(int id) : base(id) { IsFollowAdmin = false; Player = new Player(); }
/// <summary> /// 默认构造方法 /// </summary> public Bet() { Ghost = new Ghost(); Player = new Player(); }
public bool UpdatePlayer(Player player) { return pService.UpdatePlayer(player); }
public bool AddNewPlayer(Player player) { return pService.AddNewPlayer(player); }
public bool UpdatePlayerStatus(Player player) { return pService.UpdatePlayerStatus(player); }
/// <summary> /// 根据PlayerName得到Player /// </summary> /// <param name="ghostName">player名称</param> /// <returns>ghost对象</returns> private static Player GetPlayerByPlayerName(string playerName) { PlayerService playerService = new PlayerService(); // 根据ghostName查询ghost DataTable dt = playerService.AddNewPlayer_checkLoginName(playerName); int id = 0; if (dt != null && dt.Rows.Count > 0) { id = System.Convert.ToInt32(dt.Rows[0]["id"]); playerName = dt.Rows[0]["loginName"].ToString(); } Player player = new Player(id); player.LoginName = playerName; return player; }
public List<Player> getEnginePlayerFollowGhost() { DataTable dt = null; List<Player> list = new List<Player>(); DataSet ds = DBHelper.ExecuteDataset(connectStr, CommandType.StoredProcedure, "getEnginePlayerFollowGhost"); if (ds.Tables[0].Rows.Count > 0) { dt = ds.Tables[0]; Player p = null; for (int i = 0; i < dt.Rows.Count; i++) { p = new Player(); p.Id = Convert.ToInt32(dt.Rows[i]["id"]); p.LoginName = Convert.ToString(dt.Rows[i]["loginName"]); p.LoginPwd = Convert.ToString(dt.Rows[i]["loginPwd"]); p.Url = Convert.ToString(dt.Rows[i]["URL"]); p.Urltype = Convert.ToString(dt.Rows[i]["URLType"]); p.PerMatchTarget = Convert.ToString(dt.Rows[i]["perMatchTarget"]); p.Ip = Convert.ToString(dt.Rows[i]["ipAddress"]); p.PercentageHolding = Convert.ToInt32(dt.Rows[i]["percentageHolding"]); p.AccountState = Convert.ToString(dt.Rows[i]["accountState"]); if (DBNull.Value != dt.Rows[i]["attachment2Ghost"]) { p.Attachment2Ghost.ghostId = Convert.ToInt32(dt.Rows[i]["attachment2Ghost"]); } p.Partner.Id = Convert.ToInt32(dt.Rows[i]["belong2Partner"]); p.Logintime = Convert.ToDateTime(dt.Rows[i]["loginTime"] == DBNull.Value ? DateTime.Now : dt.Rows[i]["loginTime"]); p.Remark = Convert.ToString(dt.Rows[i]["remark"] == DBNull.Value ? "" : dt.Rows[i]["remark"]); p.Result = Convert.ToString(dt.Rows[i]["result"] == DBNull.Value ? "" : dt.Rows[i]["result"]); p.Balance = Convert.ToDouble(dt.Rows[i]["balance"]); p.IsBetFollowAdmin = Convert.ToBoolean(dt.Rows[i]["isBetFollowAdmin"]); list.Add(p); } } return list; }
/// <summary> /// 默认构造方法 /// </summary> public PlayerBet() : base() { Player = new Player(); }
public Player SetModel(DataRow r) { Player mdl = new AutoBwsModel.Player(); mdl.Id = Convert.ToInt32(r["id"].ToString()); mdl.LoginName = r["loginName"].ToString(); mdl.LoginPwd = r["loginPwd"].ToString(); mdl.UserId = Convert.ToInt32(r["UserId"].ToString()); mdl.Url = r["Url"].ToString(); mdl.Urltype = r["URLType"].ToString(); mdl.PerMatchTarget = r["perMatchTarget"].ToString(); mdl.Ip = r["IP"].ToString(); mdl.Ip = r["ipAddress"].ToString(); mdl.PercentageHolding = Convert.ToInt32(r["percentageHolding"].ToString()); mdl.AccountState = r["accountState"].ToString(); // mdl.Attachment2Ghost=r[""] mdl.LoginState = r["loginState"].ToString(); mdl.Result = r["result"].ToString(); mdl.Result = r["remark"].ToString(); mdl.Logintime = Convert.ToDateTime(r["loginTime"].ToString()); mdl.Balance = Convert.ToDouble(r["balance"].ToString()); mdl.IsBetFollowAdmin = (r["isBetFollowAdmin"].ToString() == "" || Convert.ToInt32(r["isBetFollowAdmin"].ToString()) > 0) ? false : true; mdl.GhostName = r["GhostName"].ToString(); mdl.PartnerName = r["PartnerName"].ToString(); return mdl; }
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(); } }
public bool UpdatePlayer(Player player) { bool flag = false; MySqlParameter[] parms = new MySqlParameter[] { new MySqlParameter("@_id", player.Id), new MySqlParameter("@_loginPwd", player.LoginPwd), new MySqlParameter("@_url", player.Url), // new MySqlParameter("@_type", player.Urltype), // new MySqlParameter("@_ip",player.Ip), new MySqlParameter("@_perMatchTarget", player.PerMatchTarget), // new MySqlParameter("@_percentageHolding", player.PercentageHolding), // new MySqlParameter("@_accountState", player.AccountState), new MySqlParameter("@_attachement2Ghost", player.Attachment2Ghost.ghostId) // new MySqlParameter("@_belong2Partner", player.Partner.Id), // new MySqlParameter("@_isBetFllowAdmin", player.IsBetFollowAdmin), // new MySqlParameter("@_loginName", player.LoginName.ToLower()) }; try { if (DBHelper.ExecuteNonQuery(connectStr, CommandType.StoredProcedure, "UpdatePlayerByPrimaryKey", parms) != 0) flag = true; } catch { throw; } return flag; }
public void LogoutPlayer(Player player) { Dictionary<string, PlayerConvert> playerConverts = gamerVariable.getGamerList(); if (playerConverts.ContainsKey(player.LoginName)) { WebSiteAbstractClass webSiteAbstractClass = playerConverts[player.LoginName].WebSite; if (null != webSiteAbstractClass) { webSiteAbstractClass.set_IsAutoBetting(false); webSiteAbstractClass.set_IsAutoReLogin(false); webSiteAbstractClass.Logout(); } playerConverts.Remove(player.LoginName); if (timerList.ContainsKey(player.LoginName)) { ITimerInterface playerTimer = timerList[player.LoginName]; playerTimer.StopTimer(); } foreach (var playerConvert in playerConverts.Values) { webSiteAbstractClass = playerConvert.WebSite; if (webSiteAbstractClass.get_IsLoginSuccess()) { webSiteAbstractClass.set_IsToGetMatchResultList(true); break; } } } }
/// <summary> /// 更新玩家登录状态 /// </summary> /// <param name="player">玩家对象</param> /// <returns></returns> public bool UpdatePlayerLoginStatus(Player player) { bool isSuccess = false; bool loginState = (player.LoginState == "1") ? true : false; MySqlParameter[] parms = new MySqlParameter[] { new MySqlParameter("@_id", player.Id), new MySqlParameter("@_result", player.Result), new MySqlParameter("@_remark", player.Remark), new MySqlParameter("@_loginTime", DateTime.Now), new MySqlParameter("@_loginState", loginState), }; try { if (DBHelper.ExecuteNonQuery(connectStr, CommandType.StoredProcedure, "UpdatePlayerLoginStatus", parms) != 0) { isSuccess = true; } } catch { throw; } return isSuccess; }
public void LogoutPlayer(Player player) { }
/// <summary> /// Update player status (active/suspended/closed) /// </summary> /// <param name="player">玩家对象</param> /// <returns></returns> public bool UpdatePlayerStatus(Player player) { bool isSuccess = false; MySqlParameter[] parms = new MySqlParameter[] { new MySqlParameter("@_id", player.Id), new MySqlParameter("@_accountState", player.AccountState) }; try { if (DBHelper.ExecuteNonQuery(connectStr, CommandType.StoredProcedure, "UpdatePlayerStatus", parms) != 0) { isSuccess = true; } } catch { throw; } return isSuccess; }
/// <summary> ///重载构造方法 /// </summary> public PlayerConvert(Player player) { member = new Member(); this.Player = player; }
/// <summary> /// 记录Player登录信息 /// </summary> /// <param name="agent"></param> /// <returns></returns> public static bool SavePlayerLoginMessage(Player player) { bool isSuccess = false; try { // 创建Agent数据访问对象 PlayerService playerService = new PlayerService(); isSuccess = playerService.UpdatePlayerLoginStatus(player); } catch (Exception e) { throw; } return isSuccess; }