public static List <TechnicianRequirement> TestGetTourOfTechnician(Ident ident, int mandatorId, ID technicianID, DateTime date, VueTOView.Common.Environment environment) { List <TechnicianRequirement> list = new List <TechnicianRequirement>(); List <TechnicianRequirement> tours = new List <TechnicianRequirement>(); WebToolExtendedServiceClient client = ClientProvider.ProvideTOClient(environment); Task <ServiceReference2.ResultListOfAppointmentuukIAVwv> task = client.GetTourOfTechnicianAsync(ident, mandatorId, technicianID, date, null); ResultListOfAppointmentuukIAVwv result = task.Result; if ((result != null) && string.IsNullOrEmpty(result.Error) && (result.DataList != null) && (result.DataList.Length > 0)) { List <Appointment> appointments = result.DataList.Where(x => x.State != ActivationState.Deleted).ToList(); foreach (Appointment appointment in appointments) { List <TechnicianRequirement> appointmenttours = appointment.TechnicianRequirements.Where(y => y.TechnicianID.SourceId == technicianID.SourceId && y.State != ActivationState.Deleted).ToList(); foreach (TechnicianRequirement tour in appointmenttours) { tour.Appointment = appointment; tour.Appointment.GeoLocation = TestGetGeoLocation(client, ident, mandatorId, tour.Appointment.GeoLocationID); if (tour.Appointment.GeoLocation != null) { tours.Add(tour); } } } list = tours.OrderBy(x => x.RealStart).ToList(); } return(list); }
public static List <TechnicianRequirement> GetToursOfTechnicianFromService(GetToursOfTechnicianRequest getToursOfTechnicianRequest) { if (getToursOfTechnicianRequest == null) { throw new ArgumentNullException(nameof(getToursOfTechnicianRequest)); } List <TechnicianRequirement> list = new List <TechnicianRequirement>(); List <TechnicianRequirement> tours = new List <TechnicianRequirement>(); WebToolExtendedServiceClient client = ClientProvider.ProvideTOClient(getToursOfTechnicianRequest.Environment); Task <ServiceReference2.ResultListOfAppointmentuukIAVwv> task = client.GetTourOfTechnicianAsync(getToursOfTechnicianRequest.Ident, getToursOfTechnicianRequest.MandatorId, getToursOfTechnicianRequest.TechnicianID, getToursOfTechnicianRequest.Date, null); ResultListOfAppointmentuukIAVwv result = task.Result; if ((result != null) && string.IsNullOrEmpty(result.Error) && (result.DataList != null) && (result.DataList.Length > 0)) { List <Appointment> appointments = result.DataList.Where(x => x.State != ActivationState.Deleted).ToList(); foreach (Appointment appointment in appointments) { List <TechnicianRequirement> appointmenttours = appointment.TechnicianRequirements.Where(y => y.TechnicianID.SourceId == getToursOfTechnicianRequest.TechnicianID.SourceId && y.State != ActivationState.Deleted).ToList(); foreach (TechnicianRequirement tour in appointmenttours) { tour.Appointment = appointment; tour.Appointment.GeoLocation = GetGeoLocation(client, getToursOfTechnicianRequest.Ident, getToursOfTechnicianRequest.MandatorId, tour.Appointment.GeoLocationID); if (tour.Appointment.GeoLocation != null) { tours.Add(tour); } } } list = tours.OrderBy(x => x.RealStart).ToList(); } return(list); }
public static WebToolExtendedServiceClient ProvideTOClient(Environment environment) { string endpointAddress = string.Empty; endpointAddress = UrlProvider.ProvideForTO(environment); WebToolExtendedServiceClient client = new WebToolExtendedServiceClient(endpointAddress); return(client); }
public static GeoLocation TestGetGeoLocation(WebToolExtendedServiceClient client, Ident ident, int mandatorId, ID geoLocationID) { if (client == null) { throw new ArgumentNullException(nameof(client)); } GeoLocation geoLocation = null; Task <ServiceReference2.ResultOfGeoLocationuukIAVwv> task = client.GetGeoLocationAsync(ident, mandatorId, geoLocationID, null); ResultOfGeoLocationuukIAVwv result = task.Result; if ((result != null) && string.IsNullOrEmpty(result.Error) && (result.Data != null)) { geoLocation = result.Data; } return(geoLocation); }
private static List <Technician> GetTechniciansFromService(GetTechniciansRequest getTechniciansRequest) { List <Technician> tourtechnicians = new List <Technician>(); WebToolExtendedServiceClient client = ClientProvider.ProvideTOClient(getTechniciansRequest.Environment); Task <ServiceReference2.ResultListOfTechnicianuukIAVwv> task = client.GetTechniciansAsync(getTechniciansRequest.Ident, getTechniciansRequest.MandatorId, null); ResultListOfTechnicianuukIAVwv result = task.Result; if ((result != null) && string.IsNullOrEmpty(result.Error) && (result.DataList != null) && (result.DataList.Length > 0)) { List <Technician> technicians = result.DataList.ToList(); foreach (Technician tec in technicians.Where(x => !x.IsSubcontractor).OrderBy(x => x.Name)) { tourtechnicians.Add(tec); } } return(tourtechnicians); }
public static List <Technician> TestGetTourTechnicians(Ident ident, int mandatorId, VueTOView.Common.Environment environment) { List <Technician> tourtechnicians = new List <Technician>(); WebToolExtendedServiceClient client = ClientProvider.ProvideTOClient(environment); Task <ServiceReference2.ResultListOfTechnicianuukIAVwv> task = client.GetTechniciansAsync(ident, mandatorId, null); ResultListOfTechnicianuukIAVwv result = task.Result; if ((result != null) && string.IsNullOrEmpty(result.Error) && (result.DataList != null) && (result.DataList.Length > 0)) { List <Technician> technicians = result.DataList.ToList(); foreach (Technician tec in technicians.Where(x => !x.IsSubcontractor).OrderBy(x => x.Name)) { tourtechnicians.Add(tec); } } return(tourtechnicians); }