예제 #1
0
 public static List <FUTBotStatistics> GetFUTBotStatisticsLast24Hours()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTBotStatistics.OrderByDescending(x => x.ID).Where(x => x.TotalTradepileItems >= 1).Take(48).ToList());
     }
 }
예제 #2
0
 public static List <FUTItemProfit> GetFUTProfitLogs()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTItemProfits.ToList());
     }
 }
예제 #3
0
 public static List <FUTNotification> GetFUTNotifications()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTNotifications.ToList());
     }
 }
예제 #4
0
 public static int GetFUTNotificationCount()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTNotifications.Count());
     }
 }
예제 #5
0
 public static List <FUTBotLog> GetFUTBotLogsByEMail(string email, int from, int take)
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTBotLogs.Where(x => x.EMail.ToLower() == email.ToLower()).OrderByDescending(x => x.ID).Skip(from).Take(take).ToList());
     }
 }
예제 #6
0
 public static List <FUTExceptionLog> GetFUTExceptionLogs(int from, int take)
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTExceptionLogs.OrderByDescending(x => x.ID).Skip(from).Take(take).ToList());
     }
 }
예제 #7
0
 public static int GetFUTSellsCount()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTSells.Count());
     }
 }
예제 #8
0
 public static List <FUTSell> GetFUTSells(int from, int take, FUTBuyBidType type)
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTSells.Where(x => x.Type == type).OrderByDescending(x => x.ID).Skip(from).Take(take).ToList());
     }
 }
예제 #9
0
 public static List <FUTItemProfit> GetFUTProfitLogs(int from, int take, int assetID, int revID)
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTItemProfits.Where(x => x.SellTimestamp != 0 && x.AssetID == assetID && x.RevisionID == revID).OrderByDescending(x => x.SellTimestamp).Skip(from).Take(take).ToList());
     }
 }
예제 #10
0
 public static List <FUTPriceCheck> GetFUTPriceChecksByAssetIDRevisionID(int assetID, int revID, int take)
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTPriceChecks.Where(x => x.AssetID == assetID && x.RevisionID == revID).OrderByDescending(x => x.ID).Take(take).ToList());
     }
 }
예제 #11
0
 public static List <FUTSell> GetFUTSells()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTSells.ToList());
     }
 }
예제 #12
0
 public static List <FUTItemProfit> GetFUTProfitLogs(int from, int take, FUTBuyBidType type)
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTItemProfits.Where(x => x.SellTimestamp != 0 && x.Type == type).OrderByDescending(x => x.SellTimestamp).Skip(from).Take(take).ToList());
     }
 }
예제 #13
0
 public static FUTCoins GetFUTCoinsByEMail(string email)
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTCoins.FirstOrDefault(x => x.EMail == email));
     }
 }
예제 #14
0
        public static void UpdateMaxConnections()
        {
            using (var context = new FUTLogsDatabase())
            {
                //10000
                var connectionString = AppSettingsManager.GetConnectionString();

                SqlConnection conn          = null;
                SqlDataReader rdr           = null;
                var           maxConnection = -1;
                try
                {
                    conn = new SqlConnection(connectionString);
                    conn.Open();

                    string     stm    = "show variables like \"max_connections\";";
                    SqlCommand cmdGet = new SqlCommand(stm, conn);
                    rdr = cmdGet.ExecuteReader();



                    while (rdr.Read())
                    {
                        maxConnection = rdr.GetInt32(1);
                    }
                    if (maxConnection >= 0 && maxConnection < 10000)
                    {
                        if (rdr != null)
                        {
                            rdr.Close();
                        }

                        SqlCommand cmdUpdate = new SqlCommand();
                        cmdUpdate.Connection  = conn;
                        cmdUpdate.CommandText = "set global max_connections = @Connections;";
                        cmdUpdate.Prepare();

                        cmdUpdate.Parameters.AddWithValue("@Connections", 10000);
                        cmdUpdate.ExecuteNonQuery();
                    }
                }
                catch (SqlException ex)
                {
                    Console.WriteLine("Error Updating Max Connections: {0}", ex.ToString());
                }
                finally
                {
                    if (rdr != null)
                    {
                        rdr.Close();
                    }

                    if (conn != null)
                    {
                        conn.Close();
                    }
                }
            }
        }
예제 #15
0
 public static void InsertFUTExceptionLog(FUTExceptionLog log)
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTExceptionLogs.Add(log);
         context.SaveChanges();
     }
 }
예제 #16
0
 public static bool CheckNextPageFUTBuysLogs(int from, int take)
 {
     using (var context = new FUTLogsDatabase())
     {
         var r = context.FUTBuys.OrderByDescending(x => x.ID).Skip(from).Take(take).ToList();
         return(r.Count > 0);
     }
 }
예제 #17
0
 public static List <FUTSell> GetFUTSellsByAssetIDSite(int assetID, int revID, int from, int take)
 {
     using (var context = new FUTLogsDatabase())
     {
         var allSells = context.FUTSells.ToList();
         return(allSells.Where(x => x.AssetID == assetID && x.RevisionID == revID).OrderByDescending(x => x.ID).Skip(from).Take(take).ToList());
     }
 }
예제 #18
0
 public static List <FUTSell> GetFUTSellsByAssetID(int assetID, int revID)
 {
     using (var context = new FUTLogsDatabase())
     {
         var allSells = context.FUTSells.ToList();
         return(allSells.Where(x => x.AssetID == assetID && x.RevisionID == revID).ToList());
     }
 }
예제 #19
0
 public static void InsertFUTBuy(FUTBuy buy)
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTBuys.Add(buy);
         context.SaveChanges();
     }
 }
예제 #20
0
 public static void InsertFUTBotStatistics(FUTBotStatistics log)
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTBotStatistics.Add(log);
         context.SaveChanges();
     }
 }
예제 #21
0
 public static FUTItemProfit GetFUTItemProfitByItemID(long itemID)
 {
     using (var context = new FUTLogsDatabase())
     {
         var dbItem = context.FUTItemProfits.FirstOrDefault(x => x.ItemID == itemID);
         return(dbItem);
     }
 }
예제 #22
0
 public static void ResetFUTBuys()
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTBuys.RemoveRange(context.FUTBuys);
         context.SaveChanges();
     }
 }
예제 #23
0
 public static void InsertFUTPriceCheck(FUTPriceCheck priceCheck)
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTPriceChecks.Add(priceCheck);
         context.SaveChanges();
     }
 }
예제 #24
0
 public static void InsertFUTSell(FUTSell sell)
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTSells.Add(sell);
         context.SaveChanges();
     }
 }
예제 #25
0
        public static List <FUTItemProfit> GetFUTProfitLogsLast24Hours()
        {
            var now = Helper.CreateTimestamp();

            using (var context = new FUTLogsDatabase())
            {
                return(context.FUTItemProfits.OrderByDescending(x => x.ID).Where(x => (now - x.SellTimestamp) <= 86400000).ToList());
            }
        }
예제 #26
0
        public static int GetFUTBuysCountLast24Hours(string email)
        {
            var now = Helper.CreateTimestamp();

            using (var context = new FUTLogsDatabase())
            {
                return(context.FUTBuys.Count(x => x.EMail.ToLower() == email.ToLower() && (now - x.Timestamp) <= 86400000));
            }
        }
예제 #27
0
        public static void AddFUTNotification(string from, string data)
        {
            var logData = new FUTNotification(from, data);

            using (var context = new FUTLogsDatabase())
            {
                context.FUTNotifications.Add(logData);
                context.SaveChanges();
            }
        }
예제 #28
0
 public static bool CheckPreviousPageFUTBuysLogs(int from, int take)
 {
     if (from == 0)
     {
         return(false);
     }
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTBuys.OrderByDescending(x => x.ID).Skip(from - 1).Take(take).Any());
     }
 }
예제 #29
0
 public static void RemoveFUTSell(long id)
 {
     using (var context = new FUTLogsDatabase())
     {
         var entity = context.FUTSells.FirstOrDefault(x => x.ID == id);
         if (entity != null)
         {
             context.FUTSells.Remove(entity);
             context.SaveChanges();
         }
     }
 }
예제 #30
0
 public static void UpdateFUTItemProfitByItemID(long itemID, int sellPrice)
 {
     using (var context = new FUTLogsDatabase())
     {
         var dbItem = context.FUTItemProfits.FirstOrDefault(x => x.ItemID == itemID);
         if (dbItem == null)
         {
             return;
         }
         dbItem.SellPrice     = sellPrice;
         dbItem.Profit        = (int)(sellPrice * 0.95) - dbItem.BuyPrice;
         dbItem.SellTimestamp = Helper.CreateTimestamp();
         context.SaveChanges();
     }
 }