public static string BookAppointment(TurnDetailsDTO appointment) { try { ActivityTimeDTO activityTime = ActivityTimeBL.GetActivityTime(appointment.EstimatedHour, appointment.ServiceId); customersInLine turn = new customersInLine() { activityTimeId = activityTime.ActivityTimeId, custId = appointment.CustId, estimatedHour = appointment.EstimatedHour, preAlert = appointment.PreAlert, statusTurn = (int)eStatus.ADVANCE, enterHour = ConfigureHour(appointment.EstimatedHour, activityTime), isActive = true }; turn.TurnId = TurnDal.AddAppointment(turn); string verificationCode = TurnBL.CreateVerificationCode(turn); turn.verificationCode = verificationCode; TurnDal.UpdateTurn(turn); return(verificationCode); } catch (Exception) { throw; } }
/// <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; } }