Пример #1
0
        public void Go(FogEventToSOPMessage Message)
        {
            ScaleSOP();

            _sopActiveStepIndex = 0;
            var client = new ServiceLayerReference.ServiceLayerClient();
            bool isArabic = Utility.GetLang() == "ar";
            sopViewModel.EventDetailsList = new System.Collections.ObjectModel.ObservableCollection<EventDetailModel>() {
                new EventDetailModel
                {
                    Name = isArabic ? "التاريخ والوقت:" : "Date & Time:",
                    Value = Message.CreatedDate.ToString("dd/MM/yyyy HH:mm")
                }, new EventDetailModel
                {
                    Name = isArabic ? "سبب إنعدام الرؤية:" : "Low Visability Reason:",
                    Value = isArabic ? "ضباب":"Fog"
                }, new EventDetailModel
                {
                    Name = isArabic ? "المكان:" :  "Location:",
                    Value = client.GetAssetLocation((int)Message.TowerId,isArabic)
                } };

            sopViewModel.GetSOP(new SOPGeneralMessage
            {
                MessageId = Message.MessageId,
                GeneralType = SOPSources.Fog,
                OriginalObject = Message,
                NotificationId = Message.NotificationId
            });
        }
Пример #2
0
        public void Go(TruckViolationToSOPMessage message)
        {
            ScaleSOP();
            _sopActiveStepIndex = 0;
            var client = new ServiceLayerReference.ServiceLayerClient();
            bool isArabic = Utility.GetLang() == "ar";
            sopViewModel.EventDetailsList = new System.Collections.ObjectModel.ObservableCollection<EventDetailModel>() {
                new EventDetailModel
                {
                    Name = isArabic ? "التاريخ والوقت" :  "Date & Time",
                    Value = message.CreatedDate.ToString("dd/MM/yyyy HH:mm")
                }, new EventDetailModel
                {
                    Name = isArabic ? "نوع المركبة" :  "Vehicle Type",
                    Value = isArabic ? "شاحنة" : "Truck"
                }, new EventDetailModel
                {
                    Name = Properties.Resources.strPlateNum,
                    Value = message.TruckPlateNumber
                }, new EventDetailModel
                {
                    Name = isArabic ? "المكان" :  "Location",
                    Value = client.GetAssetLocation((int)message.TowerId,isArabic)
                } , new EventDetailModel {
                    Name = isArabic ? "رقم الرادار" :  "Radar Code",
                    Value = client.GetAssetSerialNumber(message.TowerId)
                } };

            var assignedPatrols = sopViewModel.GetAssignedPatrols(message.NotificationId);
            if (assignedPatrols != null && assignedPatrols.Any())
            {
                foreach (var assignedPatrol in assignedPatrols)
                {
                    sopViewModel.EventDetailsList.Add(new EventDetailModel()
                    {
                        Name = isArabic ? "رقم الدورية المدرجة" : "Assigned patrol code",
                        Value = assignedPatrol.PatrolCode
                    });
                }
            }
            sopViewModel.GetSOP(new SOPGeneralMessage
            {
                MessageId = message.MessageId,
                GeneralType = SOPSources.TruckViolation,
                OriginalObject = new WantedCarToSOPMessage
                {
                    CreatedDate = message.CreatedDate,
                    Discription = message.Discription,
                    Latitude = message.Latitude,
                    Longitude = message.Longitude,
                    MessageId = message.MessageId,
                    NotificationId = message.NotificationId,
                    TowerId = message.TowerId,
                    VehiclePlateNumber = message.TruckPlateNumber
                },
                NotificationId = message.NotificationId
            });
        }
Пример #3
0
        public IssueFineViewModel()
        {
            client       = new ServiceLayerReference.ServiceLayerClient();
            adpUTSclient = new ADPUTSServiceClient();


            LoadData();
            GetVehicleViolationTypes();
        }
Пример #4
0
        public void Go(WantedCarToSOPMessage Message)
        {
            ScaleSOP();

            ScaleGridBasicInfo();

            _sopActiveStepIndex = 0;
            var client = new ServiceLayerReference.ServiceLayerClient();
            bool isArabic = Utility.GetLang() == "ar";
            long messageId = 0;
            string type = isArabic ? Message.Discription : Message.EnglishDiscription;
            if (long.TryParse(Message.MessageId, out messageId))
            {
                var ruleDTO = client.GetMessageBusinessRule(messageId);
                if (ruleDTO != null)
                {
                    type = ruleDTO.BusinessName;
                }
            }
            sopViewModel.EventDetailsList = new System.Collections.ObjectModel.ObservableCollection<EventDetailModel>() {
                new EventDetailModel
                {
                    Name = isArabic ? "نوع المخالفة" :  "Violation Type",
                    Value = type
                }, new EventDetailModel
                {
                    Name =  isArabic ? "التاريخ والوقت" :  "Date & Time",
                    Value = Message.CreatedDate.ToString("dd/MM/yyyy HH:mm")
                }, new EventDetailModel
                {
                    Name = isArabic ? "نوع المركبة" :  "Vehicle Type",
                    Value = isArabic ? "سيارة":"Car"
                }, new EventDetailModel
                {
                    Name = Properties.Resources.strPlateNum,
                    Value = Message.VehiclePlateNumber
                }, new EventDetailModel
                {
                    Name = isArabic ? "المكان" :  "Location",
                    Value = client.GetAssetLocation((int)Message.TowerId,isArabic)
                } , new EventDetailModel {
                    Name = isArabic ? "رقم الرادار" :  "Radar Code",
                    Value = client.GetAssetSerialNumber(Message.TowerId)
                } };

            var assignedPatrols = sopViewModel.GetAssignedPatrols(Message.NotificationId);
            if (assignedPatrols != null && assignedPatrols.Any())
            {
                foreach (var assignedPatrol in assignedPatrols)
                {
                    sopViewModel.EventDetailsList.Add(new EventDetailModel()
                    {
                        Name = isArabic ? "رقم الدورية المدرجة" : "Assigned patrol code",
                        Value = assignedPatrol.PatrolCode
                    });
                }
            }
            sopViewModel.GetSOP(new SOPGeneralMessage
            {
                MessageId = Message.MessageId,
                GeneralType = SOPSources.WantedCar,
                OriginalObject = Message,
                NotificationId = Message.NotificationId
            });
        }
        private async void PublishEvent()
        {
            bool tweetSent  = true;
            var  isTwitter  = false;
            var  msg        = "";
            var  filePath   = "";
            var  isFacebook = false;

            ServiceLayerReference.ServiceLayerClient client = new ServiceLayerReference.ServiceLayerClient();
            //Application.Current.Dispatcher.Invoke(() => isFacebook = FacebookCheckBox.IsChecked.HasValue && FacebookCheckBox.IsChecked.Value);

            //Application.Current.Dispatcher.Invoke(() => msg = MessageText.Text);
            //Application.Current.Dispatcher.Invoke(() => filePath = TxtBrowseFile.Text);

            //Application.Current.Dispatcher.Invoke(() => isTwitter = TwitterCheckBox.IsChecked.HasValue && TwitterCheckBox.IsChecked.Value);



            MemoryStream ms = null;

            try
            {
                System.Drawing.Image img = System.Drawing.Image.FromFile(_socialMediaUserControlViewModel.FilePath);

                ms = new MemoryStream();

                img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            }
            catch (Exception)
            {
                //ms = null;
            }

            bool facebookSent = true;

            try
            {
                //if (isTwitter)
                if (_socialMediaUserControlViewModel.IsTwitterChecked)
                {
                    var resTwitter = client.PublishToTwitterAsync(_socialMediaUserControlViewModel.MsgToPost, ms == null ? null : ms.ToArray());
                    tweetSent = await resTwitter;
                }


                //if (isFacebook)
                if (_socialMediaUserControlViewModel.IsFaceBookChecked)
                {
                    var resFaceBook = client.PublishToFacebookAsync(_socialMediaUserControlViewModel.MsgToPost, ms == null ? null : ms.ToArray());
                    facebookSent = await resFaceBook;
                    //facebookSent = PublishToFacebook(msg, filePath);
                }
            }
            catch (Exception ex)
            {
            }



            if (tweetSent && facebookSent)
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    LayoutRoot.Visibility       = Visibility.Hidden;
                    ConfirmationGrid.Visibility = Visibility.Visible;
                });

                Task.Delay(1000);
                Application.Current.Dispatcher.Invoke(() =>
                {
                    OnGoToNextStep(new GoToNextStepEventArgs
                    {
                        Confirmation = true
                    });
                    ClosePopup(true);
                });
            }
        }