private void showBookingWithType(int bookingId, string bookingType) { BookingServiceReference.Booking booking = bookingService.GetBooking(bookingId); if (bookingType == "ReadyToGo") { BookingServiceReference.ReadyToGo readyToGo = bookingService.GetReadyToGo(bookingId); //Viser formen ShowBookingForms.ShowReadyToGoForm showReadyToGoForm = new ShowReadyToGoForm(booking, readyToGo); showReadyToGoForm.Show(); } else if (bookingType == "Task") { BookingServiceReference.SupportTask supportTask = bookingService.GetSupportTask(bookingId); //Viser formen ShowBookingForms.ShowTaskForm showTaskForm = new ShowTaskForm(booking, supportTask); showTaskForm.Show(); } else if (bookingType == "SupportBooking") { BookingServiceReference.SupportBooking supportBooking = bookingService.GetSupportBooking(bookingId); //Viser formen ShowBookingForms.ShowSupportBookingForm showSupportBookingForm = new ShowSupportBookingForm(booking, supportBooking); showSupportBookingForm.Show(); } else { MessageBox.Show("Fejl kunne ikke hente booking typen", "Booking type fejl"); } }
private void btnCreateTask_Click(object sender, EventArgs e) { DateTime date; DateTime time; DateTime dateTime; BookingServiceReference.SupportTask supportTask = new BookingServiceReference.SupportTask(); supportTask.User_Id = User.Id; date = dtpDate.Value.Date; time = Convert.ToDateTime(cbTaskStatDate.Text); dateTime = date.Date + time.TimeOfDay; supportTask.StartDate = dateTime; time = Convert.ToDateTime(cbTaskEndDate.Text); dateTime = date.Date + time.TimeOfDay; supportTask.EndDate = dateTime; supportTask.Name = txtTaskName.Text; supportTask.Description = txtTaskDescription.Text; CalendarServiceReference.Calendar calendar = calendarService.Get(User.Id); supportTask.Calendar_Id = calendar.Id; supportTask.BookingType = "Task"; if (cbTaskEndDate.Text != null && cbTaskStatDate != null) { if (supportTask.EndDate > supportTask.StartDate) { try { bookingService.CreateTask(supportTask); this.Close(); } catch (Exception) { MessageBox.Show("Kunne ikke oprette booking", "Fejl"); } } else { MessageBox.Show("S**t tid er mindre end Start tid", "Fejl"); } } else { MessageBox.Show("Ikke alle tidspunkter er udfyldt", "Fejl"); } }
public void CreateTask(BookingServiceReference.SupportTask supportTask) { bookingService.CreateSupportTask(supportTask); }