private IAppointmentDetails BuildAppointmentDetails(string[] idColumnSet) { IAppointmentDetails appointmentDetails = kernel.Get <IAppointmentDetails>(); IDate date = kernel.Get <IDate>(); ICustomer customer = kernel.Get <ICustomer>(); IMyServices service = kernel.Get <IMyServices>(); if (idColumnSet.Length > 0) { customer = customerController.GetCustomer(idColumnSet[1]); service = myServicesController.GetService(idColumnSet[2]); date = dateController.GetDate(idColumnSet[3]); appointmentDetails.Forename = customer.Forename; appointmentDetails.Surname = customer.Surname; appointmentDetails.Telephone = customer.Telephone; appointmentDetails.AppointmentDay = date.Day; appointmentDetails.AppointmentTime = date.Time; appointmentDetails.AppointmentDuration = date.Duration; appointmentDetails.AppointmentLength = date.Length; appointmentDetails.AppointmentId = idColumnSet[0]; appointmentDetails.Name = service.Name; } return(appointmentDetails); }
public EntryLogRepository(AppDbContext appDb, IMyServices myServices) { _appDb = appDb; _logEntry = new LogEntry(); _myServices = myServices; _logListViewModel = new LogListViewModel(); }
public HomeController(ILogger <HomeController> logger, ILogEntryRepository logEntryRepository, IMyServices myServices) { _logger = logger; _logEntryRepository = logEntryRepository; _myServices = myServices; }
public IEnumerable <Allocation> GetAllocations() { IMyServices client = GetClient(); var result = client.GetAllocations().ToList(); CloseClient(client); return(result); }
public void ModifyAppointment(IAppointment appointment, ICustomer customer, IMyServices service, string existingAppointmentDuration) { bool IsTimeAvailable = false; string timeToCalculate; // obliczanie minut wizyty na podstawie zakresu - 1 to jedna kratka, 30minut DateTime.TryParse(appointment.AppointmentTime, out DateTime appointmentTime); double.TryParse(appointment.AppointmentDuration, out double multiplier); double.TryParse(existingAppointmentDuration, out double existingMultiplier); int newTimeAppointmentInMinutes = (int)(60 * (multiplier / 2)); int timeAppointmentMinutes = (int)(60 * (existingMultiplier / 2)); if (timeAppointmentMinutes < newTimeAppointmentInMinutes) { // rozszerzam wizytę < for (int i = timeAppointmentMinutes; i < newTimeAppointmentInMinutes; i++) { // sprawdź po minucie czy wolny zakres terminów timeToCalculate = appointmentTime.AddMinutes(i).ToShortTimeString(); if (dateController.GetDate(appointment.AppointmentDay, timeToCalculate).Date_Id == null) { IsTimeAvailable = true; } else { IsTimeAvailable = false; break; } } } else { // skracam wizytę >= IsTimeAvailable = true; } // kontrola końca formularza / dnia IsTimeAvailable = CheckAvailableTimeToEndOfWorkInMinutes(appointment, IsTimeAvailable, newTimeAppointmentInMinutes); if (IsTimeAvailable) { try { UpdateAppointmentToDatabase(appointment, customer, service); } catch (Exception) { MessageBox.Show("AppointmentProcessor Error Modify Appointment Method"); } } else { MessageBox.Show("Za mało dostępnego czasu do wykonania modyfikacji. Wybierz inny termin wizyty!"); } }
public IMyServices CreateService(params string[] model) { IMyServices service = kernel.Get <IMyServices>(); service.Service_Id = model[0]; service.Name = model[1]; return(service); }
protected virtual void OnUpdatedToDatabase(IDate date, ICustomer customer, IMyServices service) { UpdatedToDatabase?.Invoke(this, new AppointmentEventArgs() { Date = date, Customer = customer, Service = service }); }
public SearchFilterLogic(ILogEntryRepository logEntryRepository, IMyServices myServices, Level levelInput, string id, string dateInput, string thread, string message, string searchBarInput) { _logEntryRepository = logEntryRepository; _myServices = myServices; _levelInput = levelInput; _id = id; _dateInput = dateInput; _thread = thread; _message = message; _searchBarInput = searchBarInput; }
public IMyServices GetService(string service_id) { IMyServices service = kernel.Get <IMyServices>(); IMyServicesController myServicesProcessor = kernel.Get <IMyServicesController>(); query = string.Format("SELECT * FROM service WHERE service_id = '{0}'", service_id); var receivedData = msSqlDataAccess.GetDataList(query, service).ToArray(); service = myServicesProcessor.CreateService(receivedData); return(service); }
public BusinessLogic() { appointment = kernel.Get <IAppointment>(); appointmentProcessor = kernel.Get <IAppointmentProcessor>(); customer = kernel.Get <ICustomer>(); dayCounting = kernel.Get <IDayCounting>(); dateFormatCheck = kernel.Get <IDateFormatCheck>(); service = kernel.Get <IMyServices>(); setNumberOfLabel = kernel.Get <ISetNumberOfLabel>(); setValueToLabelSize = kernel.Get <ISetValueToLabelSize>(); timeFromLabel = kernel.Get <ITimeFromLabel>(); }
public void UpdateAppointment(IDate date, ICustomer customer, IMyServices service, string appointmentToModify_id) { query = string.Format("UPDATE appointment SET customer_id = '{0}'," + "service_id = '{1}', date_id = '{2}' WHERE appointment_id = '{3}'", customer.Customer_Id, service.Service_Id, date.Date_Id, appointmentToModify_id); msSqlDataAccess.SaveData(query); OnUpdatedToDatabase(date, customer, service); }
public void BuildAppointment(IAppointment appointment, ICustomer customer, IMyServices service) { bool IsTimeAvailable = false; string timeToCalculate = null; double.TryParse(appointment.AppointmentDuration, out double multiplier); DateTime.TryParse(appointment.AppointmentTime, out DateTime appointmentTime); int newTimeAppointmentInMinutes = (int)(60 * (multiplier / 2)); // minuta po minucie sprawdzaj zajętość pola for (int i = 0; i < newTimeAppointmentInMinutes; i++) { timeToCalculate = appointmentTime.AddMinutes(i).ToShortTimeString(); // kolizja z następnym terminem if (dateController.GetDate(appointment.AppointmentDay, timeToCalculate).Date_Id == null) { IsTimeAvailable = true; } else { IsTimeAvailable = false; break; } } IsTimeAvailable = CheckAvailableTimeToEndOfWorkInMinutes(appointment, IsTimeAvailable, newTimeAppointmentInMinutes); if (IsTimeAvailable) { try { SaveAppointmentToDataBase(appointment, customer, service); } catch (Exception) { MessageBox.Show("AppointmentProcessor Error"); } } else { MessageBox.Show("Termin jest zajęty! Wybierz inny termin wizyty!"); } }
private void CloseClient(IMyServices client) { ICommunicationObject wcfClient = client as ICommunicationObject; if (wcfClient != null) { if (wcfClient.State == CommunicationState.Faulted) { wcfClient.Abort(); } else { wcfClient.Close(); } } else { ((IDisposable)client).Dispose(); } }
public AnimalController(IMyServices myServices) { _myServices = myServices; }
private void SaveAppointmentToDataBase(IAppointment appointment, ICustomer customer, IMyServices service) { IDate date = kernel.Get <IDate>(); appointmentController.SaveToDatabaseEvent += emailConfirmation.OnSavedToDatabaseEventLog; appointmentController.SaveToDatabaseEvent += smsConfirmation.OnSavedToDatabaseEventLog; var date_id = dateController.GetDate(appointment.AppointmentDay, appointment.AppointmentTime).Date_Id; var customer_id = customerController.GetCustomer(customer).Customer_Id; var service_id = myServicesController.GetService(service).Service_Id; if (CheckObjectIsItNotNull(appointment, customer, service)) { if (string.IsNullOrEmpty(customer_id)) { customerController.SaveCustomer(customer); customer_id = customerController.GetCustomer(customer).Customer_Id; } if (string.IsNullOrEmpty(date_id)) { date.Day = appointment.AppointmentDay; date.Time = appointment.AppointmentTime; date.Length = appointment.AppointmentLength; date.Duration = appointment.AppointmentDuration; dateController.SaveDate(date); date_id = dateController.GetDate(date.Day, date.Time).Date_Id; appointmentController.SaveAppointment(date_id, customer_id, service_id); } else { MessageBox.Show("Termin zajęty!"); } } }
private static bool CheckObjectIsItNotNull(IAppointment appointment, ICustomer customer, IMyServices service) { if ((!string.IsNullOrWhiteSpace(appointment.AppointmentDay)) && (!string.IsNullOrWhiteSpace(appointment.AppointmentTime)) && (!string.IsNullOrWhiteSpace(appointment.AppointmentLength)) && (!string.IsNullOrWhiteSpace(appointment.AppointmentDuration)) && (!string.IsNullOrWhiteSpace(customer.Surname)) && (!string.IsNullOrWhiteSpace(service.Name))) { return(true); } else { return(false); } }
private void UpdateAppointmentToDatabase(IAppointment appointment, ICustomer customer, IMyServices service) { appointmentController.UpdatedToDatabase += emailConfirmation.OnUpdatedToDatabaseEventLog; appointmentController.UpdatedToDatabase += smsConfirmation.OnUpdatedToDatabaseEventLog; var date_id = dateController.GetDate(appointment.AppointmentDay, appointment.AppointmentTime); var customer_id = customerController.GetCustomer(customer); var service_id = myServicesController.GetService(service); var appointmentToModify_id = appointmentController.GetAppointment_id(appointment.AppointmentDay, appointment.AppointmentTime); if (CheckObjectIsItNotNull(appointment, customer, service)) { if (string.IsNullOrWhiteSpace(customer_id.Customer_Id)) { customerController.SaveCustomer(customer); customer_id = customerController.GetCustomer(customer); } dateController.UpdateDate(date_id, appointment); appointmentController.UpdateAppointment(date_id, customer_id, service_id, appointmentToModify_id); } }