Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var vm = DataContext as SOPViewModel;
                if (vm == null)
                    return;
                if (!vm.IsAllStepsChecked())
                {
                    var msgBox = new MessageBoxUserControl(Properties.Resources.strEndSOP, true);
                    msgBox.Owner = Window.GetWindow(this);
                    msgBox.ShowDialog();

                    var res = msgBox.GetResult();

                    //MessageBoxResult messageBoxResult = MessageBox.Show("Not all steps are checked . Are you sure you want to finish the SOP?", "Finish Confirmation", MessageBoxButton.YesNo);
                    if (res == true)
                    {
                        FinishSOP(vm);
                    }
                }
                else
                {
                    FinishSOP(vm);
                }
            }
            catch (Exception ex)
            {
                Utility.WriteLog(ex);
                MessageBox.Show(Utility.GetErrorMessage());
                Utility.LogOut();
            }
        }
Ejemplo n.º 2
0
        private void btnLogout_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                VM.ChangeCheckedButton("Logout");

                var lang = Utility.GetLang();

                var cap = lang == "ar" ? "تأكيد الخروج" : "Confirm";
                var msg = lang == "ar" ? "سيتم غلق التطبيق، هل أنت متأكد" : "The application will be closed, are you sure";

                var msgBox = new MessageBoxUserControl(msg, true);
                msgBox.Owner = Window.GetWindow(this);
                msgBox.ShowDialog();

                var res = msgBox.GetResult();

                if (res == true)
                {
                    Utility.LogOut();
                }
            }
            catch (Exception ex)
            {
                Utility.WriteLog(ex);
                Utility.LogOut();
            }
        }
        private void SendNotificationResultToReporter(bool isApproveReport)
        {
            string msg    = isApproveReport ? Properties.Resources.strMsgApproveNotification : Properties.Resources.strMsgRejectNotification;
            var    msgBox = new MessageBoxUserControl(msg, true);

            msgBox.Owner = Window.GetWindow(this);
            msgBox.ShowDialog();

            var res = msgBox.GetResult();

            if (res == false)
            {
                return;
            }
            _NotifiedAlertViolatorDetailsUcVM.currentUserid = Utility.GetCurrentUserId(this);
            _NotifiedAlertViolatorDetailsUcVM.SendNotificationToReporter(isApproveReport);
        }
        private void SubmitExecute()
        {
            string closeMsg = Utility.GetLang() == "en" ? "Are you sure, want to close the send Report to UTS?" : "؟";

            MessageBoxControl.MessageBoxUserControl closeMsgBox = new MessageBoxUserControl(closeMsg, true);
            //closeMsgBox.Owner = Window.GetWindow(this);


            closeMsgBox.ShowDialog();

            var res = closeMsgBox.GetResult();

            if (res == true)
            {
                //AddBusinessRuleResult(true);
            }
        }
        private void btnAddRule_Click(object sender, RoutedEventArgs e)
        {
            string closeMsg = "Are you sure, want to Add this Business Rule?";

            MessageBoxControl.MessageBoxUserControl closeMsgBox = new MessageBoxUserControl(closeMsg, true);
            closeMsgBox.Owner = Window.GetWindow(this);


            closeMsgBox.ShowDialog();

            var res = closeMsgBox.GetResult();

            if (res == true)
            {
                //Window.GetWindow(this).Close();
            }
        }
Ejemplo n.º 6
0
        //void HandleMouseDown(object sender, MouseButtonEventArgs e)
        //{
        //    //AdminPageGridViewModel mainVM = this.DataContext as AdminPageGridViewModel;
        //    _vm.canUpdateSelectedRow = true;
        //    //mainVM.ShowUpdateBusinessRulePage = true;
        //    //UpdateAdminPageControlViewModel vm = new UpdateAdminPageControlViewModel(mainVM.BusinessRules[this.dgrAdmin.SelectedIndex]);
        //    //vm.RoleUpdated += ucUpdateRole.vm_RoleUpdated;
        //    _vm.UpdatePageVM.RoleUpdated += ucUpdateRole.vm_RoleUpdated;
        //    ucUpdateRole.DataContext = _vm.UpdatePageVM;
        //    //ucUpdateRole.DataContext = vm;
        //}

        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            string closeMsg = "Are you sure, want to close the Add Business Rule Screen?";

            MessageBoxControl.MessageBoxUserControl closeMsgBox = new MessageBoxUserControl(closeMsg, true);
            closeMsgBox.Owner = Window.GetWindow(this);


            closeMsgBox.ShowDialog();

            var res = closeMsgBox.GetResult();

            if (res == true)
            {
                //popupAddBusinessRule.IsOpen = false;
            }
        }
        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            string closeMsg = Utility.GetLang() == "en" ? "Are you sure, want to close the Add Business Rule Screen?" : "سيتم الغاء أي تعديلات, هل انت متأكد؟";

            MessageBoxControl.MessageBoxUserControl closeMsgBox = new MessageBoxUserControl(closeMsg, true);
            closeMsgBox.Owner = Window.GetWindow(this);


            closeMsgBox.ShowDialog();

            var res = closeMsgBox.GetResult();

            if (res == true)
            {
                //Window.GetWindow(this).Close();
            }
        }
Ejemplo n.º 8
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            string closeMsg = "Are you sure to update the Target Percentage?";

            MessageBoxControl.MessageBoxUserControl closeMsgBox = new MessageBoxUserControl(closeMsg, true);
            closeMsgBox.Owner = Window.GetWindow(this);


            closeMsgBox.ShowDialog();

            var res = closeMsgBox.GetResult();

            if (res == true)
            {
                _vm.UpdateKPIexecute();
                //Window.GetWindow(this).Close();
            }
        }
        private void Approve_OnClick(object Sender, RoutedEventArgs E)
        {
            try
            {
                var msgBox = new MessageBoxUserControl(Properties.Resources.strApprovalConfirmation, true);
                msgBox.Owner = Window.GetWindow(this);
                msgBox.ShowDialog();

                var res = msgBox.GetResult();

                if (res == false)
                {
                    return;
                }


                OnGoToNextStep(new GoToNextStepEventArgs
                {
                    Confirmation = true
                });

                //OnProcessNextAlert(new ProcessNextItemEventArgs() { CanProcessNextItem = true });


                ClosePopup();
                ClearControls();

                //    var msgBoxDone = new MessageBoxUserControl(Properties.Resources.strDispatchedPatrolConfirm, false);
                //    msgBoxDone.Owner = Window.GetWindow(this);
                //    msgBoxDone.ShowDialog();

                //    var resCon = msgBoxDone.GetResult();

                CanvasEventArgs canvasEventArgs = new CanvasEventArgs();

                OnCloseCanvas(canvasEventArgs);
            }
            catch (Exception ex)
            {
                Utility.WriteLog(ex);
                MessageBox.Show(Utility.GetErrorMessage());
                Utility.LogOut();
            }
        }
Ejemplo n.º 10
0
        private void GoBackExecute()
        {
            string closeMsg = Utility.GetLang() == "en" ? "Are you sure you want to cancel any modifications?" : "سيتم الغاء أي تعديلات, هل انت متأكد؟";

            MessageBoxControl.MessageBoxUserControl closeMsgBox = new MessageBoxUserControl(closeMsg, true);
            //closeMsgBox.Owner = Window.GetWindow(this);


            closeMsgBox.ShowDialog();

            var res = closeMsgBox.GetResult();

            if (res == true)
            {
                UpdateBusinessRuleResult(true);
                //this.Visibility = Visibility.Collapsed;
                //Window.GetWindow(this).Close();
            }
        }
        private void btnRejectReportedAlert_Click(object sender, RoutedEventArgs e)
        {
            var msgBox = new MessageBoxUserControl("Are you sure want to Reject?", true);

            msgBox.Owner = Window.GetWindow(this);
            msgBox.ShowDialog();

            var res = msgBox.GetResult();

            if (res == false)
            {
                return;
            }

            OnGoToNextStep(new GoToNextStepEventArgs
            {
                Confirmation = false
            });

            //OnProcessNextAlert(new ProcessNextItemEventArgs() { CanProcessNextItem = true});


            ClearControls();

            //    var msgBoxDone = new MessageBoxUserControl(Properties.Resources.strDispatchedPatrolConfirm, false);
            //    msgBoxDone.Owner = Window.GetWindow(this);
            //    msgBoxDone.ShowDialog();

            //    var resCon = msgBoxDone.GetResult();

            CanvasEventArgs canvasEventArgs = new CanvasEventArgs();

            ClosePopup();

            OnCloseCanvas(canvasEventArgs);

            //ClosePopup();
            //Storyboard OpenNotifiedAlertDetailsPopup = (Storyboard)TryFindResource("OpenNotifiedViolatorDetailsinRight");
            //OpenNotifiedAlertDetailsPopup.Begin();

            //Storyboard CloseNotifiedAlertDetailsPopup = (Storyboard)TryFindResource("CloseNotifiedViolatorDetailsinRight");
            //CloseNotifiedAlertDetailsPopup.Begin();
        }
Ejemplo n.º 12
0
        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            string closeMsg = Utility.GetLang() == "en" ? "Are you sure you want to cancel any modifications?" : "سيتم الغاء أي تعديلات, هل انت متأكد؟";


            //if (Utility.GetLang() == "ar")
            //    closeMsg = "هل أنت متأكد من الغاء التعديل";
            MessageBoxControl.MessageBoxUserControl closeMsgBox = new MessageBoxUserControl(closeMsg, true);
            closeMsgBox.Owner = Window.GetWindow(this);


            closeMsgBox.ShowDialog();

            var res = closeMsgBox.GetResult();

            if (res == true)
            {
                //Window.GetWindow(this).Close();
            }
        }
        private void SubmitExecute()
        {
            ResponseMsg = string.Empty;
            string closeMsg = Properties.Resources.strAlertOpRoomConfMsg;

            //string closeMsg = Utility.GetLang() == "en" ? "Are you sure, want to Alert the Operation Room?" : "؟";
            MessageBoxControl.MessageBoxUserControl closeMsgBox = new MessageBoxUserControl(closeMsg, true);
            //closeMsgBox.Owner = Window.GetWindow(this);


            closeMsgBox.ShowDialog();

            var res = closeMsgBox.GetResult();

            if (res == true)
            {
                SupervisorNotificationDTO req = new SupervisorNotificationDTO();
                req.SenderId   = currentUserId;
                req.ReceiverId = client.GetSupervisorId();

                DateTime dtNow = DateTime.Now;
                //req.NotificationTime = dtNow;
                req.NotificationTime = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, dtNow.Hour, dtNow.Minute, dtNow.Second, dtNow.Millisecond);
                req.IsNoticed        = false;
                if (DangerousVehicleDetailsDTOobj != null)
                {
                    req.DangerousViolatorDetails = new SupervisorNotificationReportDangerousDTO();
                    req.DangerousViolatorDetails.NotificationText = ReportMessage;
                    req.DangerousViolatorDetails.PlateNumber      = DangerousVehicleDetailsDTOobj.PlateNumber;
                    req.DangerousViolatorDetails.PlateKind        = DangerousVehicleDetailsDTOobj.PlateKind;
                    req.DangerousViolatorDetails.PlateColor       = DangerousVehicleDetailsDTOobj.PlateColor;
                    req.DangerousViolatorDetails.PlateAuthority   = DangerousVehicleDetailsDTOobj.PlateSource;
                }
                var saveRes = client.SaveSupervisorNotificationAsync(req);

                saveRes.ContinueWith(x => AlertOperationRoomResult(x.Result));
                //AddBusinessRuleResult(true);
            }
        }
Ejemplo n.º 14
0
        private void SubmitExecute()
        {
            ResponseMsg = string.Empty;

            string closeMsg = Utility.GetLang() == "en" ? "Are you sure, want to report Issue/Fine?" : "؟";

            MessageBoxControl.MessageBoxUserControl closeMsgBox = new MessageBoxUserControl(closeMsg, true);
            //closeMsgBox.Owner = Window.GetWindow(this);


            closeMsgBox.ShowDialog();

            var res = closeMsgBox.GetResult();

            if (res == true && VehicleDetailResponse != null)
            {
                NewTicketRequest req = new NewTicketRequest();

                req.VehicleColorCode  = Convert.ToInt32(VehicleDetailResponse.ColorCode);
                req.VehicleOwnerTcfNo = Convert.ToInt64(VehicleDetailResponse.OwnerTcfNo);
                req.VehicleTypeCode   = Convert.ToInt32(VehicleDetailResponse.TypeCode);
                req.VehicleModelCode  = Convert.ToInt32(VehicleDetailResponse.ModelCode);



                req.PlateInfo = VehicleDetailResponse.PlateInfo;
                if (SelectedViolationType != null)
                {
                    req.TicketType = SelectedViolationType.Id.ToString();
                }


                var createticketResponse = adpUTSclient.CreateNewTicketAsync(req);

                createticketResponse.ContinueWith(x => CreateNewTicketResult(x.Result));
            }
        }
Ejemplo n.º 15
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);
        }
Ejemplo n.º 16
0
        private void DispatchButton_OnClick(object Sender, RoutedEventArgs E)
        {
            try
            {
                var vm = DataContext as PatrolDetailsViewModel;
                if (vm == null)
                {
                    return;
                }

                //var msgBox = new MessageBoxUserControl("سوف يتم إرسال الدورية . هل أنت متأكد؟", true);
                var msgBox = new MessageBoxUserControl(Properties.Resources.strDispatchPatrolConfirmation, true);
                msgBox.Owner = Window.GetWindow(this);
                msgBox.ShowDialog();

                var res = msgBox.GetResult();

                if (res == false)
                {
                    return;
                }

                bool saved = false;
                switch (vm.SOPSource)
                {
                case SOPSources.Fog:
                    saved = AddDuty(vm);
                    break;

                case SOPSources.DetectedAccident:
                    saved = AddIncident(vm);
                    break;

                case SOPSources.WantedCar:
                    saved = AddDuty(vm);
                    break;
                }

                if (saved)
                {
                    vm.Patrol.IsAssigned = true;
                    OnGoToNextStep(new GoToNextStepEventArgs
                    {
                        Confirmation = true
                    });

                    ClearControls();

                    var msgBoxDone = new MessageBoxUserControl(Properties.Resources.strDispatchedPatrolConfirm, false);
                    msgBoxDone.Owner = Window.GetWindow(this);
                    msgBoxDone.ShowDialog();

                    var resCon = msgBoxDone.GetResult();

                    CanvasEventArgs canvasEventArgs = new CanvasEventArgs();

                    OnCloseCanvas(canvasEventArgs);
                }
            }
            catch (Exception ex)
            {
                Utility.WriteLog(ex);
                MessageBox.Show(Utility.GetErrorMessage());
                Utility.LogOut();
            }
        }
        private void SaveVMS_OnClick(object Sender, RoutedEventArgs E)
        {
            //ChangeTowerVMS

            try
            {
                var button = E.Source as Button;

                if (button == null)
                {
                    return;
                }

                var vm = DataContext as TowerDetailsViewModel;

                if (vm == null)
                {
                    return;
                }

                var curItem = vm.Tower;

                if (curItem == null)
                {
                    return;
                }

                // Iterate whole listbox tree and search for this items
                if (vm.SelectedAction == null)
                {
                    return;
                }

                var msgBox = new MessageBoxUserControl("سوف يتم تغيير الرسالة . هل أنت متأكد؟", true);
                msgBox.Owner = Window.GetWindow(this);
                msgBox.ShowDialog();

                var res = msgBox.GetResult();

                if (res == false)
                {
                    return;
                }

                curItem.SelectedAction = new TowerActionsDTO
                {
                    Description   = vm.SelectedAction.MessageDescription,
                    TowerActionId = vm.SelectedAction.MessageId
                };

                MessageQueue msgQ = new MessageQueue(".\\private$\\ChangeTowerVMS");

                Message msg = new Message
                {
                    Label = "Change VMS Message for " + curItem.ItemName,
                    Body  = curItem.SerializeObject(),
                    UseDeadLetterQueue = true
                };

                msgQ.Send(msg);

                bool msgUpdated = vm.UpdateTowerMessage();

                lblCurrentMsg.Text  = vm.SelectedAction.MessageDescription;
                lblCurrentMsg2.Text = vm.SelectedAction.MessageDescription;
            }
            catch (Exception ex)
            {
                Utility.WriteLog(ex);
            }
        }
Ejemplo n.º 18
0
        private void SaveSpeedLimit_OnClick(object Sender, RoutedEventArgs E)
        {
            //ChangeRadarSpeed

            try
            {
                var button = E.Source as Button;

                if (button == null)
                {
                    return;
                }

                var vm = DataContext as RadarDetailsViewModel;

                if (vm == null)
                {
                    return;
                }

                var curItem = vm.Radar as AssetsViewDTO;

                if (curItem == null)
                {
                    return;
                }

                var msgBox = new MessageBoxUserControl("سوف يتم تغيير السرعة . هل أنت متأكد؟", true);
                msgBox.Owner = Window.GetWindow(this);
                msgBox.ShowDialog();

                var res = msgBox.GetResult();

                if (res == false)
                {
                    return;
                }

                _client.UpdateAssetValueAsync(curItem.ItemId, vm.NewSpeedValue.ToString());

                curItem.SelectedSpeed = vm.NewSpeedValue;

                MessageQueue msgQ = new MessageQueue(".\\private$\\ChangeRadarSpeed");

                Message msg = new Message
                {
                    Label = "Change Radar Speed for " + curItem.ItemName,
                    Body  = curItem.SerializeObject(),
                    UseDeadLetterQueue = true
                };

                msgQ.Send(msg);
                vm.OldSpeedValue     = vm.NewSpeedValue.ToString();
                lblCurrentSpeed.Text = vm.NewSpeedValue.ToString();
                //lblCurrentSpeed2.Text = vm.NewSpeedValue.ToString();
                lblCurrentSpeed2.Text = Properties.Resources.strSpeedLimitSaved;
            }
            catch (Exception ex)
            {
                Utility.WriteLog(ex);
                MessageBox.Show(Utility.GetErrorMessage());
                Utility.LogOut();
            }
        }