public StudyRoom GetByUserID(int userID) { using (var context = new KoreanStudyCafeEntities()) { return(context.StudyRooms.FirstOrDefault(x => x.UserID == userID)); } }
public static List <StockControlModelPredict> GetPredictModel(int beverageId) { DateTime lastWeek = DateTime.Today.AddDays(-7); using (var context = new KoreanStudyCafeEntities()) { var query = from x in context.BeverageRecords orderby x.DayQuarter where x.BeverageID == beverageId && x.Date == lastWeek select x; List <BeverageRecord> list = query.ToList(); var query2 = from x in list select new StockControlModelPredict { UserCount = x.UserCount, DayQuater = x.DayQuarter, Usage = Predict.Predictor(beverageId, x.DayQuarter, x.UserCount, GetDay(DateTime.Now)) }; return(query2.ToList()); //return list.ConvertAll(x => new StockConreolModelPredictCoffee //{ // UserCount = x.UserCount, // DayQuater = x.DayQuarter, // Usage = Predict.Predictor(1, x.DayQuarter, x.UserCount, GetDay(DateTime.Now)) //}); } }
public bool Exists(string text) { using (var context = new KoreanStudyCafeEntities()) { return(context.Users.Any(x => x.PhoneNumber == text)); } }
public User GetByPhoneNumber(string phoneNumber) { using (var context = new KoreanStudyCafeEntities()) { return(context.Users.FirstOrDefault(x => x.PhoneNumber == phoneNumber)); } }
public Locker GetByUserId(int userID) { using (var context = new KoreanStudyCafeEntities()) { return(context.Lockers.FirstOrDefault(x => x.UserID == userID)); } }
public StudyRoom GetByKey(int StudyRoomId) { using (var context = new KoreanStudyCafeEntities()) { var query = from x in context.StudyRooms where x.StudyRoomID == StudyRoomId select x; return(query.FirstOrDefault()); } }
public string GetByUserKey(int userId) { using (var context = new KoreanStudyCafeEntities()) { var query = from x in context.Seats where x.UserID == userId select x.Name; return(query.FirstOrDefault()); } }
public Seat GetByKey(int seatId) { using (var context = new KoreanStudyCafeEntities()) { var query = from x in context.Seats where x.SeatID == seatId select x; return(query.FirstOrDefault()); } }
public static List <StockControlModels> GetModel(int beverageId) { DateTime yesterday = DateTime.Today.AddDays(-2); using (var context = new KoreanStudyCafeEntities()) { var query = from x in context.BeverageRecords orderby x.DayQuarter where x.BeverageID == beverageId && x.Date == yesterday select new StockControlModels { UserCount = x.UserCount, DayQuater = x.DayQuarter, Usage = x.Usage }; return(query.ToList()); } }
public List <DateTime> SelectFordDate(DateTime?from, DateTime?to) { using (var context = new KoreanStudyCafeEntities()) { var query = from x in context.Invoices select x.InvoiceDatetime; if (from.HasValue) { query = query.Where(x => x >= from); } if (to.HasValue) { query = query.Where(x => x <= to); } return(query.Select(x => x).ToList()); } }