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);
        }
        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!");
                }
            }
        }