Example #1
0
        public PatrolDetailsUserControl(ServiceLayerReference.PatrolLastLocationDTO Patrol, SOPSources SOPSource, double Latitude, double Longitude, long NotificationId)
        {
            Properties.Resources.Culture = new CultureInfo(Utility.GetLang());

            InitializeComponent();

            EsriMapView.FlowDirection = FlowDirection.LeftToRight;

            PatrolDetailsViewModel vm = new PatrolDetailsViewModel
            {
                Patrol         = Patrol,
                SOPSource      = SOPSource,
                EventLatitude  = Latitude,
                EventLongitude = Longitude,
                NotificationId = NotificationId
            };

            DataContext = vm;

            ZoomOnMap(Latitude, Longitude, 1);
            AddGrphicLayer();

            if (Patrol.Latitude != null && Patrol.Longitude != null)
            {
                vm.AddLayerContent("patrol", Patrol.Latitude.Value, Patrol.Longitude.Value);
            }

            vm.AddLayerContent("event", Latitude, Longitude);

            ZoomToExtent();
        }
Example #2
0
        private bool AddIncident(PatrolDetailsViewModel ViewModel)
        {
            var serviceClient = new TFMIntegrationServiceClient();

            var result = serviceClient.AddIncidentAsync(ViewModel.Patrol.PatrolOriginalId, DateTime.Now, ViewModel.EventLatitude, ViewModel.EventLongitude, CommentText.Text);

            return(result.Result);
        }
Example #3
0
        private bool AddDuty(PatrolDetailsViewModel ViewModel)
        {
            var serviceClient = new TFMIntegrationServiceClient();

            if (!serviceClient.ValidateBeforeAssignPatrol(ViewModel.NotificationId, ViewModel.Patrol.PatrolId))
            {
                //TODO: Show Message to tell the user that the patrol is already assigned.
                var msgBox = new MessageBoxUserControl(Properties.Resources.strPatrolAssignment, false);
                msgBox.Owner = Window.GetWindow(this);
                msgBox.ShowDialog();
                return(false);//Or true (Based on the scenario).
            }

            var result = serviceClient.AddDutyAsync(ViewModel.Patrol.PatrolOriginalId, CommentText.Text, DateTime.Now, ViewModel.EventLatitude, ViewModel.EventLongitude, ViewModel.NotificationId, (int)ViewModel.Patrol.PatrolId);

            if (result.Result > 0)
            {
                serviceClient.UpdatePatrolCurrentTask(ViewModel.Patrol.PatrolOriginalId, result.Result);

                return(true);
            }

            return(false);
        }