Exemplo n.º 1
0
 public bool AddNewAgent(Agent agent)
 {
     bool flag = false;
     MySqlParameter[] parms = new MySqlParameter[]
                              	{
                              		new MySqlParameter("@ybelong2Partner", MySqlDbType.VarChar, 20), //账户类型
                              		new MySqlParameter("@yloginName", MySqlDbType.VarChar, 20), //登录名
                              		new MySqlParameter("@yloginPwd", MySqlDbType.VarChar, 20), //密码
                              		new MySqlParameter("@yurl", MySqlDbType.VarChar, 100), //URL
                              		new MySqlParameter("@ytype", MySqlDbType.VarChar, 100),
                              		new MySqlParameter("@yip", MySqlDbType.VarChar, 20)
                              	};
     parms[0].Value = agent.Partner.LoginName;
     parms[1].Value = agent.LoginName.ToLower();
     parms[2].Value = agent.LoginPwd.ToLower();
     parms[3].Value = agent.Url;
     parms[4].Value = agent.UrlType;
     parms[5].Value = agent.Ip;
     try
     {
         if (DBHelper.ExecuteNonQuery(connectStr, CommandType.StoredProcedure, "addNewAgent", parms) != 0) flag = true;
     }
     catch
     {
         throw;
     }
     return flag;
 }
Exemplo n.º 2
0
 public Agent getEngineAgentByID(int id)
 {
     DataTable dt = null;
     Agent a = null;
     string sql = string.Format("select agent.*, ip.ip as ipAddress from agent, ip where agent.id={0} and ip.id = agent.IP", 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)
         {
             a = new Agent();
             a.Id = Convert.ToInt32(dt.Rows[0]["id"]);
             a.Partner.Id = Convert.ToInt32(dt.Rows[0]["belong2Partner"]);
             a.Url = Convert.ToString(dt.Rows[0]["URL"]);
             a.Ip = Convert.ToString(dt.Rows[0]["ipAddress"]);
             a.LogingState = Convert.ToBoolean(dt.Rows[0]["loginState"]);
             a.State = Convert.ToString(dt.Rows[0]["state"]);
             a.LoginTime = Convert.ToDateTime(dt.Rows[0]["loginTime"] == DBNull.Value ? DateTime.Now : dt.Rows[0]["loginTime"]);
             a.LoginName = Convert.ToString(dt.Rows[0]["loginName"]);
             a.LoginPwd = Convert.ToString(dt.Rows[0]["loginPwd"]);
             a.Remark = Convert.ToString(dt.Rows[0]["remark"] == DBNull.Value ? "" : dt.Rows[0]["remark"]);
             a.Result = Convert.ToString(dt.Rows[0]["result"] == DBNull.Value ? "" : dt.Rows[0]["result"]);
         }
     }
     return a;
 }
Exemplo n.º 3
0
 public List<Agent> getEngineAgent()
 {
     DataTable dt = null;
     List<Agent> list = new List<Agent>();
     DataSet ds = DBHelper.ExecuteDataset(connectStr, CommandType.Text,
                                          "select agent.*, ip.ip as ipAddress from agent, ip where agent.state='active' and ip.id = agent.ip;");
     if (ds.Tables[0].Rows.Count > 0)
     {
         dt = ds.Tables[0];
         Agent a = null;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             a = new Agent();
             a.Id = Convert.ToInt32(dt.Rows[i]["id"]);
             a.Partner.Id = Convert.ToInt32(dt.Rows[i]["belong2Partner"]);
             a.Url = Convert.ToString(dt.Rows[i]["URL"]);
             a.UrlType = Convert.ToString(dt.Rows[i]["urlType"]);
             a.Ip = Convert.ToString(dt.Rows[i]["ipAddress"]);
             a.LogingState = Convert.ToBoolean(dt.Rows[i]["loginState"]);
             a.State = Convert.ToString(dt.Rows[i]["state"]);
             a.LoginTime = Convert.ToDateTime(dt.Rows[i]["loginTime"] == DBNull.Value ? DateTime.Now : dt.Rows[i]["loginTime"]);
             a.LoginName = Convert.ToString(dt.Rows[i]["loginName"]);
             a.LoginPwd = Convert.ToString(dt.Rows[i]["loginPwd"]);
             a.Remark = Convert.ToString(dt.Rows[i]["remark"] == DBNull.Value ? "" : dt.Rows[i]["remark"]);
             a.Result = Convert.ToString(dt.Rows[i]["result"] == DBNull.Value ? "" : dt.Rows[i]["result"]);
             list.Add(a);
         }
     }
     return list;
 }
Exemplo n.º 4
0
        public void bindGVLoginAgent()
        {
            string userType = getUserType(Page);
            List<Agent> agentList = new List<Agent>();
            DataTable tb = bvBLL.getLoginFailureAgent();
            if ("P".Equals(userType))
            {
                divAgent.Visible = false;
            }

            if (null != tb && tb.Rows.Count > 0)
            {
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    Agent agent = new Agent();
                    agent.Id = Convert.ToInt32(tb.Rows[i]["id"]);
                    agent.LoginName = Convert.ToString(tb.Rows[i]["loginName"]);
                    UserInfo partner = new UserInfo();
                    partner.ParentId = Convert.ToInt32(tb.Rows[i]["parentId"]);
                    partner.LoginName = Convert.ToString(tb.Rows[i]["Partner"]);
                    agent.Partner = partner;
                    if (tb.Rows[i]["loginTime"] != DBNull.Value)
                    {
                        agent.LoginTime = Convert.ToDateTime(tb.Rows[i]["loginTime"]);
                    }
                    agent.Result = Convert.ToString(tb.Rows[i]["result"]);
                    agent.Remark = Convert.ToString(tb.Rows[i]["remark"]);
                    if (userType.EndsWith("S"))
                    {
                        agentList.Add(agent);
                    }
                    else if (userType.EndsWith("A"))
                    {
                        UserInfo currentUser = (Session["currentUser"]) as UserInfo;
                        if (null != currentUser && currentUser.Id == partner.ParentId)
                        {
                            agentList.Add(agent);
                        }
                    }
                    else
                    {
                        UserInfo currentUser = (Session["currentUser"]) as UserInfo;
                        if (null != currentUser && currentUser.LoginName == partner.LoginName)
                        {
                            agentList.Add(agent);
                        }
                    }
                }
            }

            this.GVLoginAgent.DataSource = agentList;
            this.GVLoginAgent.DataBind();
        }
Exemplo n.º 5
0
 public Agent getAgentDetail(string loginName)
 {
     DataTable dt = aService.AddNewAgent_checkLoginName(loginName);
     Agent agent = new Agent();
     agent.LoginName = loginName;
     agent.Id = Convert.ToInt32(dt.Rows[0]["id"]);
     agent.LoginPwd = Convert.ToString(dt.Rows[0]["loginPwd"]);
     agent.Partner.LoginName = Convert.ToString(dt.Rows[0]["belong2Partner"]);
     agent.State = Convert.ToString(dt.Rows[0]["state"]);//账户状态[active/suspended/closed]
     agent.Url = Convert.ToString(dt.Rows[0]["URL"]);
     agent.LogingState = Convert.ToBoolean(dt.Rows[0]["loginState"]);
     agent.Ip = Convert.ToString(dt.Rows[0]["ip"]);
     agent.Ip = Convert.ToString(dt.Rows[0]["ipAddress"]);
     agent.UrlType = Convert.ToString(dt.Rows[0]["urlType"]);
     return agent;
 }
Exemplo n.º 6
0
 public void LogoutAgent(Agent agent)
 {
 }
Exemplo n.º 7
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);
                    }
                }
            }
        }
Exemplo n.º 8
0
        public void RefreshGhosts(Agent agent, List<Ghost> ghosts)
        {
            Dictionary<string,AgentConvert> agentConverts = agentVariable.getAgentList();
            if (agentConverts.ContainsKey(agent.LoginName))
            {
                AgentConvert agentConvert = agentConverts[agent.LoginName];
                Dictionary<string,GhostConvert> oldGhost = agentConvert.Ghosts;

                // 新增ghost
                foreach (var ghost in ghosts)
                {
                    if (null != ghost.GhostName && !oldGhost.ContainsKey(ghost.GhostName))
                    {
                        GhostConvert ghostConvert = new GhostConvert(ghost);
                        ghostConvert.AgentConvert = agentConvert;
                        oldGhost.Add(ghost.GhostName, ghostConvert);
                    }
                }

                // 设置IBC代理下的博彩网站下注规则
                agentVariable.setWebSiteBetStyleList(agentConvert);
            }
        }
Exemplo n.º 9
0
        public void LogoutAgent(Agent agent)
        {
            Dictionary<string, AgentConvert> agentConverts = agentVariable.getAgentList();
            if (agentConverts.ContainsKey(agent.LoginName))
            {
                AgentSiteAbstractClass agentSiteAbstractClass = agentConverts[agent.LoginName].AgentSite;
                if (null != agentSiteAbstractClass)
                {
                    agentSiteAbstractClass.set_IsAutoReLogin(false);
                    agentSiteAbstractClass.Logout();
                }

                agentConverts.Remove(agent.LoginName);

                if (timerList.ContainsKey(agent.LoginName))
                {
                    ITimerInterface playerTimer = timerList[agent.LoginName];
                    playerTimer.StopTimer();
                }
            }
        }
Exemplo n.º 10
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));
            }
        }
Exemplo n.º 11
0
 public AgentConvert(Agent agent)
 {
     Agent = agent;
     ghosts = new Dictionary<string, GhostConvert>();
 }
Exemplo n.º 12
0
 /// <summary>
 /// 默认构造方法
 /// </summary>
 public AgentConvert()
 {
     Agent = new Agent();
     ghosts = new Dictionary<string, GhostConvert>();
 }
Exemplo n.º 13
0
 public bool UpdateAgent(Agent agent)
 {
     return aService.UpdateAgent(agent);
 }
Exemplo n.º 14
0
 public Ghost(int id)
 {
     this.belong2Agent = new Agent();
     this.ghostId = id;
     IsOppositeBet = false;
 }
Exemplo n.º 15
0
 public void RefreshGhosts(Agent agent, List<Ghost> ghosts)
 {
 }
Exemplo n.º 16
0
 /// <summary>
 /// 构造函数gamer.UserName
 /// </summary>
 public Ghost()
 {
     this.belong2Agent = new Agent();
     IsOppositeBet = false;
 }
Exemplo n.º 17
0
        /// <summary>
        /// 记录Agent登录信息
        /// </summary>
        /// <param name="agent"></param>
        /// <returns></returns>
        public static bool SaveAgentLoginMessage(Agent agent)
        {
            bool isSuccess = false;
            try
            {
                // 创建Agent数据访问对象
                AgentService agentService = new AgentService();
                isSuccess = agentService.UpdateAgentLoginStatus(agent);
            }
            catch (Exception e)
            {

                throw;
            }

            return isSuccess;
        }
Exemplo n.º 18
0
 private Agent SetModel(DataRow r)
 {
     Agent agModel = new Agent();
     agModel.Id = Convert.ToInt32(r["id"]);
     agModel.UserId = Convert.ToInt32(r["belong2Partner"]);
     agModel.Url = r["URL"].ToString();
     agModel.Ip = r["IP"].ToString();
     agModel.LogingState = Convert.ToBoolean(r["loginState"]);
     agModel.State = r["state"].ToString();
     agModel.LoginTime = Convert.ToDateTime(r["loginTime"]);
     agModel.LoginName = r["loginName"].ToString();
     agModel.LoginPwd = r["loginPwd"].ToString();
     agModel.Result = r["result"].ToString();
     agModel.Remark = r["remark"].ToString();
     return agModel;
 }
Exemplo n.º 19
0
        public bool UpdateAgentLoginStatus(Agent agent)
        {
            bool isSuccess = false;

            MySqlParameter[] parms = new MySqlParameter[]
                                     	{
                                     		new MySqlParameter("@_id", agent.Id),
                                     		new MySqlParameter("@_result", agent.Result),
                                     		new MySqlParameter("@_remark", agent.Remark),
                                     		new MySqlParameter("@_loginTime", DateTime.Now),
                                     		new MySqlParameter("@_loginState", agent.LogingState),
                                     	};

            try
            {
                if (DBHelper.ExecuteNonQuery(connectStr, CommandType.StoredProcedure, "UpdateAgentLoginStatus", parms) != 0)
                {
                    isSuccess = true;
                }
            }
            catch
            {
                throw;
            }
            return isSuccess;
        }
Exemplo n.º 20
0
        public bool UpdateAgent(Agent agent)
        {
            bool isSuccess = false;
            MySqlParameter[] parms = new MySqlParameter[]
                                     	{
                                     		new MySqlParameter("@ybelong2Partner", MySqlDbType.VarChar, 20), //账户类型
                                     		new MySqlParameter("@yloginName", MySqlDbType.VarChar, 20), //登录名
                                     		new MySqlParameter("@yloginPwd", MySqlDbType.VarChar, 20), //密码
                                     		new MySqlParameter("@yURL", MySqlDbType.VarChar, 100), //URL
                                     		new MySqlParameter("@ytype", MySqlDbType.VarChar, 100),
                                     		new MySqlParameter("@yIP", MySqlDbType.VarChar, 20),
                                     		new MySqlParameter("@ystate", MySqlDbType.Bit, 1)
                                     	};
            //            parms[0].Value = agent.Partner.LoginName;
            parms[1].Value = agent.LoginName.ToLower();
            parms[2].Value = agent.LoginPwd.ToLower();
            parms[3].Value = agent.Url;
            //            parms[4].Value = agent.UrlType;
            //            parms[5].Value = agent.Ip;
            //            parms[6].Value = agent.State;

            try
            {
                if (DBHelper.ExecuteNonQuery(connectStr, CommandType.StoredProcedure, "updateAgent", parms) != 0)
                    isSuccess = true;
            }
            catch
            {
                throw;
            }

            return isSuccess;
        }
Exemplo n.º 21
0
 public void SetFollowRelationship(Player player, Ghost ghost, Agent agent)
 {
 }
Exemplo n.º 22
0
 public bool AddNewAgent(Agent agent)
 {
     return aService.AddNewAgent(agent);
 }