Exemple #1
0
        public static void LoadLotteryHistory(BoCaiTypeEnum BocaiType, out List <KFBoCaoHistoryData> HistoryList, string cmd = "")
        {
            MySqlDataReader sdr = null;

            HistoryList = new List <KFBoCaoHistoryData>();
            try
            {
                string sql = string.Format("SELECT `rid`,`DataPeriods`,`ServerID`,`RoleName`,`ZoneID`,`BuyNum`,`WinNo`,`WinMoney`FROM t_bocai_lottery_history WHERE `BocaiType`={0} ORDER BY `DataPeriods` DESC, `BuyNum` ASC {1};", (int)BocaiType, cmd);
                sdr = DbHelperMySQL.ExecuteReader(sql, false);
                while (sdr != null && sdr.Read())
                {
                    KFBoCaoHistoryData data = new KFBoCaoHistoryData();
                    data.RoleID      = Convert.ToInt32(sdr["rid"]);
                    data.ZoneID      = Convert.ToInt32(sdr["ZoneID"]);
                    data.ServerID    = Convert.ToInt32(sdr["ServerID"]);
                    data.RoleName    = sdr["RoleName"].ToString();
                    data.BuyNum      = Convert.ToInt32(sdr["BuyNum"]);
                    data.WinNo       = Convert.ToInt32(sdr["WinNo"]);
                    data.WinMoney    = Convert.ToInt64(sdr["WinMoney"]);
                    data.DataPeriods = Convert.ToInt64(sdr["DataPeriods"]);
                    HistoryList.Add(data);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteExceptionUseCache(ex.Message);
            }
            finally
            {
                if (sdr != null)
                {
                    sdr.Close();
                }
            }
        }
Exemple #2
0
        private static int SortHistory(KFBoCaoHistoryData d1, KFBoCaoHistoryData d2)
        {
            int result;

            if (d1.DataPeriods > d2.DataPeriods)
            {
                result = -1;
            }
            else if (d1.DataPeriods < d2.DataPeriods)
            {
                result = -1;
            }
            else if (d1.WinMoney > d2.WinMoney)
            {
                result = -1;
            }
            else if (d1.WinMoney < d2.WinMoney)
            {
                result = -1;
            }
            else
            {
                result = 0;
            }
            return(result);
        }
 private void GetWinRoleNum(List <int> value, out int no1Num, out int no2Num, out int no3Num, out List <KFBoCaoHistoryData> Hsitory)
 {
     no1Num  = 0;
     no2Num  = 0;
     no3Num  = 0;
     Hsitory = new List <KFBoCaoHistoryData>();
     lock (this.mutex)
     {
         foreach (List <KFBuyBocaiData> BuyDataList in this.RoleBuyDict.Values)
         {
             foreach (KFBuyBocaiData BuyData in BuyDataList)
             {
                 int        sameNum = 0;
                 List <int> tempList;
                 KFBoCaiDbManager.String2ListInt(BuyData.BuyValue, out tempList);
                 if (tempList.Count == value.Count)
                 {
                     for (int i = 0; i < value.Count; i++)
                     {
                         if (value[i] == tempList[i])
                         {
                             sameNum++;
                         }
                     }
                     KFBoCaoHistoryData HistoryData = new KFBoCaoHistoryData();
                     HistoryData.DataPeriods = this.OpenData.DataPeriods;
                     HistoryData.RoleID      = BuyData.RoleID;
                     HistoryData.ZoneID      = BuyData.ZoneID;
                     HistoryData.ServerID    = BuyData.ServerID;
                     HistoryData.RoleName    = BuyData.RoleName;
                     HistoryData.BuyNum      = BuyData.BuyNum;
                     if (5 == sameNum)
                     {
                         no1Num           += BuyData.BuyNum;
                         HistoryData.WinNo = 1;
                     }
                     else if (4 == sameNum)
                     {
                         no2Num           += BuyData.BuyNum;
                         HistoryData.WinNo = 2;
                     }
                     else
                     {
                         if (3 != sameNum)
                         {
                             continue;
                         }
                         no3Num           += BuyData.BuyNum;
                         HistoryData.WinNo = 3;
                     }
                     Hsitory.Add(HistoryData);
                 }
             }
         }
     }
 }
Exemple #4
0
        private KFBoCaoHistoryData InsertHistoryData()
        {
            KFBoCaoHistoryData HistoryData = new KFBoCaoHistoryData();

            HistoryData.DataPeriods = this.OpenData.DataPeriods;
            HistoryData.RoleID      = -1;
            HistoryData.ZoneID      = -1;
            HistoryData.ServerID    = -1;
            HistoryData.RoleName    = "占位";
            HistoryData.BuyNum      = -1;
            HistoryData.WinMoney    = -1L;
            KFBoCaiDbManager.InsertLotteryHistory(this.BoCaiType, HistoryData);
            return(HistoryData);
        }
 private void GetRank()
 {
     try
     {
         List <OpenLottery> openHistory = BoCaiManager.getInstance().GetNewOpenLottery10(this.BoCaiType);
         if (null != openHistory)
         {
             ReturnValue <List <KFBoCaoHistoryData> > msgData = TcpCall.KFBoCaiManager.GetWinHistory(this.BoCaiType);
             if (!msgData.IsReturn)
             {
                 LogManager.WriteLog(LogTypes.Error, "[ljl_caidaxiao_猜大小]猜大小获取排行 失败", null, true);
             }
             else
             {
                 List <KFBoCaoHistoryData> History = msgData.Value;
                 lock (this.mutex)
                 {
                     this.OpenHistory = openHistory;
                     this.WinHistory.Clear();
                     if (null != History)
                     {
                         using (List <KFBoCaoHistoryData> .Enumerator enumerator = History.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 KFBoCaoHistoryData item = enumerator.Current;
                                 if (item.RoleID >= 0)
                                 {
                                     OpenLottery data = this.OpenHistory.Find((OpenLottery x) => x.DataPeriods == item.DataPeriods);
                                     if (data != null && !string.IsNullOrEmpty(data.strWinNum))
                                     {
                                         item.OpenData = data.strWinNum;
                                         this.WinHistory.Add(item);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_caidaxiao_猜大小]{0}", ex.ToString()), null, true);
     }
 }
Exemple #6
0
 private void addHistory(List <KFBoCaoHistoryData> History)
 {
     try
     {
         long longData = 0L;
         lock (this.mutex)
         {
             this.BoCaiWinHistoryList.AddRange(History);
             List <long> dataTime = new List <long>();
             using (List <KFBoCaoHistoryData> .Enumerator enumerator = this.BoCaiWinHistoryList.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     KFBoCaoHistoryData item = enumerator.Current;
                     if (dataTime.Find((long x) => x == item.DataPeriods) <= 0L)
                     {
                         dataTime.Add(item.DataPeriods);
                     }
                 }
             }
             if (dataTime.Count > 10)
             {
                 dataTime.Sort();
                 dataTime.Reverse();
                 longData = dataTime[9];
                 this.BoCaiWinHistoryList = this.BoCaiWinHistoryList.FindAll((KFBoCaoHistoryData x) => x.DataPeriods >= longData);
             }
             this.BoCaiWinHistoryList.Sort(new Comparison <KFBoCaoHistoryData>(KFBoCaiCaiDaXiao.SortHistory));
         }
         if (longData >= 1L)
         {
             if (!KFBoCaiDbManager.DelTableData("t_bocai_lottery_history", string.Format("DataPeriods < {0} AND `BocaiType`={1}", longData, (int)this.BoCaiType)))
             {
                 LogManager.WriteLog(LogTypes.Error, string.Format("[ljl_caidaxiao_猜大小] DelTableData  t_bocai_lottery_history false DataPeriods {0}", longData), null, true);
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_caidaxiao_猜大小]{0}", ex.ToString()), null, true);
     }
 }
Exemple #7
0
 public static bool CopyHistoryData(List <KFBoCaoHistoryData> sData, out List <KFBoCaoHistoryData> rData)
 {
     rData = new List <KFBoCaoHistoryData>();
     try
     {
         foreach (KFBoCaoHistoryData item in sData)
         {
             KFBoCaoHistoryData data = new KFBoCaoHistoryData();
             if (GlobalNew.Copy <KFBoCaoHistoryData>(item, ref data))
             {
                 rData.Add(data);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
     return(false);
 }
Exemple #8
0
        public List <KFBoCaoHistoryData> GetWinHistory()
        {
            List <KFBoCaoHistoryData> result;

            lock (this.mutex)
            {
                List <KFBoCaoHistoryData> dList = new List <KFBoCaoHistoryData>();
                foreach (KFBoCaoHistoryData item in this.BoCaiWinHistoryList)
                {
                    KFBoCaoHistoryData kfboCaoHistoryData = new KFBoCaoHistoryData();
                    kfboCaoHistoryData.RoleID      = item.RoleID;
                    kfboCaoHistoryData.ZoneID      = item.ZoneID;
                    kfboCaoHistoryData.ServerID    = item.ServerID;
                    kfboCaoHistoryData.RoleName    = item.RoleName;
                    kfboCaoHistoryData.BuyNum      = item.BuyNum;
                    kfboCaoHistoryData.WinNo       = item.WinNo;
                    kfboCaoHistoryData.WinMoney    = item.WinMoney;
                    kfboCaoHistoryData.DataPeriods = item.DataPeriods;
                    dList.Add(item);
                }
                result = dList;
            }
            return(result);
        }
Exemple #9
0
 public static bool InsertLotteryHistory(BoCaiTypeEnum BocaiType, KFBoCaoHistoryData History)
 {
     try
     {
         string sql = string.Format("REPLACE INTO t_bocai_lottery_history(`rid`, `BocaiType`, `DataPeriods`, `ServerID`, `RoleName`, `ZoneID`, `BuyNum`, `WinNo`, `WinMoney`)VALUES({0},{1},{2},{3},'{4}',{5},{6},{7},{8});", new object[]
         {
             History.RoleID,
             (int)BocaiType,
             History.DataPeriods,
             History.ServerID,
             History.RoleName,
             History.ZoneID,
             History.BuyNum,
             History.WinNo,
             History.WinMoney
         });
         return(DbHelperMySQL.ExecuteSql(sql) > -1);
     }
     catch (Exception ex)
     {
         LogManager.WriteException(ex.Message);
     }
     return(false);
 }
Exemple #10
0
 private void GetRank()
 {
     try
     {
         List <OpenLottery> openHistory = BoCaiManager.getInstance().GetNewOpenLottery10(this.BoCaiType);
         if (null != openHistory)
         {
             ReturnValue <List <KFBoCaoHistoryData> > msgData = TcpCall.KFBoCaiManager.GetWinHistory(this.BoCaiType);
             if (!msgData.IsReturn)
             {
                 LogManager.WriteLog(LogTypes.Error, "[ljl_caidaxiao_猜数字]猜数字获取排行 失败", null, true);
             }
             else
             {
                 List <KFBoCaoHistoryData> History = msgData.Value;
                 lock (this.mutex)
                 {
                     this.RankResult  = true;
                     this.OpenHistory = openHistory;
                     this.WinHistory.Clear();
                     if (null != History)
                     {
                         using (List <KFBoCaoHistoryData> .Enumerator enumerator = History.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 KFBoCaoHistoryData item = enumerator.Current;
                                 OpenLottery        data = this.OpenHistory.Find((OpenLottery x) => x.DataPeriods == item.DataPeriods);
                                 if (data != null && !string.IsNullOrEmpty(data.strWinNum))
                                 {
                                     item.OpenData = data.strWinNum;
                                     this.WinHistory.Add(item);
                                 }
                             }
                         }
                         List <long> DataPeriodsList  = new List <long>();
                         List <long> DataPeriodsList2 = new List <long>();
                         foreach (OpenLottery open in this.OpenHistory)
                         {
                             DataPeriodsList.Add(open.DataPeriods);
                         }
                         DataPeriodsList2 = this.BuyItemHistoryDict.Keys.ToList <long>();
                         using (List <long> .Enumerator enumerator3 = DataPeriodsList2.GetEnumerator())
                         {
                             while (enumerator3.MoveNext())
                             {
                                 long Periods = enumerator3.Current;
                                 if (DataPeriodsList.Find((long x) => x == Periods) < 1L)
                                 {
                                     this.BuyItemHistoryDict.Remove(Periods);
                                 }
                             }
                         }
                         foreach (long Periods2 in DataPeriodsList)
                         {
                             if (!this.BuyItemHistoryDict.ContainsKey(Periods2))
                             {
                                 List <BuyBoCai2SDB> ItemList;
                                 if (BoCaiManager.getInstance().GetBuyList2DB(this.BoCaiType, Periods2, out ItemList, 1))
                                 {
                                     List <RoleBuyHistory> roleBuyList = new List <RoleBuyHistory>();
                                     using (List <BuyBoCai2SDB> .Enumerator enumerator4 = ItemList.GetEnumerator())
                                     {
                                         while (enumerator4.MoveNext())
                                         {
                                             BuyBoCai2SDB   dbdata   = enumerator4.Current;
                                             RoleBuyHistory roledata = roleBuyList.Find((RoleBuyHistory x) => x.RoleID == dbdata.m_RoleID);
                                             if (null == roledata)
                                             {
                                                 roledata             = new RoleBuyHistory();
                                                 roledata.RoleID      = dbdata.m_RoleID;
                                                 roledata.BuyItemList = new List <BoCaiBuyItem>();
                                                 roleBuyList.Add(roledata);
                                             }
                                             roledata.BuyItemList.Add(new BoCaiBuyItem
                                             {
                                                 BuyNum      = dbdata.BuyNum,
                                                 strBuyValue = dbdata.strBuyValue,
                                                 DataPeriods = Periods2
                                             });
                                         }
                                     }
                                     this.BuyItemHistoryDict.Add(Periods2, roleBuyList);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_caidaxiao_猜数字]{0}", ex.ToString()), null, true);
     }
 }