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