public static TurnInBusinessDTO GetPossibleBusinessWithHour(int serviceId, string latitude, string longitude, bool isDriving, int custId) { bool pushFlag = false; TurnInBusinessDTO service = new TurnInBusinessDTO(); service = converters.TurnInBusinessConverters.GetTurnInBusinessDTO(ServiceDal.GetServiceById(serviceId)); if (latitude != "0" && longitude != "0") { service.Duration = TurnServices.GooglePlaces(longitude, latitude, service.Address, isDriving); } else { service.Duration = 0; } service.EstimatedHour = ImmediateTurn.GetOptionalHourPerBusiness(serviceId, TimeSpan.FromMinutes(service.Duration).Add(DateTime.Now.TimeOfDay), ref pushFlag); try { if (service.EstimatedHour != new TimeSpan()) { service.TurnId = ImmediateTurn.MakeTemporaryTurn(service, pushFlag, custId); } } catch (Exception ex) { throw ex; } return(service); }
/// business to show public static TurnInBusinessDTO GetSmallBusinessDTO(business business) { TurnInBusinessDTO businessDTO = new TurnInBusinessDTO() { BusinessName = business.businessName, Address = business.adress_city + " " + business.adress_street + " " + business.adress_numOfStreet, }; return(businessDTO); }
public static TurnInBusinessDTO GetTurnInBusinessDTO(service service) { TurnInBusinessDTO business = new TurnInBusinessDTO() { ServiceId = service.serviceId, BusinessName = service.business.businessName, Address = service.business.adress_street + " " + service.business.adress_numOfStreet + " " + service.business.adress_city, }; return(business); }
public static TurnInBusinessDTO GetTurnToShowDTO(customersInLine custTurn) { TurnInBusinessDTO turn = new TurnInBusinessDTO() { ServiceId = custTurn.activityTime.serviceId, BusinessName = custTurn.activityTime.service.business.businessName, Address = custTurn.activityTime.service.business.adress_street + " " + custTurn.activityTime.service.business.adress_numOfStreet + " " + custTurn.activityTime.service.business.adress_city, TurnId = custTurn.TurnId, EstimatedHour = custTurn.estimatedHour.TimeOfDay, FullTime = custTurn.estimatedHour, }; return(turn); }
/// <summary> /// הפונקציה קובעת תור זמני עבור שעה אופציונלית בעסק /// </summary> /// <param name="turn"></param> /// <returns>turn id</returns> public static int MakeTemporaryTurn(TurnInBusinessDTO turn, bool pushFlag, int custId) { DateTime time = DateTime.Now; ActivityTimeDTO activityTime = ActivityTimeBL.GetActivityTime(time.Add(turn.EstimatedHour.Value - time.TimeOfDay), turn.ServiceId); if (activityTime == null) { throw new Exception("אין משמרת פעילה כרגע"); } //todoever: להחליף בהמשך לאינדקסים try { int status = (int)eStatus.TEMPORARY; if (pushFlag) { status = (int)eStatus.TEMPORARY_WITH_PUSH; } customersInLine temporaryTurn = new customersInLine() { activityTimeId = activityTime.ActivityTimeId, custId = custId, enterHour = TimeSpan.FromMinutes(turn.Duration).Add(DateTime.Now.TimeOfDay), estimatedHour = DateTime.Today.Add(turn.EstimatedHour.Value), isActive = true, preAlert = 0, statusTurn = status }; int turnId = TurnDal.AddAppointment(temporaryTurn); return(turnId); } catch (Exception) { throw; } }