Ejemplo n.º 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());
     }
 }
Ejemplo n.º 2
0
 public static List <FUTItemProfit> GetFUTProfitLogs()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTItemProfits.ToList());
     }
 }
Ejemplo n.º 3
0
 public static List <FUTNotification> GetFUTNotifications()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTNotifications.ToList());
     }
 }
Ejemplo n.º 4
0
 public static int GetFUTNotificationCount()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTNotifications.Count());
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 7
0
 public static int GetFUTSellsCount()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTSells.Count());
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 11
0
 public static List <FUTSell> GetFUTSells()
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTSells.ToList());
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 13
0
 public static FUTCoins GetFUTCoinsByEMail(string email)
 {
     using (var context = new FUTLogsDatabase())
     {
         return(context.FUTCoins.FirstOrDefault(x => x.EMail == email));
     }
 }
Ejemplo n.º 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();
                    }
                }
            }
        }
Ejemplo n.º 15
0
 public static void InsertFUTExceptionLog(FUTExceptionLog log)
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTExceptionLogs.Add(log);
         context.SaveChanges();
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 19
0
 public static void InsertFUTBuy(FUTBuy buy)
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTBuys.Add(buy);
         context.SaveChanges();
     }
 }
Ejemplo n.º 20
0
 public static void InsertFUTBotStatistics(FUTBotStatistics log)
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTBotStatistics.Add(log);
         context.SaveChanges();
     }
 }
Ejemplo n.º 21
0
 public static FUTItemProfit GetFUTItemProfitByItemID(long itemID)
 {
     using (var context = new FUTLogsDatabase())
     {
         var dbItem = context.FUTItemProfits.FirstOrDefault(x => x.ItemID == itemID);
         return(dbItem);
     }
 }
Ejemplo n.º 22
0
 public static void ResetFUTBuys()
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTBuys.RemoveRange(context.FUTBuys);
         context.SaveChanges();
     }
 }
Ejemplo n.º 23
0
 public static void InsertFUTPriceCheck(FUTPriceCheck priceCheck)
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTPriceChecks.Add(priceCheck);
         context.SaveChanges();
     }
 }
Ejemplo n.º 24
0
 public static void InsertFUTSell(FUTSell sell)
 {
     using (var context = new FUTLogsDatabase())
     {
         context.FUTSells.Add(sell);
         context.SaveChanges();
     }
 }
Ejemplo n.º 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());
            }
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 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();
     }
 }