示例#1
0
 public StudyRoom GetByUserID(int userID)
 {
     using (var context = new KoreanStudyCafeEntities())
     {
         return(context.StudyRooms.FirstOrDefault(x => x.UserID == userID));
     }
 }
示例#2
0
        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))
                //});
            }
        }
示例#3
0
 public bool Exists(string text)
 {
     using (var context = new KoreanStudyCafeEntities())
     {
         return(context.Users.Any(x => x.PhoneNumber == text));
     }
 }
示例#4
0
 public User GetByPhoneNumber(string phoneNumber)
 {
     using (var context = new KoreanStudyCafeEntities())
     {
         return(context.Users.FirstOrDefault(x => x.PhoneNumber == phoneNumber));
     }
 }
示例#5
0
 public Locker GetByUserId(int userID)
 {
     using (var context = new KoreanStudyCafeEntities())
     {
         return(context.Lockers.FirstOrDefault(x => x.UserID == userID));
     }
 }
示例#6
0
        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());
            }
        }
示例#7
0
        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());
            }
        }
示例#8
0
        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());
            }
        }
示例#9
0
        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());
            }
        }
示例#10
0
        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());
            }
        }