Exemplo n.º 1
0
        public void SearchVehicleArHandler()
        {


            try
            {


                // this.cntControlVehcileSerachRecord.Content = new ucVehicleProfileInspection();
                // this.UpdateLayout();
                //  busyIndicator.IsBusy = true;
                // MessageBox.Show("Searching Vehicle");
                _iValidate = (IValidation)new RecordViolationInputArValidation();
                _validationResult = _iValidate.Validate(this);
                if (_validationResult != "Valid")
                {
                    WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                    return;
                }
                else
                {

                    // string vehicleCatAr = ((IVehicleProfile)VehicleProfileManager.GetInstance()).GetAlternateCategory(cmboxVehicleCategoty.SelectedValue.ToString(), _resources.GetLocale()).Trim();   
                    //  IVehicleProfile iVehicleProfile = ((IVehicleProfile)VehicleProfileManager.GetInstance());


                    //  string vehicleCatAr = iVehicleProfile.GetAlternateCategory(cmboxVehicleCategoty.SelectedValue.ToString(), "en-US");


                    //    ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_mainWindow, "Searching Vehicle...", (bw, we) =>
                    //{
                    string vehicleCatAr = ((IVehicleProfile)VehicleProfileManager.GetInstance()).GetAlternateCategory((string)this.vehicleCatTable[cmboxVehicleCategoty.Text], "ar-AE");
                    //    vehicleCatAr = vehicleCatAr;
                    //});


                    if (cmboxCountry.SelectedValue.ToString().Trim() != AppProperties.defaultCountryAr)
                    {
                        //No UAE Vehicle
                        if (AppProperties.vehicle == null)
                        {
                            AppProperties.vehicle = new Vehicle();
                        }




                        AppProperties.vehicle.Country = (string)this.countryTable[cmboxCountry.Text];

                        if (null == (string)this.emirateTable[cmboxEmirates.Text])
                        {
                            AppProperties.vehicle.Emirate = "";
                        }
                        else
                        {
                            AppProperties.vehicle.Emirate = (string)this.emirateTable[cmboxEmirates.Text];
                        }
                        if (cmboxPlateCode.Visibility == System.Windows.Visibility.Collapsed)
                        {
                            AppProperties.vehicle.PlateCode = txtPlateCode.Text;
                        }
                        else
                        {
                            AppProperties.vehicle.PlateCode = (string)this.plateCodeTable[cmboxPlateCode.Text];
                        }
                        if (null == (string)this.plateCatTable[cmboxPlateCategory.Text])
                        {
                            AppProperties.vehicle.PlateCategory = "";
                        }
                        else
                        {
                            AppProperties.vehicle.PlateCategory = (string)this.plateCatTable[cmboxPlateCategory.Text];
                        }





                        AppProperties.vehicle.PlateNumber = this.txtBoxPlateNumber.Text;
                        AppProperties.vehicle.VehicleCategory = (string)this.vehicleCatTable[cmboxVehicleCategoty.Text];
                        AppProperties.vehicle.VehicleCategoryAr = vehicleCatAr;
                        vsd.hh.utilities.AppProperties.routeFromRecordViolation = false;
                        busyIndicator.IsBusy = false;
                        EnableDisableVehicleInputDetails(false);
                        this.cntControlVehcileSerachRecord.IsEnabled = true;
                        ucRecordViolationNonUAEVehicle ucNonUAEVeh = new ucRecordViolationNonUAEVehicle(this.m_mainWindow, this);
                        ucNonUAEVeh.PopulateVehicleSearchRecords();
                        ucNonUAEVeh.IsReadOnlyFileds(false);
                        this.cntControlVehcileSerachRecord.Content = ucNonUAEVeh;
                       // ucNonUAEVeh.txtBoxOperatorName.Focus();
                        this.UpdateLayout();
                        // this.cntControlVehcileSerachRecord.Content = new ucRecordViolationNonUAEVehicle(this.m_mainWindow);

                        //  this.cntControlVehcileSerachRecord.Content = this.m_mainWindow.m_PagesList[5];
                        // EnableDisableVehicleInputDetails(false);
                        //Non UAE Vehicle Violation Screen


                    }
                    else
                    {
                        //UAE Vehcile


                        IVehicleProfile iVehicleProfile = ((IVehicleProfile)VehicleProfileManager.GetInstance());
                        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();
                        // ProgressDialogResult result2 = ProgressDialog.ProgressDialog.Execute(this.m_mainWindow, lblSearchingVehicle.Content.ToString(), (bw, we) =>
                        //{
                        //  iVehicleProfile.GetVehicleProfileDetails(country, source, category, number, code);
                        // });
                        ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_mainWindow, lblSearchingVehicle.Content.ToString(), (bw, we) =>
                        {

                            iVehicleProfile.GetVehicleProfileDetails(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"), AppProperties.errorMessageFromBusiness);
                            AppProperties.businessError = false;
                            // busyIndicator.IsBusy = false;
                            //    LandingScreenEn landing = new LandingScreenEn();
                            //   _render.switchDisplay(form, landing);
                            //    this.m_mainWindow.MainContentControl.Content = this.m_mainWindow.m_PagesList[3];
                            return;
                        }
                        if (AppProperties.IsException)
                        {
                            AppProperties.IsException = false;
                            WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("ErrorException"));
                            ucNonUAEVehNew = new ucRecordViolationNonUAEVehicle(m_mainWindow, this);
                            //ucNonUAEVehNew.IsReadOnlyFileds(true);
                            this.cntControlVehcileSerachRecord.Content = ucNonUAEVehNew;
                           // ucNonUAEVehNew.txtBoxOperatorName.Focus();
                            this.UpdateLayout();
                            AppProperties.vehicle = null;
                            //  ClearFields();
                            return;
                        }

                        if (null == AppProperties.vehicle)
                        {
                            WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("VehicleNotFound"));
                            ucNonUAEVehNew = new ucRecordViolationNonUAEVehicle(m_mainWindow, this);
                            //ucNonUAEVehNew.IsReadOnlyFileds(true);
                            this.cntControlVehcileSerachRecord.Content = ucNonUAEVehNew;
                            //ucNonUAEVehNew.txtBoxOperatorName.Focus();
                            this.UpdateLayout();
                            // this.m_mainWindow.MainContentControl.Content = this.m_mainWindow.m_PagesList[3];
                            //  this.m_mainWindow.MainContentControl.Content = new ucLocationSelectionEn(m_mainWindow);
                            return;
                        }
                        AppProperties.vehicle.VehicleCategory = (string)this.vehicleCatTable[cmboxVehicleCategoty.Text];
                        AppProperties.vehicle.VehicleCategoryAr = vehicleCatAr;

                        if (AppProperties.vehicle.Emirate.Equals(AppProperties.defaultEmirate, StringComparison.CurrentCultureIgnoreCase) && AppProperties.isOnline)
                        {

                            vsd.hh.utilities.AppProperties.routeFromRecordViolation = true;
                            // MessageBox.Show("Vehicle Information Found!!!");
                            EnableDisableVehicleInputDetails(false);

                            //  VehicleProfileInspectionScreenEn RvDubai = new VehicleProfileInspectionScreenEn();
                            // _render.switchDisplay(form, RvDubai);

                            this.cntControlVehcileSerachRecord.IsEnabled = true;
                            ucVehicleProfileInspection ucUAEVehicleReuslt = new ucVehicleProfileInspection(this.m_mainWindow);
                            ucUAEVehicleReuslt.PopulateData();
                            this.cntControlVehcileSerachRecord.Content = ucUAEVehicleReuslt;
                          //  ucNonUAEVehNew.txtBoxOperatorName.Focus();
                            this.UpdateLayout();
                            busyIndicator.IsBusy = false;
                            //  this.cntControlVehcileSerachRecord.Content = this.m_mainWindow.m_PagesList[6];
                            return;

                        }
                        else
                        {
                            AppProperties.isOnline = true;
                            vsd.hh.utilities.AppProperties.routeFromRecordViolation = false; ;
                            //MessageBox.Show("Non Dubai");
                            // this.cntControlVehcileSerachRecord.Content
                            //EnableDisableVehicleInputDetails(false);
                            //EnableDisableVehcileResult(true);
                            //EnableUAEVehicleOptions(false);
                            EnableDisableVehicleInputDetails(false);

                            //  VehicleProfileInspectionScreenEn RvDubai = new VehicleProfileInspectionScreenEn();
                            // _render.switchDisplay(form, RvDubai);

                            this.cntControlVehcileSerachRecord.IsEnabled = true;
                            ucVehicleProfileInspection ucUAEVehicleReuslt = new ucVehicleProfileInspection(this.m_mainWindow);
                            ucUAEVehicleReuslt.PopulateData();
                            this.cntControlVehcileSerachRecord.Content = ucUAEVehicleReuslt;
                         //   ucNonUAEVehNew.txtBoxOperatorName.Focus();
                            this.UpdateLayout();
                            busyIndicator.IsBusy = false;
                            /*
                            // RecordViolationNonDubaiScreenEn RVNonDubai = new RecordViolationNonDubaiScreenEn();
                            // _render.switchDisplay(form, RVNonDubai);
                            EnableDisableVehicleInputDetails(false);
                            this.cntControlVehcileSerachRecord.IsEnabled = true;
                            //  this.cntControlVehcileSerachRecord.Content = this.m_mainWindow.m_PagesList[5];
                            ucRecordViolationNonUAEVehicle ucNonUAEVeh = new ucRecordViolationNonUAEVehicle(this.m_mainWindow,this);
                            ucNonUAEVeh.IsReadOnlyFileds(false);
                            ucNonUAEVeh.PopulateVehicleSearchRecords();
                            this.cntControlVehcileSerachRecord.Content = ucNonUAEVeh;
                            busyIndicator.IsBusy = false;
                            return;*/
                        }

                    }
                }
                busyIndicator.IsBusy = false;
            }

            catch (Exception ex)
            {
                CommonUtils.WriteLog(ex.StackTrace);
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }
        }
Exemplo n.º 2
0
        private void UserControl_Loaded_1(object sender, RoutedEventArgs e)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.DigitSubstitution = System.Globalization.DigitShapes.None;
            this.UpdateLayout();
            if (!m_IsDataLoaded)
            {
                PopulateData();
            }
            if (AppProperties.Selected_Resource == "English")
            {
                imagebtnSearch.Source = new BitmapImage(new Uri(@"/Images/Buttons/Large/Search.png", UriKind.Relative));


            }
            else
            {
                imagebtnSearch.Source = new BitmapImage(new Uri(@"/Images/Buttons/Large/Search Arabic Up Large.png", UriKind.Relative));

            }
            //  EnableDisableVehcileResult(false);
            EnableDisableVehicleInputDetails(true);
            //ucRecordViolationNonUAEVehicle
            ucNonUAEVehNew = new ucRecordViolationNonUAEVehicle(m_mainWindow, this);
            ucNonUAEVehNew.IsReadOnlyFileds(true);
            this.cntControlVehcileSerachRecord.Content = ucNonUAEVehNew;
            lblemirates.Content = lblemirates.Content.ToString().Replace("*", "");
            lblPlateCategory.Content = lblPlateCategory.Content.ToString().Replace("*", "");
            lblPlateCode.Content = lblPlateCode.Content.ToString().Replace("*", "");

            if (AppProperties.Selected_Resource == "Arabic")
            {
                m_mainWindow.txtlocation.Visibility = System.Windows.Visibility.Visible;

                m_mainWindow.txtlocation.Text = AppProperties.Current_Selected_LocationAr;
                //  AppProperties.location.location = (string)locationTable[(string)cmboxLocation.SelectedItem];
                // AppProperties.recordedViolation.InspectionArea = AppProperties.location;
            }
            else
            {
                // AppProperties.location.city = ((string)((ucLocationSelectionEn)this).cmboxEmirates.Text).Trim();
                //AppProperties.location.area = ((string)((ucLocationSelectionEn)this).cmboxArea.Text).Trim();
                m_mainWindow.txtlocation.Visibility = System.Windows.Visibility.Visible;

                m_mainWindow.txtlocation.Text = AppProperties.Current_Selected_LocationEn;
            }
            // this.cntControlVehcileSerachRecord.Content = this.m_mainWindow.m_PagesList[5];
            //this.cntControlVehcileSerachRecord.IsEnabled = false;
        }
Exemplo n.º 3
0
        private void cmboxCountry_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if ((string)cmboxCountry.SelectedItem != "")
                {
                    if (cmboxEmirates.Items.Count > 0)
                    {
                        cmboxEmirates.Text = "";
                        cmboxEmirates.Items.Clear();
                        cmboxEmirates.SelectedIndex = -1;
                    }
                    if (cmboxCountry.SelectedValue != null)
                    {
                        if (AppProperties.Selected_Resource == "Arabic")
                        {
                            // GetLocationDetails((string)countryTable[(string)selectCountry.SelectedItem], "emirate"));
                            if (cmboxCountry.SelectedValue == AppProperties.defaultCountryAr)
                            {
                                lblemirates.Content = "*" + lblemirates.Content.ToString();
                                lblPlateCategory.Content = "*" + lblPlateCategory.Content.ToString();
                                lblPlateCode.Content = "*" + lblPlateCode.Content.ToString();
                                txtPlateCode.Visibility = System.Windows.Visibility.Collapsed;
                                cmboxPlateCode.Visibility = System.Windows.Visibility.Visible;
                                emirateTable = CommonUtils.Splitter(((IViolation)ViolationManager.GetInstance()).GetLocation((string)countryTable[(string)cmboxCountry.SelectedItem], "emirate"));
                                string[] emirate = new string[emirateTable.Count];
                                emirateTable.Keys.CopyTo(emirate, 0);


                                _emirateList = new List<string>(emirate);
                                _emirateList.Sort();
                                foreach (string str in _emirateList)
                                {
                                    cmboxEmirates.Items.Add(str.Trim());
                                }
                                if (cmboxEmirates.Items.Count > 0)
                                    cmboxEmirates.SelectedItem = AppProperties.defaultEmirateAr;
                                cmboxEmirates.UpdateLayout();

                                if (ucNonUAEVehNew == null)
                                {
                                    ucNonUAEVehNew = new ucRecordViolationNonUAEVehicle(m_mainWindow, this);
                                }
                                ucNonUAEVehNew.IsReadOnlyFileds(true);
                                this.cntControlVehcileSerachRecord.Content = ucNonUAEVehNew;

                            }
                            else
                            {

                                lblemirates.Content = lblemirates.Content.ToString().Replace("*", "");
                                lblPlateCategory.Content = lblPlateCategory.Content.ToString().Replace("*", "");
                                lblPlateCode.Content = lblPlateCode.Content.ToString().Replace("*", "");
                                txtPlateCode.Visibility = System.Windows.Visibility.Visible;
                                cmboxPlateCode.Visibility = System.Windows.Visibility.Collapsed;
                                emirateTable = CommonUtils.Splitter(((IViolation)ViolationManager.GetInstance()).GetLocation((string)countryTable[(string)cmboxCountry.SelectedItem], "emirate"));
                                string[] emirate = new string[emirateTable.Count];
                                emirateTable.Keys.CopyTo(emirate, 0);


                                _emirateList = new List<string>(emirate);
                                _emirateList.Sort();
                                foreach (string str in _emirateList)
                                {
                                    cmboxEmirates.Items.Add(str.Trim());
                                }
                                if (cmboxEmirates.Items.Count > 0)
                                    cmboxEmirates.SelectedItem = AppProperties.defaultEmirateAr;
                                cmboxEmirates.UpdateLayout();
                                if (ucNonUAEVehNew == null)
                                {
                                    ucNonUAEVehNew = new ucRecordViolationNonUAEVehicle(m_mainWindow, this);
                                }
                                ucNonUAEVehNew.IsReadOnlyFileds(false);
                                this.cntControlVehcileSerachRecord.Content = ucNonUAEVehNew;

                            }

                        }
                        else
                        {
                            if (cmboxCountry.SelectedValue.ToString() == AppProperties.defaultCountry)
                            {
                                lblemirates.Content = lblemirates.Content.ToString() + "*";
                                lblPlateCategory.Content = lblPlateCategory.Content.ToString() + "*";
                                lblPlateCode.Content = lblPlateCode.Content.ToString() + "*";

                                txtPlateCode.Visibility = System.Windows.Visibility.Collapsed;
                                cmboxPlateCode.Visibility = System.Windows.Visibility.Visible;
                                if (ucNonUAEVehNew == null)
                                {
                                    ucNonUAEVehNew = new ucRecordViolationNonUAEVehicle(m_mainWindow, this);
                                }
                                ucNonUAEVehNew.IsReadOnlyFileds(true);
                                this.cntControlVehcileSerachRecord.Content = ucNonUAEVehNew;

                            }
                            else
                            {

                                lblemirates.Content = lblemirates.Content.ToString().Replace("*", "");
                                lblPlateCategory.Content = lblPlateCategory.Content.ToString().Replace("*", "");
                                lblPlateCode.Content = lblPlateCode.Content.ToString().Replace("*", "");
                                txtPlateCode.Visibility = System.Windows.Visibility.Visible;
                                cmboxPlateCode.Visibility = System.Windows.Visibility.Collapsed;
                                if (ucNonUAEVehNew == null)
                                {
                                    ucNonUAEVehNew = new ucRecordViolationNonUAEVehicle(m_mainWindow, this);
                                }
                                ucNonUAEVehNew.IsReadOnlyFileds(false);
                                this.cntControlVehcileSerachRecord.Content = ucNonUAEVehNew;
                            }

                            _emirateList = new List<string>(((IViolation)ViolationManager.GetInstance()).GetLocation(cmboxCountry.SelectedValue.ToString(), "emirate"));
                            _emirateList.Sort();
                            foreach (string str in _emirateList)
                            {
                                cmboxEmirates.Items.Add(str.Trim());
                            }
                            if (cmboxEmirates.Items.Count > 0)
                                cmboxEmirates.SelectedItem = AppProperties.defaultEmirate;
                            cmboxEmirates.UpdateLayout();
                        }
                    }


                }
                else
                {
                    cmboxCountry.Items.Clear();
                    cmboxCountry.Items.Add("");
                }
                ResetFiledsOnSlectionChanged();
            }
            catch (Exception ex)
            {
                CommonUtils.WriteLog(ex.StackTrace);
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }
        }
Exemplo n.º 4
0
        private void UserControl_SizeChanged_1(object sender, SizeChangedEventArgs e)
        {
            if (ucNonUAEVehNew == null)
            {
                ucNonUAEVehNew = new ucRecordViolationNonUAEVehicle(m_mainWindow, this);
            }
            // ucNonUAEVehNew.IsReadOnlyFileds(true);
            this.cntControlVehcileSerachRecord.Content = null;
            this.cntControlVehcileSerachRecord.Content = ucNonUAEVehNew;
            ChangeControlPosition();
            if (new CommonUtils().GetScreenOrientation() == AppProperties.LandScapetMode)
            {
                // MessageBox.Show("LandScape");
                // ChangeControlDimensions(350);
                ChangeControlDimensions(AppProperties.LndScp_130_280);
                ChangeButtonsDimensions(AppProperties.LndScp_Btn_130_280);
                //   ChangeLableDimensions(AppProperties.LndScp_Lbl_20_25);
                //   ChangeHeaderDimensions(AppProperties.LndScp_Header_25_30);
            }
            else
            {
                //  MessageBox.Show("Potrait");
                // ChangeControlDimensions(250);
                ChangeControlDimensions(280);
                ChangeButtonsDimensions(280);
                //  ChangeLableDimensions(AppProperties.Prtrt_Lbl_25_20);
                // ChangeHeaderDimensions(AppProperties.Prtrt_Header_30_25);
            }

        }
Exemplo n.º 5
0
        public void SetScreenAsDefault()
        {
            // cmboxCountry.SelectedValue = AppProperties.defaultCountry;
            //  cmboxEmirates.SelectedValue = AppProperties.defaultEmirate;

            txtBoxPlateNumber.Text = "";
            this.txtPlateCode.Text = "";
            this.cntControlVehcileSerachRecord.IsEnabled = false;
            ucRecordViolationNonUAEVehicle ucNonUAEVeh = new ucRecordViolationNonUAEVehicle(this.m_mainWindow, this);
            ucNonUAEVeh.PopulateVehicleSearchRecords();
            this.cntControlVehcileSerachRecord.Content = ucNonUAEVeh;

        }
Exemplo n.º 6
0
 public void ResetFiledsOnSlectionChanged()
 {
     this.txtBoxPlateNumber.Text = "";
     this.txtPlateCode.Text = "";
     ucRecordViolationNonUAEVehicle ucNonUAEVeh = new ucRecordViolationNonUAEVehicle(this.m_mainWindow, this);
     ucNonUAEVeh.PopulateVehicleSearchRecords();
     this.cntControlVehcileSerachRecord.Content = ucNonUAEVeh;
 }