Пример #1
0
        public string SendMessage(Login login, string vehicle, string msg)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.IdentifierVehicle Vehicle = new IWS.IdentifierVehicle()
            {
                IdentifierVehicleType = IWS.enumIdentifierVehicleType.ID,
                Id = vehicle
            };

            IWS.TextMessageSend Message = new IWS.TextMessageSend()
            {
                Vehicles         = new IWS.IdentifierVehicle[] { Vehicle },
                VehicleType      = IWS.enumVehicleType.SINGLE_VEHICLES,
                ReadConfirmation = false,
                Message          = msg
            };

            IWS.SendTextMessageResult SendTextMessageResult = IWSService.Send_TextMessage_ReturnID(iwsLogin(login), Message);
            string strError = handleError(SendTextMessageResult);

            if (strError == null)
            {
                return("");
            }
            else
            {
                return(strError);
            }
        }
Пример #2
0
        public string RemoveVehicleFromPlanner(Login login, ref IWS.ServiceSoapClient IWSService, string VehID, string PlannerID)
        {
            IWS.IdentifierVehicle Veh = new IWS.IdentifierVehicle()
            {
                IdentifierVehicleType = IWS.enumIdentifierVehicleType.ID,
                Id = VehID
            };

            IWS.Identifier disp = new IWS.Identifier()
            {
                IdentifierType = IWS.enumIdentifierType.ID,
                Id             = PlannerID
            };

            IWS.RemoveIdentifiersFromDispatchers ws = new IWS.RemoveIdentifiersFromDispatchers
            {
                VehicleItemList    = new IWS.IdentifierVehicle[] { Veh },
                DispatcherItemList = new IWS.Identifier[] { disp }
            };

            IWS.ExecutionResult RemVehToPlanRes = IWSService.Remove_Vehicles_From_Dispatchers(iwsLogin(login), ws);

            string strError = handleError(RemVehToPlanRes);

            if (strError == null)
            {
                return("");
            }
            else
            {
                return(strError);
            }
        }
Пример #3
0
        public ActivityReport[] GetActRep(Login login, int minutes)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.ActivityReportSelection_V3 ActRepSel = new IWS.ActivityReportSelection_V3();

            IWS.DateTimeSelection      dtSel = new IWS.DateTimeSelection();
            IWS.DateTimeAndIdSelection idSel = new IWS.DateTimeAndIdSelection();

            idSel.DateTimeType = IWS.enumSelectionDateTimeAndIdType.MINUTES;
            idSel.Value        = minutes;

            dtSel.DateTimeType = IWS.enumSelectionDateTimeType.MINUTES;
            dtSel.Value        = minutes;

            ActRepSel.DateTimeSelection = idSel;

            IWS.GetActivityReportResult_V9 ActRepRes = IWSService.Get_ActivityReport_V9(iwsLogin(login), ActRepSel);

            int i = 0;

            ActivityReport[] actRepList = new ActivityReport[ActRepRes.ActivityReportItems.Count()];

            foreach (IWS.ActivityReportItem_V9 act in ActRepRes.ActivityReportItems)
            {
                i = MoveActToActRep(act, ref actRepList, i);
            }
            return(actRepList);
        }
Пример #4
0
        public Message[] GetMessagesInbox(Login login, string LastID, ref string NewLastID)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.TextMessageInboxSelection_V2 InboxSelection = new IWS.TextMessageInboxSelection_V2();

            IWS.DateTimeAndIdSelection Selection = new IWS.DateTimeAndIdSelection();
            if (LastID == "")
            {
                Selection.DateTimeType = IWS.enumSelectionDateTimeAndIdType.GET_MODIFIED_SINCE_LAST_REQUEST;
            }
            else
            {
                Selection.DateTimeType = IWS.enumSelectionDateTimeAndIdType.GET_MODIFIED_SINCE_LAST_ID;
                Selection.Value        = Convert.ToInt64(LastID);
            }
            InboxSelection.SelectionFromToday = Selection;

            IWS.GetTextMessagesInbox_V6 InboxTextMessageResult = IWSService.Get_TextMessages_Inbox_V6(iwsLogin(login), InboxSelection);

            if (InboxTextMessageResult.MaximumModificationID == null)
            {
                NewLastID = LastID;
            }
            else
            {
                NewLastID = InboxTextMessageResult.MaximumModificationID.Value.ToString();
            }

            int i = 0;

            Message[] messageList = new Message[InboxTextMessageResult.Inbox.Count()];

            foreach (IWS.TextMessageInbox_V6 message in InboxTextMessageResult.Inbox)
            {
                Message msg = new Message();

                if (message.Vehicle != null)
                {
                    msg.VehicleID = message.Vehicle.ID;
                }
                if (message.Driver != null)
                {
                    msg.DriverID = message.Driver.ID;
                }

                msg.Text          = message.Message;
                msg.ID            = message.TextMessageID;
                msg.CreationDate  = message.CreationDate;
                msg.DeliveredDate = message.DeliveredDate;
                messageList[i]    = msg;
                i += 1;
            }
            return(messageList);
        }
Пример #5
0
        public string CancelPlanning(Login login, string TripID)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.PlanningItemSelection CancelPlanningData = new IWS.PlanningItemSelection()
            {
                ID = TripID,
                PlanningSelectionType = IWS.enumPlanningItemSelectionType.TRIP
            };

            IWS.ExecutionResult PlanningCancelResult = IWSService.Cancel_Planning(iwsLogin(login), CancelPlanningData);

            return(handleError(PlanningCancelResult));
        }
Пример #6
0
        public string UpdateVehicle(Login login, string NAVID, string Kenteken, String ChassisNo, String GSMNummer, string AutoFilter, string Brand)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            string strError = "";

            IWS.VehicleInsert UpdateVehicle = new IWS.VehicleInsert {
                VehicleID           = NAVID,
                VehicleExternalCode = NAVID,
                LicensePlate        = Kenteken,
                AutoFilter          = AutoFilter,
                Category            = IWS.VehicleCategory.GeneralCargo,
                GsmNumber           = GSMNummer,
                TechnicalInfo       = new IWS.VehicleTechnicalInfo {
                    ChassisNumber = ChassisNo,
                    BrandCode     = Brand
                }
            };

            IWS.ResultInfo Update_VehicleResult = IWSService.Update_Vehicle(iwsLogin(login), UpdateVehicle);
            strError = handleError(Update_VehicleResult);
            if (!string.IsNullOrEmpty(strError))
            {
                return("Error Update " + strError);
            }

            IWS.IdentifierVehicle Vehicle = new IWS.IdentifierVehicle()
            {
                IdentifierVehicleType = IWS.enumIdentifierVehicleType.ID,
                Id = NAVID
            };

            IWS.VehicleSelection_With_NextStop_Info GetVehicles = new IWS.VehicleSelection_With_NextStop_Info()
            {
                Identifiers = new IWS.IdentifierVehicle[] { Vehicle }
            };

            IWS.GetVehicleResult_With_NextStop_Info get_VehicleResult = IWSService.Get_Vehicles_V2(iwsLogin(login), GetVehicles);

            long strTransicsID = 0;

            foreach (IWS.VehicleResult_With_NextStop_Info veh in get_VehicleResult.Vehicles)
            {
                strTransicsID = veh.VehicleTransicsID;
            }

            return("Ready " + strTransicsID.ToString());
        }
Пример #7
0
        public string UpdateVehicleOutOfDuty(Login login, string NAVID, DateTime OutOfService)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.VehicleInsert UpdateVehicle = new IWS.VehicleInsert {
                VehicleID     = NAVID,
                Inactive      = true,
                TechnicalInfo = new IWS.VehicleTechnicalInfo {
                    OutOfDuty = OutOfService,
                }
            };

            IWS.ResultInfo Update_VehicleResult = IWSService.Update_Vehicle(iwsLogin(login), UpdateVehicle);
            string         strError             = handleError(Update_VehicleResult);

            if (!string.IsNullOrEmpty(strError))
            {
                return("Error Out of Service " + strError);
            }

            IWS.IdentifierVehicle Vehicle = new IWS.IdentifierVehicle()
            {
                IdentifierVehicleType = IWS.enumIdentifierVehicleType.ID,
                Id = NAVID
            };

            IWS.VehicleSelection_With_NextStop_Info GetVehicles = new IWS.VehicleSelection_With_NextStop_Info()
            {
                Identifiers = new IWS.IdentifierVehicle[] { Vehicle }
            };

            IWS.GetVehicleResult_With_NextStop_Info get_VehicleResult = IWSService.Get_Vehicles_V2(iwsLogin(login), GetVehicles);

            long strTransicsID = 0;

            foreach (IWS.VehicleResult_With_NextStop_Info veh in get_VehicleResult.Vehicles)
            {
                strTransicsID = veh.VehicleTransicsID;
            }

            return("Ready " + strTransicsID.ToString());
        }
Пример #8
0
        public string UpdateDriverResigned(Login login, string NAVID, DateTime TerminationDate)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.PersonInsert UpdateDriverRes = new IWS.PersonInsert {
                PersonID      = NAVID,
                TechnicalInfo = new IWS.PersonTechnicalInfo {
                    Resigned = TerminationDate
                }
            };

            IWS.ResultInfo Update_DriverResultRes = IWSService.Update_Driver(iwsLogin(login), UpdateDriverRes);

            string strError = handleError(Update_DriverResultRes);

            if (!string.IsNullOrEmpty(strError))
            {
                return(strError);
            }

            IWS.Identifier Driver = new IWS.Identifier()
            {
                IdentifierType = IWS.enumIdentifierType.ID,
                Id             = NAVID
            };

            IWS.PersonSelection GetDrivers = new IWS.PersonSelection()
            {
                Persons = new IWS.Identifier[] { Driver },
            };

            IWS.GetPersonResult get_DriversResult = IWSService.Get_Drivers(iwsLogin(login), GetDrivers);

            long strTransicsID = 0;

            foreach (IWS.PersonResult driver in get_DriversResult.Persons)
            {
                strTransicsID = driver.PersonTransicsID;
            }

            return(strTransicsID.ToString());
        }
Пример #9
0
        public string InsertDriver(Login login, string NAVID, string VoorNaam, string AchterNaam)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.PersonInsert_V2 InsertPerson = new IWS.PersonInsert_V2 {
                PersonID           = NAVID,
                Firstname          = VoorNaam,
                Lastname           = AchterNaam,
                Language           = "NL",
                PersonExternalCode = NAVID
            };

            IWS.ResultInfo Insert_PersonResult = IWSService.Insert_Driver_V2(iwsLogin(login), InsertPerson);
            string         strError            = handleError(Insert_PersonResult);

            if (strError == null)
            {
                return(Insert_PersonResult.ID);
            }

            IWS.Identifier Driver = new IWS.Identifier()
            {
                IdentifierType = IWS.enumIdentifierType.ID,
                Id             = NAVID
            };

            IWS.PersonSelection GetDrivers = new IWS.PersonSelection()
            {
                Persons = new IWS.Identifier[] { Driver },
            };

            IWS.GetPersonResult get_DriversResult = IWSService.Get_Drivers(iwsLogin(login), GetDrivers);

            long strTransicsID = 0;

            foreach (IWS.PersonResult driver in get_DriversResult.Persons)
            {
                strTransicsID = driver.PersonTransicsID;
            }

            return(strTransicsID.ToString());
        }
Пример #10
0
        public string ExecCancelPlaces(Login login, Cancel cancel)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);
            string strError = "";

            foreach (string PlaceID in cancel.PlaceID)
            {
                IWS.PlanningItemSelection CancelPlanningData = new IWS.PlanningItemSelection()
                {
                    ID = PlaceID,
                    PlanningSelectionType = IWS.enumPlanningItemSelectionType.PLACE
                };

                IWS.ExecutionResult PlanningCancelResult = IWSService.Cancel_Planning(iwsLogin(login), CancelPlanningData);

                strError = handleError(PlanningCancelResult);
            }

            return(strError);
        }
Пример #11
0
        public ActivityReport[] GetActRepVehicle(Login login, string vehicle, DateTime FromDate, DateTime ToDate)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.ActivityReportSelection_V3 ActRepSel = new IWS.ActivityReportSelection_V3();

            IWS.PeriodSelectionWithDateType pSel = new IWS.PeriodSelectionWithDateType();

            pSel.StartDate = FromDate;
            pSel.EndDate   = ToDate;

            ActRepSel.DateTimeRangeSelection = pSel;
            ActRepSel.IncludeRegistrations   = true;

            IWS.IdentifierVehicle Vehicle = new IWS.IdentifierVehicle()
            {
                IdentifierVehicleType = IWS.enumIdentifierVehicleType.ID,
                Id = vehicle
            };

            ActRepSel.IncludeRegistrations = true;

            ActRepSel.Vehicles = new IWS.IdentifierVehicle[] { Vehicle };
            IWS.GetActivityReportResult_V9 ActRepRes = IWSService.Get_ActivityReport_V9(iwsLogin(login), ActRepSel);

            foreach (IWS.Error err in ActRepRes.Errors)
            {
                throw new System.InvalidOperationException(err.ErrorCodeExplanation);
            }

            int i = 0;

            ActivityReport[] actRepList = new ActivityReport[ActRepRes.ActivityReportItems.Count()];

            foreach (IWS.ActivityReportItem_V9 act in ActRepRes.ActivityReportItems)
            {
                i = MoveActToActRep(act, ref actRepList, i);
            }
            return(actRepList);
        }
Пример #12
0
        public string InsertVehicle(Login login, string NAVID, string Kenteken)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.VehicleInsert InsertVehicle = new IWS.VehicleInsert {
                VehicleID           = NAVID,
                VehicleExternalCode = NAVID,
                LicensePlate        = Kenteken
            };

            IWS.ResultInfo Insert_VehicleResult = IWSService.Insert_Vehicle(iwsLogin(login), InsertVehicle);
            string         strError             = handleError(Insert_VehicleResult);

            if (string.IsNullOrEmpty(strError))
            {
                return(Insert_VehicleResult.ID);
            }
            else
            {
                return(strError);
            }
        }
Пример #13
0
        public string DoVehicleSynch(Login login, string planner, bool debug, string[] VehToRemove, string[] VehToAdd)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            string ErrorMessage = "";

            foreach (string veh in VehToRemove)
            {
                try
                {
                    RemoveVehicleFromPlanner(login, ref IWSService, veh, planner);
                }
                catch (SystemException e)
                {
                    ErrorMessage = ErrorMessage + e.Message;
                };
            }
            ;

            foreach (string veh in VehToAdd)
            {
                try
                {
                    AssignVehicleToPlanner(login, ref IWSService, veh, planner);
                }
                catch (SystemException e)
                {
                    ErrorMessage = ErrorMessage + e.Message;
                };
            }
            ;

            if (debug)
            {
                return(ErrorMessage + VehToAdd.ToString());
            }

            return("");
        }
Пример #14
0
        public string AssignVehicleToPlanner(Login login, ref IWS.ServiceSoapClient IWSService, string VehID, string PlannerID)
        {
            IWS.IdentifierVehicle Veh = new IWS.IdentifierVehicle()
            {
                IdentifierVehicleType = IWS.enumIdentifierVehicleType.ID,
                Id = VehID
            };

            IWS.IdentifierVehicleItem item = new IWS.IdentifierVehicleItem()
            {
                Identifier = Veh
            };


            IWS.Identifier disp = new IWS.Identifier()
            {
                IdentifierType = IWS.enumIdentifierType.ID,
                Id             = PlannerID
            };

            IWS.AssignIdentifiersToDispatchers ws = new IWS.AssignIdentifiersToDispatchers
            {
                VehicleItemList    = new IWS.IdentifierVehicleItem[] { item },
                DispatcherItemList = new IWS.Identifier[] { disp }
            };

            IWS.ExecutionResult AssVehToPlanRes = IWSService.Assign_Vehicles_To_Dispatchers(iwsLogin(login), ws);
            string strError = handleError(AssVehToPlanRes);

            if (strError == null)
            {
                return("");
            }
            else
            {
                return(strError);
            }
        }
Пример #15
0
        public ActivityReport[] GetActRepVehicleDetail(Login login, string vehicle, DateTime FromDate, DateTime ToDate)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.ActivityReportSelectionDetail_V4 ActRepSel = new IWS.ActivityReportSelectionDetail_V4();
            IWS.Period dsSel = new IWS.Period();

            dsSel.From  = FromDate;
            dsSel.Until = ToDate;

            ActRepSel.DateStrategySelection = dsSel;
            ActRepSel.IncludeRegistrations  = true;

            IWS.IdentifierVehicle Vehicle = new IWS.IdentifierVehicle()
            {
                IdentifierVehicleType = IWS.enumIdentifierVehicleType.ID,
                Id = vehicle
            };

            ActRepSel.Vehicles = new IWS.IdentifierVehicle[] { Vehicle };
            IWS.GetActivityReportDetailResult_V11 ActRepRes = IWSService.Get_ActivityReportDetail_V11(iwsLogin(login), ActRepSel);

            foreach (IWS.Error err in ActRepRes.Errors)
            {
                throw new System.InvalidOperationException(err.ErrorCodeExplanation);
            }

            int i = 0;

            ActivityReport[] actRepList = new ActivityReport[ActRepRes.ActivityReportDetailItems.Count()];

            foreach (IWS.ActivityReportDetailItem_V11 act in ActRepRes.ActivityReportDetailItems)
            {
                i = MoveActToActRepDetail(act, ref actRepList, i);
            }
            return(actRepList);
        }
Пример #16
0
        public IWS.GetRemainingDrivingRestingTimesResults_V4 GetDrivingHours(Login login, string driverID)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.RemainingDrivingRestingTimesSelection sel = new IWS.RemainingDrivingRestingTimesSelection();

            //one driver
            IWS.Identifier[] drivers = new IWS.Identifier[1];
            IWS.Identifier   driver  = new IWS.Identifier();
            driver.IdentifierType = IWS.enumIdentifierType.ID;
            driver.Id             = driverID;
            drivers[0]            = driver;
            sel.Drivers           = drivers;


            sel.Edited_Data   = false;
            sel.Original_Data = true;

            sel.OnBoardComputer_Data = false;
            sel.Tacho_Data           = true;

            IWS.GetRemainingDrivingRestingTimesResults_V4 result = IWSService.Get_Remaining_Driving_Resting_Times_V4(iwsLogin(login), sel);
            return(result);
        }
Пример #17
0
        public string GetPlanning(Login login, ref Planning planning, string FromDate, ref string ToDate, bool Init)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.PlanningModificationsSelection_V2 PlanningSelection = new IWS.PlanningModificationsSelection_V2();

            IWS.DateTimeSelection      Selection = new IWS.DateTimeSelection();
            IWS.DateTimeRangeSelection dateRange = new IWS.DateTimeRangeSelection();
            if (Init)
            {
                Selection.DateTimeType = IWS.enumSelectionDateTimeType.GET_MODIFIED_SINCE_LAST_REQUEST;
                PlanningSelection.SelectionFromToday = Selection;
            }
            else
            {
                dateRange.StartDate             = Convert.ToDateTime(FromDate);
                PlanningSelection.DateTimeRange = dateRange;
            }

            PlanningSelection.PlanningSelectionType = IWS.enumPlanningSelectionModificationsType.ALL;
            IWS.GetPlanningModificationsResult_V5 getPlanningResult = IWSService.Get_Planning_Modifications_V5(iwsLogin(login), PlanningSelection);

            string strError = handleError(getPlanningResult);

            if (getPlanningResult.MaximumModificationDate == null)
            {
                ToDate = FromDate;
            }
            else
            {
                ToDate = getPlanningResult.MaximumModificationDate.Value.ToString();
            }

            if (getPlanningResult.Trips != null)
            {
                foreach (IWS.TripItemResult_V5 trip in getPlanningResult.Trips)
                {
                    planning.Trips.Add(new Trip {
                        TripId         = trip.TripId,
                        Status         = trip.Status.ToString(),
                        Vehicle        = trip.Vehicle.ID ?? "",
                        Driver         = trip.Driver?.ID ?? "",
                        StartDate      = trip.StartDate,
                        EndDate        = trip.EndDate,
                        TransferStatus = trip.TransferStatus.ToString(),
                        CancelStatus   = trip.CancelStatus.ToString(),
                        ExecutionDate  = (DateTime)trip.ExecutionDate
                    });
                }
            }
            if (getPlanningResult.Places != null)
            {
                foreach (IWS.PlaceItemResult_V4 place in getPlanningResult.Places)
                {
                    planning.Places.Add(new Place {
                        PlaceId           = place.PlaceId,
                        Status            = place.Status.ToString(),
                        ExecutionDate     = (DateTime)place.ExecutionDate,
                        DriverDisplay     = place.DriverDisplay,
                        VehicleCode       = place.Vehicle.Code ?? "",
                        DriverID          = place.Driver?.ID ?? "",
                        Author            = place.Author,
                        ActivityID        = (int)place.Activity.ID,
                        DispatcherDisplay = place.DispatcherDisplay,
                        Reference         = place.References.InternalReference ?? "",
                        StartDate         = place.StartDate,
                        EndDate           = place.EndDate
                    });
                }
            }
            if (getPlanningResult.Consultation != null)
            {
                foreach (IWS.Consultation_V3 consultation in getPlanningResult.Consultation)
                {
                    Consultation thisCons = new Consultation();
                    if (consultation.Place != null)
                    {
                        thisCons.PlaceId = consultation.Place.PlaceID;
                    }
                    if (consultation.Position != null)
                    {
                        thisCons.Latitude  = consultation.Position.Latitude;
                        thisCons.Longitude = consultation.Position.Longitude;
                    }
                    thisCons.Km = consultation.Km;
                    if (consultation.Trip != null)
                    {
                        thisCons.TripId = consultation.Trip.TripID;
                    }
                    thisCons.VehicleId   = consultation.Vehicle.ID;
                    thisCons.ActivityId  = consultation.Activity.ID;
                    thisCons.ArrivalDate = consultation.ArrivalDate;
                    thisCons.LeavingDate = consultation.LeavingDate;
                    planning.Consultations.Add(thisCons);
                }
            }
            if (getPlanningResult.Anomalies != null)
            {
                foreach (IWS.Anomaly_V3 anomaly in getPlanningResult.Anomalies)
                {
                    if (anomaly.Place == null)
                    {
                        planning.Anomalies.Add(new Anomaly {
                            CustomerID = anomaly.Product?.CustomerID ?? "",
                            //                        DriverId = anomaly.Driver.ID ?? "",
                            AnomalyCode        = anomaly.AnomalyCode,
                            AnomalyDateTime    = anomaly.AnomalyDateTime,
                            AnomalyDescription = anomaly.AnomalyDescription,
                            AnomalyID          = anomaly.AnomalyID
                        });
                    }
                    else
                    {
                        planning.Anomalies.Add(new Anomaly {
                            PlaceId    = anomaly.Place.CustomerID ?? "",
                            CustomerID = anomaly.Product?.CustomerID ?? "",
                            //                        DriverId = anomaly.Driver.ID ?? "",
                            AnomalyCode        = anomaly.AnomalyCode,
                            AnomalyDateTime    = anomaly.AnomalyDateTime,
                            AnomalyDescription = anomaly.AnomalyDescription,
                            AnomalyID          = anomaly.AnomalyID
                        });
                    }
                }
            }
            //if (getPlanningResult.Products != null)
            //    foreach (IWS.ProductItemResult_V3 product in getPlanningResult.Products) {
            //        Product thisProd = new Product();
            //        thisProd.ProductID = product.ProductID;
            //        thisProd.Status = product.Status.ToString();
            //        thisProd.DriverDisplay = product.DriverDisplay;
            //        //planning.Products.Add(thisProd);
            //    }
            if (getPlanningResult.Jobs != null)
            {
                foreach (IWS.JobItemResult_V3 job in getPlanningResult.Jobs)
                {
                    planning.Jobs.Add(new Job {
                        JobId         = job.JobId,
                        Comment       = job.Comment,
                        DriverDisplay = job.DriverDisplay,
                        Status        = job.Status.ToString()
                    });
                }
            }
            return(strError);
        }
Пример #18
0
        public List <Document> GetDocs(Login login, ref DocParameters docParameters)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.ScannedDocumentsSelection_V2 docsSel = new IWS.ScannedDocumentsSelection_V2();

            IWS.DateTimeAndIdSelection Selection = new IWS.DateTimeAndIdSelection();
            if (docParameters.LastID == "")
            {
                Selection.DateTimeType = IWS.enumSelectionDateTimeAndIdType.GET_MODIFIED_SINCE_LAST_REQUEST;
            }
            else
            {
                Selection.DateTimeType = IWS.enumSelectionDateTimeAndIdType.GET_MODIFIED_SINCE_LAST_ID;
                Selection.Value        = Convert.ToInt64(docParameters.LastID);
            }
            docsSel.SelectionFromToday = Selection;

            List <Document> documents = new List <Document>();

            IWS.ScannedDocumentSelection docSel = new IWS.ScannedDocumentSelection();

            IWS.GetScannedDocuments_V3 getScannedDocumentsResult = IWSService.Get_Scanned_Documents_V3(iwsLogin(login), docsSel);

            if (getScannedDocumentsResult.MaximumModificationID == null)
            {
                docParameters.NewLastID = docParameters.LastID;
            }
            else
            {
                docParameters.NewLastID = getScannedDocumentsResult.MaximumModificationID.Value.ToString();
            }

            if (getScannedDocumentsResult.Documents != null)
            {
                foreach (IWS.DocumentsResult_V3 doc in getScannedDocumentsResult.Documents)
                {
                    docSel.ScanID       = Convert.ToInt32(doc.ScanID.Value);
                    docSel.ConvertToPdf = true;
                    Int64 ModificationCounter = doc.ModificationID;
                    IWS.GetScannedDocument getScannedDocumentResult = IWSService.Get_Scanned_Document(iwsLogin(login), docSel);
                    int i = 0;
                    foreach (IWS.DocumentResult document in getScannedDocumentResult.Documents)
                    {
                        i++;
                        string placeid = "";
                        string doctype = "";

                        if (doc.Place != null)
                        {
                            placeid = doc.Place.PlaceID.ToString();
                        }
                        if (doc.TypeDoc != null)
                        {
                            doctype = doc.TypeDoc.ToString();
                        }

                        MemoryStream stream = new MemoryStream(Convert.FromBase64String(document.Document1));

                        Document thisdoc = new Document();

                        thisdoc.ScanID     = doc.ScanID.ToString();
                        thisdoc.SequenceID = i.ToString();
                        thisdoc.VehicleID  = doc.Vehicle.ID.ToString();
                        if (doc.Driver != null)
                        {
                            thisdoc.DriverID = doc.Driver.ID.ToString();
                        }
                        thisdoc.PlaceID      = placeid;
                        thisdoc.Comment      = doc.Comment;
                        thisdoc.DocumentType = doctype;
                        thisdoc.Doc          = stream;
                        thisdoc.DocumentID   = ModificationCounter;
                        documents.Add(thisdoc);
                    }
                }
            }

            string strError = handleError(getScannedDocumentsResult);

            if (strError != null)
            {
                docParameters.ErrorMessage = strError;
            }
            return(documents);
        }
Пример #19
0
        public string UpdateDriver(Login login, string NAVID, string VoorNaam, string AchterNaam, string Language, string Street, string PostCode, string City, string email,
                                   string GSM, string DriversLicense, bool ADR, DateTime EmpDate, string TachoCardID)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.InterfacePersonUpdate_V3 UpdateDriver = new IWS.InterfacePersonUpdate_V3 {
                DriverToUpdate = new IWS.Identifier {
                    IdentifierType = IWS.enumIdentifierType.ID,
                    Id             = NAVID
                },
                Lastname      = AchterNaam,
                Firstname     = VoorNaam,
                Language      = Language,
                TachoCardInfo = new IWS.InterfaceTachoCardInfoUpdate {
                    CardId = TachoCardID
                },
                TechnicalInfo = new IWS.PersonTechnicalInfo {
                    DriverLicense  = DriversLicense,
                    ADRCertificate = ADR,
                    Employed       = EmpDate
                },
                ContactInfo = new IWS.InterfacePersonContactInfo_V3 {
                    Email     = email,
                    GsmNumber = GSM,
                    Address   = new IWS.PersonAddress_V3 {
                        Street      = Street,
                        ZipCode     = PostCode,
                        CountryCode = Language,
                        City        = City
                    }
                }
            };

            IWS.ResultInfo Update_DriverResult = IWSService.Update_Driver_V4(iwsLogin(login), UpdateDriver);

            string strError = handleError(Update_DriverResult);

            if (!string.IsNullOrEmpty(strError))
            {
                return(strError);
            }

            IWS.Identifier Driver = new IWS.Identifier()
            {
                IdentifierType = IWS.enumIdentifierType.ID,
                Id             = NAVID
            };

            IWS.PersonSelection GetDrivers = new IWS.PersonSelection()
            {
                Persons = new IWS.Identifier[] { Driver },
            };

            IWS.GetPersonResult get_DriversResult = IWSService.Get_Drivers(iwsLogin(login), GetDrivers);

            long strTransicsID = 0;

            foreach (IWS.PersonResult driver in get_DriversResult.Persons)
            {
                strTransicsID = driver.PersonTransicsID;
            }

            return(strTransicsID.ToString());
        }
Пример #20
0
        public List <Document> GetDocsFromDates(Login login, ref DocParameters docParameters)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.DateTimeRangeSelection dtRange = new IWS.DateTimeRangeSelection();

            List <Document> documents = new List <Document>();

            dtRange.StartDate = docParameters.FromDate;
            dtRange.EndDate   = docParameters.ToDate;

            IWS.ScannedDocumentsSelection_V2 docsSel = new IWS.ScannedDocumentsSelection_V2()
            {
                SelectionDateRange = dtRange
            };

            IWS.ScannedDocumentSelection docSel = new IWS.ScannedDocumentSelection();

            IWS.GetScannedDocuments_V2 getScannedDocumentsResult = IWSService.Get_Scanned_Documents_V2(iwsLogin(login), docsSel);

            if (getScannedDocumentsResult.Documents != null)
            {
                foreach (IWS.Document_V3 doc in getScannedDocumentsResult.Documents)
                {
                    docSel.ScanID       = Convert.ToInt32(doc.ScanID.Value);
                    docSel.ConvertToPdf = true;
                    Int64 ModificationCounter = doc.ModificationID;
                    IWS.GetScannedDocument getScannedDocumentResult = IWSService.Get_Scanned_Document(iwsLogin(login), docSel);
                    int i = 0;
                    foreach (IWS.DocumentResult document in getScannedDocumentResult.Documents)
                    {
                        i++;
                        string placeid = "";
                        string doctype = "";
                        if (doc.Place != null)
                        {
                            placeid = doc.Place.PlaceID.ToString();
                        }
                        if (doc.TypeDoc != null)
                        {
                            doctype = doc.TypeDoc.ToString();
                        }


                        Document thisdoc = new Document();

                        thisdoc.ScanID     = doc.ScanID.ToString();
                        thisdoc.SequenceID = i.ToString();
                        thisdoc.VehicleID  = doc.Vehicle.ID.ToString();
                        if (doc.Driver != null)
                        {
                            thisdoc.DriverID = doc.Driver.ID.ToString();
                        }
                        thisdoc.PlaceID      = placeid;
                        thisdoc.Comment      = doc.Comment;
                        thisdoc.DocumentType = doctype;
                        thisdoc.ID           = doc.SerialNumber;
                        thisdoc.DocumentID   = ModificationCounter;
                        DateTime dt = new DateTime(0, DateTimeKind.Utc);
                        dt = Convert.ToDateTime(doc.CreationDate);
                        dt.ToLocalTime();
                        thisdoc.CreatedDateTime = dt.ToString();
                        MemoryStream stream = new MemoryStream(Convert.FromBase64String(document.Document1));
                        thisdoc.Doc = stream;
                        documents.Add(thisdoc);
                    }
                }
            }

            string strError = handleError(getScannedDocumentsResult);

            if (strError != null)
            {
                docParameters.ErrorMessage = strError;
            }
            return(documents);
        }
Пример #21
0
        public string InsertPlanningEnhanced(Login login, Trip trip, bool Update, bool debug)
        {
            if (debug)
            {
                return(trip.Dump());
            }

            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.TripInsert tripInsert = new IWS.TripInsert()
            {
                DriverDisplay = trip.DriverDisplay ?? "",
                TripId        = trip.TripId ?? "",
                Places        = trip.GetPlaces(),
                ExecutionDate = trip.ExecutionDate,
                StartTripAct  = new IWS.Activity()
                {
                    ID = trip.StartTripAct
                },
                StopTripAct = new IWS.Activity()
                {
                    ID = trip.EndTripAct
                },
            };

            if (trip.PopUp1 != "" || trip.PopUp2 != "")
            {
                tripInsert.PlanningConfig = new IWS.PlanningConfig()
                {
                    Items = trip.GetPlanningConfigItem()
                }
            }
            ;

            IWS.PlanningInsert PlanningData = new IWS.PlanningInsert()
            {
                Vehicle = new IWS.IdentifierVehicle()
                {
                    IdentifierVehicleType = IWS.enumIdentifierVehicleType.ID,
                    Id = trip.Vehicle
                },
                Trips = new IWS.TripInsert[] { tripInsert }
            };

            string strError = "";

            if (!login.IsTest)
            {
                if (Update)
                {
                    IWS.PlanningResultInsert PlanningResult = IWSService.Update_Planning(iwsLogin(login), PlanningData);
                    strError = handleError(PlanningResult);
                }
                else
                {
                    IWS.PlanningResultInsert PlanningInsertResult = IWSService.Insert_Planning(iwsLogin(login), PlanningData);
                    strError = handleError(PlanningInsertResult);
                }
            }

            if (string.IsNullOrEmpty(strError))
            {
                if (login.IsTest)
                {
                    return("Test Success. - " + trip.Dump());
                }
                else
                {
                    return("Success.");
                }
            }
            else
            {
                return(strError);
            }
        }
Пример #22
0
        public VehicleInfo[] GetVehicles(Login login)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.DateTimeSelection DtSelection = new IWS.DateTimeSelection()
            {
                DateTimeType = IWS.enumSelectionDateTimeType.GET_ALL,
                //                IWS.enumSelectionDate.GET_MODIFIED_SINCE_LAST_REQUEST,
                Value = null
            };

            IWS.VehicleSelection_With_NextStop_Info GetVehicles = new IWS.VehicleSelection_With_NextStop_Info()
            {
                //Identifiers = new IWS.IdentifierVehicle[] { Vehicle },
                SelectionFromToday  = DtSelection,
                Identifiers         = null,
                IncludePosition     = true,
                IncludeActivity     = true,
                IncludeETAInfo      = true,
                IncludeDrivers      = true,
                IncludeNextStopInfo = true,
                IncludeUpdateDates  = true
            };

            IWS.GetVehicleResult_With_NextStop_Info get_VehicleResult = IWSService.Get_Vehicles_V2(iwsLogin(login), GetVehicles);
            int i = 0;

            VehicleInfo[] vehInfoList = new VehicleInfo[get_VehicleResult.Vehicles.Count()];

            foreach (IWS.VehicleResult_With_NextStop_Info veh in get_VehicleResult.Vehicles)
            {
                VehicleInfo vehinfo = new VehicleInfo();
                vehinfo.VehicleID         = veh.VehicleID;
                vehinfo.VehicleTransicsID = veh.VehicleTransicsID;
                vehinfo.CurrentKms        = veh.CurrentKms;
                vehinfo.LastTrailerCode   = veh.LastTrailerCode;

                if (veh.Position != null)
                {
                    vehinfo.addressInfo             = veh.Position.AddressInfo;
                    vehinfo.distFromCapitol         = veh.Position.DistanceFromCapitol;
                    vehinfo.distFromLargeCity       = veh.Position.DistanceFromLargeCity;
                    vehinfo.distFromSmallcity       = veh.Position.DistanceFromSmallCity;
                    vehinfo.distFromPointOfInterest = veh.Position.DistanceFromPointOfInterest;
                    vehinfo.countryCode             = veh.Position.CountryCode;
                    vehinfo.Latitude  = veh.Position.Latitude;
                    vehinfo.Longitude = veh.Position.Longitude;
                }
                if (veh.NextStopInfo != null)
                {
                    if (veh.NextStopInfo.Place != null)
                    {
                        vehinfo.strPlace = veh.NextStopInfo.Place.PlaceID;
                    }

                    if (veh.NextStopInfo.Trip != null)
                    {
                        vehinfo.strTrip = veh.NextStopInfo.Trip.TripID;
                    }
                }

                try {
                    vehinfo.ETALat      = veh.ETAInfo.PositionDestination.Latitude.NullSafeToDouble();
                    vehinfo.ETALong     = veh.ETAInfo.PositionDestination.Longitude.NullSafeToDouble();
                    vehinfo.ETAStatus   = veh.ETAInfo.ETAStatus.NullSafeToString();
                    vehinfo.DistanceETA = veh.ETAInfo.DistanceETA;
                    vehinfo.ETA         = veh.ETAInfo.ETA;
                    vehinfo.PosInfoDest = veh.ETAInfo.PositionInfoDestination;
                }
                catch { }
                if (veh.UpdateDates != null)
                {
                    vehinfo.LastUpdate = veh.UpdateDates.Position;
                }

                if (veh.Driver != null)
                {
                    vehinfo.strDriverID = veh.Driver.ID;
                }

                if (veh.Activity != null)
                {
                    vehinfo.ActivityID = veh.Activity.ID.ToString();
                }

                if (veh.UpdateDates.GPRS != null)
                {
                    vehinfo.GPRSDate = veh.UpdateDates.GPRS;
                }

                vehInfoList[i] = vehinfo;
                i += 1;
            }
            return(vehInfoList);
        }