Exemplo n.º 1
0
 public static List <activityTime> GetActivityTimesByDay(int serviceId, int day)
 {
     using (onLineEntities1 entities = new onLineEntities1())
     {
         return(entities.activityTimes.Where(a => a.serviceId == serviceId && a.dayInWeek == day && a.endDate == null).ToList());
     }
 }
Exemplo n.º 2
0
 public static activityTime GetActivityTimeById(int activityTimeId)
 {
     using (onLineEntities1 entities = new onLineEntities1())
     {
         return(entities.activityTimes.FirstOrDefault(a => a.activityTimeId == activityTimeId));
     }
 }
Exemplo n.º 3
0
 public static int GetNumOfCustomers()
 {
     using (onLineEntities1 entities1 = new onLineEntities1())
     {
         return(entities1.customers.Count());
     }
 }
Exemplo n.º 4
0
 public static int GetNumOfTurnsByBusiness(int businessId)
 {
     using (onLineEntities1 entities1 = new onLineEntities1())
     {
         return(entities1.customersInLines.Include(a => a.activityTime).Include(a => a.activityTime.service).Where(c => c.activityTime.service.businessId == businessId).Count());
     }
 }
Exemplo n.º 5
0
 public static int GetNumOfBusinesses()
 {
     using (onLineEntities1 entities1 = new onLineEntities1())
     {
         return(entities1.businesses.Count());
     }
 }
Exemplo n.º 6
0
 public static List <activityTime> GetActivityTimes(int serviceId)
 {
     using (onLineEntities1 entities = new onLineEntities1())
     {
         return(entities.activityTimes.Where(a => a.serviceId == serviceId).ToList());
     }
 }
Exemplo n.º 7
0
 public static int GetNumOfCategories()
 {
     using (onLineEntities1 entities1 = new onLineEntities1())
     {
         return(entities1.categories.Count());
     }
 }
Exemplo n.º 8
0
        public static List <unusual> GetUnusuals(int serviceId)
        {
            using (onLineEntities1 entities1 = new onLineEntities1())

            {
                return(entities1.unusuals.Where(u => u.activityTime.serviceId == serviceId).ToList());
            }
        }
Exemplo n.º 9
0
        public static List <customersInLine> GetTurnToCust(int custId)
        {
            using (onLineEntities1 entities1 = new onLineEntities1())

            {
                return(entities1.customersInLines.Include(a => a.activityTime).Include(a => a.activityTime.service).Include("activityTime.service.business").Where(t => t.custId == custId && (t.actualHour == new TimeSpan() || t.actualHour == null)).ToList());
            }
            //x => x.Quotes.Select(q => q.QuoteItems)
        }
Exemplo n.º 10
0
 public static int AddBusiness(business business)
 {
     using (onLineEntities1 entities1 = new onLineEntities1())
     {
         entities1.businesses.Add(business);
         entities1.SaveChanges();
         int id = business.businessId;
         return(id);
     }
 }
Exemplo n.º 11
0
 public static List <customersInLine> GetAllCustomersInTurn()
 {
     try
     {
         using (onLineEntities1 entities = new onLineEntities1())
         {
             return(entities.customersInLines.Include("customer").Where(t => t.isActive == true && t.preAlert > 0).ToList());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 12
0
 public static business GetBusinessById(int id)
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             return(entities1.businesses.Include("services").FirstOrDefault(b => b.businessId == id));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 13
0
 public static customersInLine GetTurnByTurnId(int turnId)
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             return(entities1.customersInLines.Include("activityTime").First(t => t.TurnId == turnId));
         }
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 14
0
 public static List <category> GetCategories()
 {
     try
     {
         using (onLineEntities1 entities = new onLineEntities1())
         {
             return(entities.categories.ToList());
         }
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 15
0
 public static List <business> GetBusinesses()
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             return(entities1.businesses.Include("services").ToList());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 16
0
 public static List <customersInLine> GetLineByCustomer(int custId)
 {
     try
     {
         using (onLineEntities1 entities = new onLineEntities1())
         {
             return(entities.customersInLines.Where(a => a.isActive == true && a.custId == custId && a.actualHour == null).ToList());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 17
0
 public static List <service> GetServicesByBussiness(int businessId)
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             return(entities1.services.Include("activityTimes").Where(s => s.businessId == businessId).ToList());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 18
0
 public static List <customersInLine> GetLinePerActivityTime(int activityTimeId)
 {
     try
     {
         using (onLineEntities1 entities = new onLineEntities1())
         {
             var q = entities.customersInLines.Include("activityTime").ToList();
             return(q.Where(a => a.isActive == true && a.activityTimeId == activityTimeId && (a.actualHour == new TimeSpan() || a.actualHour == null)).OrderBy(l => l.estimatedHour).ToList());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 19
0
 public static void DeleteTurn(int turnId)
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             entities1.customersInLines.Remove(entities1.customersInLines.FirstOrDefault(t => t.TurnId == turnId));
             entities1.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 20
0
 public static void AddUnUsual(unusual unusual)
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             entities1.unusuals.Add(unusual);
             entities1.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 21
0
 public static void AddCustomer(customer customer)
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             entities1.customers.Add(customer);
             entities1.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 22
0
 public static service GetServiceById(int serviceId)
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             var a = entities1.services.Include("business").ToList();
             var b = a.FirstOrDefault(s => s.serviceId == serviceId);
             return(b);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 23
0
 public static int AddAppointment(customersInLine turn)
 {
     try
     {
         using (onLineEntities1 entities = new onLineEntities1())
         {
             entities.customersInLines.Add(turn);
             entities.SaveChanges();
             return(turn.TurnId);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 24
0
 public static int GetCustId(string phone)
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             return(entities1.customers.FirstOrDefault(c => c.phoneNumber == phone).custId);
         }
     }
     catch (NullReferenceException)
     {
         throw new NullReferenceException("משתמש לא קיים");
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 25
0
 public static void UpdateActivityTime(activityTime activityTime)
 {
     try
     {
         using (onLineEntities1 entities = new onLineEntities1())
         {
             var updateActivityTime = entities.activityTimes.FirstOrDefault(a => a.activityTimeId == activityTime.activityTimeId);
             updateActivityTime.avgServiceDuration = activityTime.avgServiceDuration.Value;
             //todo:  updateActivityTime.StandardDeviation = activityTime.StandardDeviation.Value;
             updateActivityTime.sampleSize = updateActivityTime.sampleSize.Value;
             entities.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 26
0
 public static business GetBusinessByPassword(string password)
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             business business = entities1.businesses.Include("services").FirstOrDefault(b => b.password == password);
             if (business == null)
             {
                 throw new Exception("worng password");
             }
             return(business);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 27
0
 public static void UpdateTurns(List <customersInLine> line)
 {
     try
     {
         using (onLineEntities1 entities1 = new onLineEntities1())
         {
             for (int i = 0; i < line.Count(); i++)
             {
                 customersInLine turn = entities1.customersInLines.FirstOrDefault(l => l.TurnId == line[i].TurnId);
                 turn.estimatedHour = line[i].estimatedHour;
                 turn.isActive      = line[i].isActive;
             }
             entities1.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 28
0
        public static void UpdateTurn(customersInLine turnToUpdate)
        {
            try
            {
                using (onLineEntities1 entities1 = new onLineEntities1())
                {
                    customersInLine turn = entities1.customersInLines.FirstOrDefault(l => l.TurnId == turnToUpdate.TurnId);
                    turn.preAlert         = turnToUpdate.preAlert;
                    turn.statusTurn       = turnToUpdate.statusTurn;
                    turn.verificationCode = turnToUpdate.verificationCode;
                    turn.actualHour       = turnToUpdate.actualHour;
                    turn.exitHour         = turnToUpdate.exitHour;

                    // entities1.Entry(turnToUpdate).State = EntityState.Modified;
                    entities1.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }