private void btnAssignTechnician_Click(object sender, RoutedEventArgs e) { TechnicianSchedule technicianSchedule = new TechnicianSchedule(Guid.NewGuid(), currentSelectedTechnician.ADTechnician.GUID ?? new Guid(), appointment.GUID); technicianSchedule.insertTechnicianAppointment(); EventBus.EventBus.Instance.PostEvent(new CustomEvent("AppointAddedToSchedule")); EventBus.EventBus.Instance.PostEvent(new CustomEvent("Notify", "Appointment assigned to Technician", CustomEvent.EventType.accept)); NavigationService.NavigateBack(); }
private void lvAllTechnicians_PreviewMouseUp(object sender, MouseButtonEventArgs e) { var item = (sender as ListView).SelectedItem; if (item != null) { try { //dynamic selectedClient = (ExpandoObject)item; TechnicianDBInfo selectedDictionaryItem = (TechnicianDBInfo)item; TechnicianSchedule technicianSchedule = new TechnicianSchedule(); currentSelectedTechnician = selectedDictionaryItem; bool isAvailable = technicianSchedule.checkIfTechnicianIsAvailable(appointment.Time, selectedDictionaryItem.ADTechnician.GUID ?? Guid.NewGuid()); txtNameSurname.Text = selectedDictionaryItem.ADTechnician.Name; if (isAvailable) { txtAvailable.Text = "Yes"; btnAssignTechnician.IsEnabled = true; } else { txtAvailable.Text = "No, Slot unavailable"; btnAssignTechnician.IsEnabled = false; } txtAppointmentsDone.Text = string.Format("{0} done", selectedDictionaryItem.TotalAppointments); } catch (Exception exception) { ErrorHandler.ErrorHandle error = ErrorHandler.ErrorHandle.getInstance(); error.handle(exception, true); } } }