public static int GetAvailableWatchdogs(string userId) { return(int.MaxValue); var max = Invoices.GetMaxNumberOfWatchdogs(userId); if (max == int.MaxValue) { return(int.MaxValue); } if (DateTime.Now < limit) { return(int.MaxValue); } //var userCreated = DateTime.Now.Date.AddDays(-40); //var usert = new Lib.Data.DbEntities().AspNetUserTokens.Where(m => m.Id == userId).FirstOrDefault(); //if (usert != null) // userCreated = usert.Created.AddDays(30); var curr = new Lib.Data.DbEntities().WatchDogs.Count(m => m.UserId == userId && m.StatusId > 0); return(max - curr); }
public List <InvoiceItems> GetItems(Lib.Data.DbEntities fc) { if (this.items != null) { return(this.items); } bool dispose = fc == null; if (dispose) { fc = new Lib.Data.DbEntities(); } try { this.items = fc.InvoiceItems.Where(m => m.ID_Invoice == this.ID).ToList(); } finally { if (dispose) { fc?.Dispose(); } } return(this.items); }