Exemple #1
0
 /// <summary>
 /// 默认构造方法
 /// </summary>
 public GhostBet()
 {
     SportType = "Soccer";
        BetType = "1";
        MatchType = "Handicap";
        OddsType = "MY";
        IsOutstanding = true;
        Ghost = new Ghost();
 }
Exemple #2
0
 public bool AddNewGhost(Ghost ghost)
 {
     bool flag = false;
     MySqlParameter[] parms = new MySqlParameter[]
                              	{
                              		new MySqlParameter("@yghostName", MySqlDbType.VarChar, 20),
                              		new MySqlParameter("@yrealBetAccount", MySqlDbType.Int32, 10),
                              		new MySqlParameter("@ybelongToAgent", MySqlDbType.VarChar, 20),
                              		new MySqlParameter("@yFollowMethod", MySqlDbType.Bit, 1)
                              	};
     parms[0].Value = ghost.GhostName;
     parms[1].Value = ghost.RealBetAccount;
     parms[2].Value = ghost.Belong2Agent.LoginName;
     parms[3].Value = ghost.IsOppositeBet;
     try
     {
         if (DBHelper.ExecuteNonQuery(connectStr, CommandType.StoredProcedure, "addNewGhost", parms) != 0) flag = true;
     }
     catch
     {
         throw;
     }
     return flag;
 }
Exemple #3
0
 public void SetFollowRelationship(Player player, Ghost ghost, Agent agent)
 {
 }
Exemple #4
0
        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);
                    }
                }
            }
        }
Exemple #5
0
 public int updateGhostById(Ghost ghost, int ghostId)
 {
     return  DBHelper.ExecuteNonQuery(connectStr,CommandType.Text,string.Format("update ghost set realBetAccount={0},FollowMethod={1} where id={2}", ghost.RealBetAccount, ghost.IsOppositeBet,ghostId));
 }
Exemple #6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            #region Agent实体

            string loginname = this.txtloginName.Text.Trim().ToLower();
            string loginpwd = this.txtloginPwd.Text.Trim().ToLower();
            string url = this.ddlURL.SelectedValue;
            //			string ip = this.ddlIP.SelectedValue;

            #endregion

            #region ghost实体

            string ghost1 = this.txtghost1.Text.Trim();
            string ghost2 = this.txtghost2.Text.Trim();
            string ghost3 = this.txtghost3.Text.Trim();
            string ghost4 = this.txtghost4.Text.Trim();
            string ghost5 = this.txtghost5.Text.Trim();

            string realbet1 = string.IsNullOrEmpty(this.txtRealBet1.Text.Trim()) ? "1000" : this.txtRealBet1.Text.Trim();
            string realbet2 = string.IsNullOrEmpty(this.txtRealBet2.Text.Trim()) ? "1000" : this.txtRealBet2.Text.Trim();
            string realbet3 = string.IsNullOrEmpty(this.txtRealBet3.Text.Trim()) ? "1000" : this.txtRealBet3.Text.Trim();
            string realbet4 = string.IsNullOrEmpty(this.txtRealBet4.Text.Trim()) ? "1000" : this.txtRealBet4.Text.Trim();
            string realbet5 = string.IsNullOrEmpty(this.txtRealBet5.Text.Trim()) ? "1000" : this.txtRealBet5.Text.Trim();

            bool reverse1 = this.ckReverse1.Checked;
            bool reverse2 = this.ckReverse2.Checked;
            bool reverse3 = this.ckReverse3.Checked;
            bool reverse4 = this.ckReverse4.Checked;
            bool reverse5 = this.ckReverse5.Checked;

            #endregion

            Agent agent = new Agent();
            agent.LoginName = loginname;
            agent.LoginPwd = loginpwd;
            agent.Partner = new UserInfo();

            if (HttpContext.Current.Session["currentUser"] == null)
                HttpContext.Current.Response.Redirect("~/Default.aspx");
            else
                agent.Partner.LoginName = ((UserInfo) HttpContext.Current.Session["currentUser"]).LoginName;

            agent.Url = url;
            var query = from yvon in (new AutoBwsBLL.IPURLBLL().getURLs(true)).AsEnumerable()
                        where yvon.Field<string>("url") == url
                        select yvon.Field<string>("type");
            foreach (var item in query)
            {
                agent.UrlType = item.ToString();
            }

            // IP address is set in mysql stored procedure addNewAgent

            string ghostno = "";
            string insertNo = string.Empty;
            List<Ghost> listGhost = new List<Ghost>();
            string[] names = {ghost1, ghost2, ghost3, ghost4, ghost5};
            string[] realbets = {realbet1, realbet2, realbet3, realbet4, realbet5};
            bool[] reverses = {reverse1, reverse2, reverse3, reverse4, reverse5};
            bool noDuplicates = true;
            for (int i = 0; i < names.Length; i++)
            {
                if (!string.IsNullOrEmpty(names[i]))
                {
                    // check duplicates within the 5:
                    for (int j = names.Length - 1; j > i; j--)
                    {
                        if (names[i].Equals(names[j]))
                        {
                            noDuplicates = false;
                            break;
                        }
                    }
                    if (!noDuplicates)
                    {
                        break;
                    }
                    Ghost g = new Ghost();
                    g.GhostName = names[i];
                    if (new AutoBwsBLL.GhostBLL().AddNewGhost_checkLoginName(g.GhostName, url))
                    {
                        if (ghostno.Length ==0)
                        {
                            ghostno = g.GhostName;
                        }
                        else
                        {
                            ghostno += "," + g.GhostName;
                        }
                        if (lblAgent2.Text.Contains("ADD")) break;
                    }
                    else
                    {
                        g.IsOppositeBet = reverses[i];
                        g.RealBetAccount = Convert.ToInt32(realbets[i]);
                        g.Belong2Agent.LoginName = loginname;
                        insertNo += "," + names[i];
                        listGhost.Add(g);
                    }
                }
            }

            List<Agent> listAgent = new List<Agent>();
            if (lblAgent2.Text.Contains("ADD"))
            {
                if (!noDuplicates)
                {
                    Common.yvonYmPrompt.AlertError("There is a duplicate amoung your ghost login ids, please remove it!", this.Page);
                }
                else if (ghostno.Length != 0)
                {
                    Common.yvonYmPrompt.AlertError("Ghost "+ghostno+" already exists, please remove it from your new ghosts entry!", this.Page);
                }
                else
                {
                    if (new AutoBwsBLL.AgentBLL().AddNewAgent_checkLoginName(loginname))
                    {
                        Common.yvonYmPrompt.AlertError("The agent already exists!", this.Page);
                    }
                    else
                    {
                        // todo need to use 1 big transaction to do the adding
                        if (new AutoBwsBLL.AgentBLL().AddNewAgent(agent))
                        {
                            listAgent.Add(agent);
                            foreach (var item in listGhost)
                            {
                                new AutoBwsBLL.GhostBLL().AddNewGhost(item);
                            }

                            Common.yvonYmPrompt.AlertSuccess("Agent created!", this.Page, "cleanyvon");
                        }
                        else
                        {
                            Common.yvonYmPrompt.AlertError("Failed to create agent!", this.Page);
                        }
                    }
                }
            }
            else
            {
                // todo need to use 1 big transaction to do the adding
                if (!noDuplicates)
                {
                    Common.yvonYmPrompt.AlertError("There is a duplicate amoung your ghost login ids, please remove it!", this.Page);
                }
                else if (ghostno.Length != 0)
                {
                    Common.yvonYmPrompt.AlertError("Ghost "+ghostno+" already exists, please remove it from your new ghosts entry!", this.Page);
                }
                else if (new AutoBwsBLL.AgentBLL().UpdateAgent(agent))
                {
                    listAgent.Add(agent);
                    foreach (var item in listGhost)
                    {
                        new AutoBwsBLL.GhostBLL().AddNewGhost(item);
                    }
                    Common.yvonYmPrompt.AlertSuccess("Agent updated!", this.Page, "cleanyvon");
                    HttpContext.Current.Response.Redirect("~/files/AgentList.aspx");
                }
                else
                {
                    Common.yvonYmPrompt.AlertError("Failed to update agent!", this.Page);
                }
            }
            // 添加Agent_引擎
            // 2.登录所有Agent LoginAgents(List<Agent> agent列表);
            // 3.Agent监测的ghost列表  RefreshGhosts(Agent agent对象,List<Ghost> ghosts agent监测的列表);
            betEngine.LoginAgents(listAgent);
            for (int i = 0; i < listAgent.Count; i++)
            {
                if (listAgent[i].Id > 0 && engineBll.getEngineGhostByAgentID(listAgent[i].Id).Count > 0)
                    betEngine.RefreshGhosts(listAgent[i], engineBll.getEngineGhostByAgentID(listAgent[i].Id));
            }
        }
Exemple #7
0
        protected void save_Click(object sender, EventArgs e)
        {
            Button button = sender as Button;
            string id = button.CommandArgument;

            Ghost ghost = new Ghost();
            ghost.ghostId = Convert.ToInt32(id);
            int rowIndex = 0;

            for (int i = 0; i < this.GridView1.Rows.Count; i ++ )
            {
                Button tempButton = this.GridView1.Rows[i].Cells[3].FindControl("save") as Button;
                if (null != tempButton && id == tempButton.CommandArgument)
                {
                    rowIndex = i;
                    break;
                }
            }

            TextBox realBetAccount = this.GridView1.Rows[rowIndex].FindControl("txtRealBetAccount") as TextBox;
            if(null != realBetAccount)
            {
                ghost.RealBetAccount = Convert.ToInt32(realBetAccount.Text);
            }
            CheckBox reverseBet = this.GridView1.Rows[rowIndex].FindControl("chkReverseBet") as CheckBox;
            if (null != realBetAccount)
            {
                ghost.IsOppositeBet = reverseBet.Checked;
            }

            if (new AutoBwsBLL.GhostBLL().updateGhost(ghost) > 0)
            {
                string js = string.Format("<script>document.getElementById('{0}').value='{1}';document.getElementById('{2}').checked={3};</script>", realBetAccount.ClientID, realBetAccount.Text, reverseBet.ClientID, reverseBet.Checked);
                this.ClientScript.RegisterStartupScript(this.GetType(), "onload", js);
                //Common.yvonYmPrompt.AlertSuccess("Ghost updated!", this.Page, "cleanyvon");
            }
        }
Exemple #8
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public GhostConvert(Ghost ghost)
 {
     this.member = new Member();
     this.Ghost = ghost;
     gamers = new Dictionary<string, PlayerConvert>();
 }
Exemple #9
0
 public Ghost getEngineGhostByPlayerID(int id)
 {
     DataTable dt = null;
     Ghost g = null;
     string sql = string.Format("select * from ghost where id={0};", id);
     DataSet ds = DBHelper.ExecuteDataset(connectStr, CommandType.Text, sql);
     if (ds.Tables[0].Rows.Count > 0)
     {
         dt = ds.Tables[0];
         if (dt.Rows.Count > 0)
         {
             g = new Ghost();
             g.ghostId = Convert.ToInt32(dt.Rows[0]["id"]);
             g.GhostName = Convert.ToString(dt.Rows[0]["ghostName"]);
             g.RealBetAccount = Convert.ToInt32(dt.Rows[0]["realBetAccount"]);
             g.Belong2Agent.Id = Convert.ToInt32(dt.Rows[0]["belongToAgent"]);
             g.IsOppositeBet = Convert.ToBoolean(dt.Rows[0]["FollowMethod"]);
             g.State = Convert.ToString(dt.Rows[0]["state"]);
         }
     }
     return g;
 }
Exemple #10
0
 public List<Ghost> getEngineGhostByAgentID(int id)
 {
     DataTable dt = null;
     List<Ghost> list = new List<Ghost>();
     string sql = string.Format("select * from ghost where state<>'closed' and belongToAgent={0};", id);
     DataSet ds = DBHelper.ExecuteDataset(connectStr, CommandType.Text, sql);
     if (ds.Tables[0].Rows.Count > 0)
     {
         dt = ds.Tables[0];
         Ghost g = null;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             g = new Ghost();
             g.ghostId = Convert.ToInt32(dt.Rows[i]["id"]);
             g.GhostName = Convert.ToString(dt.Rows[i]["ghostName"]);
             g.RealBetAccount = Convert.ToInt32(dt.Rows[i]["realBetAccount"]);
             g.Belong2Agent.Id = Convert.ToInt32(dt.Rows[i]["belongToAgent"]);
             g.IsOppositeBet = Convert.ToBoolean(dt.Rows[i]["FollowMethod"]);
             g.State = Convert.ToString(dt.Rows[i]["state"]);
             list.Add(g);
         }
     }
     return list;
 }
Exemple #11
0
 public bool AddNewGhost(Ghost ghost)
 {
     return gService.AddNewGhost(ghost);
 }
Exemple #12
0
 public int updateGhost(Ghost ghost)
 {
     return new GhostService().updateGhostById(ghost,ghost.ghostId);
 }
Exemple #13
0
 public ProfitReport(int id)
 {
     Id = id;
     Player = new Player();
     Ghost = new Ghost();
 }
Exemple #14
0
 public ProfitReport()
 {
     Player = new Player();
     Ghost = new Ghost();
 }
Exemple #15
0
 /// <summary>
 /// 默认构造方法
 /// </summary>
 public Bet()
 {
     Ghost = new Ghost();
        Player = new Player();
 }
Exemple #16
0
 /// <summary>
 /// 根据GhostName得到Ghost
 /// </summary>
 /// <param name="ghostName">ghost名称</param>
 /// <returns>ghost对象</returns>
 private static Ghost GetGhostByGhostName(string ghostName, string agentURL)
 {
     GhostService ghostService = new GhostService();
     // 根据ghostName查询ghost
     DataTable dt = ghostService.AddNewGhost_checkLoginName(ghostName, agentURL);
     int id = 0;
     if (dt != null && dt.Rows.Count > 0)
     {
         id = System.Convert.ToInt32(dt.Rows[0]["id"]);
         ghostName = dt.Rows[0]["ghostName"].ToString();
     }
     Ghost ghost = new Ghost(id);
     ghost.GhostName = ghostName;
     return ghost;
 }