Ejemplo n.º 1
0
        /// <summary>
        /// 获取全部推广人数
        /// </summary>
        /// <param name="UserId">用Id</param>
        /// <returns>返回推广人数</returns>
        public Double GetAllSpreadCount(int UserId)
        {
            GameUserServers gus = new GameUserServers();
            GameUser        gu  = gus.GetGameUser(UserId);

            try
            {
                if (gu.IsSpreader == 1)
                {
                    string         sql = "select count(*) from game_users where source=@UserId";
                    SqlParameter[] sp  = new SqlParameter[] {
                        new SqlParameter("@UserId", UserId)
                    };
                    return(db.ExecuteScalar(sql, sp));
                }
                else if (gu.IsSpreader == 2)
                {
                    Double          SpreadCount = 0;
                    List <GameUser> list        = new List <GameUser>();
                    list = gus.GetSpreadUser(UserId);
                    list.Add(gu);
                    foreach (GameUser gameuser in list)
                    {
                        string         sql = "select count(*) from game_users where source=@UserId";
                        SqlParameter[] sp  = new SqlParameter[] {
                            new SqlParameter("@UserId", gameuser.Id)
                        };
                        SpreadCount += db.ExecuteScalar(sql, sp);
                    }
                    return(SpreadCount);
                }
                else
                {
                    return(0);
                }
            }
            catch (SqlException ex)
            {
                throw new Exception("数据库异常!原因:" + ex.Message);
            }
            catch (Exception ex)
            {
                throw new Exception("未知异常!原因:" + ex.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取推广员的推广总额
        /// </summary>
        /// <param name="UserId">用户Id</param>
        /// <returns>返回总金额</returns>
        public Double GetSumMoney(int UserId, string WhereStr)
        {
            GameUserServers gus = new GameUserServers();
            GameUser        gu  = gus.GetGameUser(UserId);

            try
            {
                if (gu.IsSpreader == 1)
                {
                    string sql = "select ISNULL(sum(o.paymoney),0) from orders as o, game_users as gu where o.username in" +
                                 "(select username from game_users where source=@UserId)and o.state=2 and o.orderno like 'G%' and o.username=gu.username and o.gameid = gu.reggame and gu.isspreader=0 " + WhereStr;
                    SqlParameter[] sp = new SqlParameter[] {
                        new SqlParameter("@UserId", UserId)
                    };
                    return(db.ExecuteScalar(sql, sp));
                }
                else if (gu.IsSpreader == 2)
                {
                    Double          SpreadMoney = 0;
                    List <GameUser> list        = new List <GameUser>();
                    list = gus.GetSpreadUser(UserId);
                    foreach (GameUser gameuser in list)
                    {
                        SpreadMoney += GetSumMoney(gameuser.Id, WhereStr);
                    }
                    return(SpreadMoney);
                }
                else
                {
                    string         sql = "select ISNULL(sum(o.paymoney),0) from orders as o, game_users as gu where o.username=@UserName and o.state=2 and o.orderno like 'G%' and o.username=gu.username and o.gameid = gu.reggame and gu.isspreader=0 " + WhereStr;
                    SqlParameter[] sp  = new SqlParameter[] {
                        new SqlParameter("@UserName", gu.UserName)
                    };
                    return(db.ExecuteScalar(sql, sp));
                }
            }
            catch (SqlException ex)
            {
                throw new Exception("数据库异常!原因:" + ex.Message);
            }
            catch (Exception ex)
            {
                throw new Exception("未知异常!原因:" + ex.Message);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取全部推广人数
        /// </summary>
        /// <param name="UserId">用Id</param>
        /// <returns>返回推广人数</returns>
        public Double GetAllSpreadCount(int UserId)
        {
            GameUserServers gus = new GameUserServers();
            GameUser gu = gus.GetGameUser(UserId);
            try
            {
                if (gu.IsSpreader == 1)
                {
                    string sql = "select count(*) from game_users where source=@UserId";
                    SqlParameter[] sp = new SqlParameter[] {
                     new SqlParameter("@UserId",UserId)
                    };
                    return db.ExecuteScalar(sql, sp);
                }
                else if (gu.IsSpreader == 2)
                {
                    Double SpreadCount = 0;
                    List<GameUser> list = new List<GameUser>();
                    list = gus.GetSpreadUser(UserId);
                    list.Add(gu);
                    foreach (GameUser gameuser in list)
                    {
                        string sql = "select count(*) from game_users where source=@UserId";
                        SqlParameter[] sp = new SqlParameter[] {
                         new SqlParameter("@UserId",gameuser.Id)
                        };
                        SpreadCount += db.ExecuteScalar(sql, sp);
                    }
                    return SpreadCount;
                }
                else
                {
                    return 0;
                }

            }
            catch (SqlException ex)
            {
                throw new Exception("数据库异常!原因:" + ex.Message);
            }
            catch (Exception ex)
            {
                throw new Exception("未知异常!原因:" + ex.Message);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 获取推广员的推广总额
 /// </summary>
 /// <param name="UserId">用户Id</param>
 /// <returns>返回总金额</returns>
 public Double GetSumMoney(int UserId, string WhereStr)
 {
     GameUserServers gus = new GameUserServers();
     GameUser gu = gus.GetGameUser(UserId);
     try
     {
         if (gu.IsSpreader == 1)
         {
             string sql = "select ISNULL(sum(o.paymoney),0) from orders as o, game_users as gu where o.username in" +
                             "(select username from game_users where source=@UserId)and o.state=2 and o.orderno like 'G%' and o.username=gu.username and o.gameid = gu.reggame and gu.isspreader=0 " + WhereStr;
             SqlParameter[] sp = new SqlParameter[]{
                    new SqlParameter("@UserId",UserId)
                };
             return db.ExecuteScalar(sql, sp);
         }
         else if (gu.IsSpreader == 2)
         {
             Double SpreadMoney = 0;
             List<GameUser> list = new List<GameUser>();
             list = gus.GetSpreadUser(UserId);
             foreach (GameUser gameuser in list)
             {
                 SpreadMoney += GetSumMoney(gameuser.Id, WhereStr);
             }
             return SpreadMoney;
         }
         else
         {
             string sql = "select ISNULL(sum(o.paymoney),0) from orders as o, game_users as gu where o.username=@UserName and o.state=2 and o.orderno like 'G%' and o.username=gu.username and o.gameid = gu.reggame and gu.isspreader=0 " + WhereStr;
             SqlParameter[] sp = new SqlParameter[]{
                    new SqlParameter("@UserName",gu.UserName)
                };
             return db.ExecuteScalar(sql, sp);
         }
     }
     catch (SqlException ex)
     {
         throw new Exception("数据库异常!原因:" + ex.Message);
     }
     catch (Exception ex)
     {
         throw new Exception("未知异常!原因:" + ex.Message);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 根据订单处理充值
        /// </summary>
        /// <param name="OrderNo">订单号</param>
        /// <returns>返回处理结果</returns>
        public string PayManager(string OrderNo)
        {
            GameUserServers gus = new GameUserServers();
            OrdersServers os = new OrdersServers();
            LotteryManager lm = new LotteryManager();
            Orders o = os.GetOrder(OrderNo);
            if (o.PayTypeId == 7)
            {
                if (gus.UpdateUserMoney(o.AdminUserName, o.PayMoney * 10, "-"))
                {
                    if (os.UpdateOrder(OrderNo))
                    {

                    }
                    else
                    {
                        return "更新订单状态失败!";
                    }
                }
                else
                {
                    return "扣除平台币失败!";
                }
            }
            if (o.PayTypeId != 6)
            {
                lm.AddUserPoints(o.UserName, o.PayMoney);
            }
            if (o.Type == 1)
            {
                Games g = new Games();
                g = gss.GetGame(o.GameId);
                switch (g.GameNo)
                {
                    case "dxz":
                        return new Game_Dxz().Pay(OrderNo);
                    case "sjsg":
                        return new Game_Sjsg().Pay(OrderNo);
                    case "tj":
                        return new Game_Tj().Pay(OrderNo);
                    case "nz":
                        return new Game_Nz().Pay(OrderNo);
                    case "djj":
                        return new Game_Djj().Pay(OrderNo);
                    case "jlc":
                        return new Game_Jlc().Pay(OrderNo);
                    case "ly":
                        return new Game_Ly().Pay(OrderNo);
                    case "xyb":
                        return new Game_Xyb().Pay(OrderNo);
                    case "dhz":
                        return new Game_Dhz().Pay(OrderNo);
                    case "wz":
                        return new Game_Wz().Pay(OrderNo);
                    case "dpqk":
                        return new Game_Dpqk().Pay(OrderNo);
                    case "lm":
                        return new Game_Lm().Pay(OrderNo);
                    case "mxqy":
                        return new Game_Mxqy().Pay(OrderNo);
                    case "zsg":
                        return new Game_Zsg().Pay(OrderNo);
                    case "rxhzw":
                        return new Game_Rxhzw().Pay(OrderNo);
                    case "klsg":
                        return new Game_Klsg().Pay(OrderNo);
                    case "gjqx":
                        return new Game_Gjqx().Pay(OrderNo);
                    case "txj":
                        return new Game_Txj().Pay(OrderNo);
                    case "wdqk":
                        return new Game_Wdqk().Pay(OrderNo);
                    case "chcq":
                        return new Game_Chcq().Pay(OrderNo);
                    case "jjsg":
                        return new Game_Jjsg().Pay(OrderNo);
                    case "qh":
                        return new Game_Qh().Pay(OrderNo);
                    case "yjxy":
                        return new Game_Yjxy().Pay(OrderNo);
                    case "xxas":
                        return new Game_Xxas().Pay(OrderNo);
                    case "tgzt":
                        return new Game_Tgzt().Pay(OrderNo);
                    case "nslm":
                        return new Game_Nslm().Pay(OrderNo);
                    case "ftz":
                        return new Game_Ftz().Pay(OrderNo);
                    case "sbcs":
                        return new Game_Sbcs().Pay(OrderNo);
                    case "zwj":
                        return new Game_Zwj().Pay(OrderNo);
                    case "dqqyz":
                        return new Game_Dqqyz().Pay(OrderNo);
                    case "yxy":
                        return new Game_Yxy().Pay(OrderNo);
                    case "jhwj":
                        return new Game_Jhwj().Pay(OrderNo);
                    default:
                        return "不存在的游戏!";
                }
            }
            else
            {
                if (gus.UpdateUserMoney(o.UserName, o.PayMoney * 10, "+"))
                {
                    if (os.UpdateOrder(o.OrderNo))
                    {
                        return "充值成功!";
                    }
                    else
                    {
                        return "充值失败!错误原因:更新订单状态失败!";
                    }
                }
                else
                {
                    return "充值失败!";
                }
            }
        }