예제 #1
0
        public void SearchVehicleArHandler()
        {
            try
            {
                _iValidate = (IValidation)new SearchVehicleInputArValidation();
                _validationResult = _iValidate.Validate(this);
                if (_validationResult != "Valid")
                {
                    WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                }
                else
                {
                    string country = (string)this.countryTable[cmboxCountry.Text];
                    string source = (string)this.emirateTable[cmboxEmirates.Text];
                    string category = (string)this.plateCatTable[cmboxPlateCategory.Text];
                    string code = (string)this.plateCodeTable[cmboxPlateCode.Text];
                    string number = txtBoxPlateNumber.Text.Trim();




                    ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetCountryProperties((source.Equals("") ? country : source));
                    IVehicleProfile iVehicleProfile = (IVehicleProfile)VehicleProfileManager.GetInstance();
                    //    ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_mainWindow, lblSearchingVehicle.Content.ToString(), (bw, we) =>
                    //   {
                    //Do Work
                    //       AppProperties.vehicle = iVehicleProfile.GetVehicleProfileDetails(country, source, category, number, code);
                    //   });

                    ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_mainWindow, lblSearchingVehicle.Content.ToString(), (bw, we) =>
                    {

                        ((IViolationHistory)ViolationHistoryManager.GetInstance()).GetViolationHistoryByPlateNumber(country, source, category, number, code);

                        // So this check in order to avoid default processing after the Cancel button has been pressed.
                        // This call will set the Cancelled flag on the result structure.
                        ProgressDialog.ProgressDialog.CheckForPendingCancellation(bw, we);

                    }, ProgressDialogSettings.WithSubLabelAndCancel);

                    if (result.Cancelled)
                        return;
                    else if (result.OperationFailed)
                        return;

                    if (AppProperties.businessError)
                    {
                        AppProperties.vehicle = null;
                        AppProperties.recordedViolation = null;
                        AppProperties.recordedViolation = new Violation();
                        AppProperties.recordedViolation.InspectionArea = AppProperties.location;
                        WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("ErrorBusiness"));
                        //  System.Windows.Forms.MessageBox.Show(AppProperties.errorMessageFromBusiness);
                        AppProperties.businessError = false;
                        // this.m_mainWindow.MainContentControl.Content = null;
                        // this.m_mainWindow.MainContentControl.Content = new ucLocationSelectionEn(m_mainWindow);
                        //  LandingScreenEn landing = new LandingScreenEn();
                        // _render.switchDisplay(form, landing);
                        return;
                    }
                    if (AppProperties.IsException)
                    {
                        AppProperties.IsException = false;
                        WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("ErrorException"));
                        AppProperties.vehicle = null;
                        AppProperties.recordedViolation = null;
                        AppProperties.recordedViolation = new Violation();
                        // ClearFields();
                        return;
                    }
                    if (AppProperties.NotFoundError)
                    {
                        AppProperties.NotFoundError = false;
                        WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("ErrorNotFound"));
                        AppProperties.vehicle = null;
                        AppProperties.recordedViolation = null;
                        AppProperties.recordedViolation = new Violation();
                        //  ClearFields();
                        return;
                    }

                    if (AppProperties.vehicle == null)
                    {
                        //System.Windows.Forms.MessageBox.Show("Vehicle not found");
                        // this.m_mainWindow.MainContentControl.Content = null;
                        // this.m_mainWindow.MainContentControl.Content = new ucLocationSelectionEn(m_mainWindow);
                        return;
                    }
                    else
                    {
                        ucSearchedVehicleDetials SearchedVehicleDetials = new ucSearchedVehicleDetials(this.m_mainWindow);
                        SearchedVehicleDetials.SetVehicleRatting(txtBoxPlateNumber.Text);
                        this.m_mainWindow.MainContentControl.Content = SearchedVehicleDetials;
                        // VehicleProfileInspectionScreenEn vehicleInspection = new VehicleProfileInspectionScreenEn();
                        //_render.switchDisplay(form, vehicleInspection);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
                CommonUtils.WriteLog(ex.StackTrace);
            }
        }
        private void btnBack_Click_1(object sender, RoutedEventArgs e)
        {
            btnBackImage.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/Back.png", UriKind.Relative));
            if (AppProperties.Selected_Resource == "English")
            {
                btnBackImage.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/Back.png", UriKind.Relative));
            }
            else
            {
                btnBackImage.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/back Arabic Up.png", UriKind.Relative));
            }
            if (_fromRecordViolationFlow == true)
            {
                this.m_mainWindow.MainContentControl.Content = null;
                this.m_mainWindow.MainContentControl.Content = new ucVehicleSelection(m_mainWindow);
            }
            else
            {
                if (AppProperties.isFlowFromOperator == true)
                {
                    this.m_mainWindow.MainContentControl.Content = null;
                    this.m_mainWindow.MainContentControl.Content = new ucSearchOperatorProfile(m_mainWindow);
                    AppProperties.isFlowFromOperator = false;
                }

                else
                {
                    this.m_mainWindow.MainContentControl.Content = null;
                    ucSearchedVehicleDetials SearchedVehicleDetials = new ucSearchedVehicleDetials(this.m_mainWindow);
                    SearchedVehicleDetials.SetVehicleRatting(AppProperties.vehicle.PlateNumber.ToString());
                    this.m_mainWindow.MainContentControl.Content = SearchedVehicleDetials;
                }

            }
        }