/// <summary>
		///   Create a new attribute which hooks a validation handler to a dependency property.
		/// </summary>
		/// <param name = "dynamicType">
		///   The type of the validation handler.
		///   Should extend from <see cref = "AbstractValidation{T}" />.</param>
		/// <param name = "constructorArguments">The arguments to pass to the constructor of the validation handler.</param>
		public ValidationHandlerAttribute( Type dynamicType, params object[] constructorArguments )
			: base( dynamicType, constructorArguments )
		{
			Contract.Requires( dynamicType.IsOfGenericType( typeof( IValidation<> ) ) );

			GenericValidation = Proxy.CreateGenericInterfaceWrapper<IValidation<object>>( DynamicInstance );
		}
Exemplo n.º 2
0
 public CrossCuttingConcernsFacade()
 {
     Logging    = new Logging();
     Caching    = new Caching();
     Authorize  = new Authorize();
     Validation = new Validation();
 }
Exemplo n.º 3
0
 public AbstractAPIController(IAbstractRepository repo, IValidation validation)
 {
     paramDictionnary = new ParameterOverride("validationDictionnary", this.ModelState);
     paramRepo        = new ParameterOverride("repo", repo);
     paramValidation  = new ParameterOverride("validation", validation);
     Repo             = repo;
 }
Exemplo n.º 4
0
 public Registration(string filePath, IReadWriteFile readWriteFile, IValidation validation)
 {
     RegistrationAccount = new RegistrationAccount();
     _readWriteFile      = readWriteFile;
     _validation         = validation;
     FilePath            = filePath;
 }
Exemplo n.º 5
0
        /// <summary>
        ///   Create a new attribute which hooks a validation handler to a dependency property.
        /// </summary>
        /// <param name = "dynamicType">
        ///   The type of the validation handler.
        ///   Should extend from <see cref = "AbstractValidation{T}" />.</param>
        /// <param name = "constructorArguments">The arguments to pass to the constructor of the validation handler.</param>
        public ValidationHandlerAttribute(Type dynamicType, params object[] constructorArguments)
            : base(dynamicType, constructorArguments)
        {
            Contract.Requires(dynamicType.IsOfGenericType(typeof(IValidation <>)));

            GenericValidation = Proxy.CreateGenericInterfaceWrapper <IValidation <object> >(DynamicInstance);
        }
Exemplo n.º 6
0
        private void VerificaUtilizador()
        {
            IList <String> setofdata = new List <string>();

            setofdata.Add(txtnome.Text);
            setofdata.Add(txtapelido.Text);
            setofdata.Add(txtemail.Text);
            setofdata.Add(dtpdatadenascimento.Value.ToString());
            setofdata.Add(txtusername.Text);
            setofdata.Add(txtpassword.Text);
            setofdata.Add(txtpasswordr.Text);

            //Valida os Campos
            IValidation validarRegisto = RegistoValidation.Singleton();

            if (validarRegisto.Validar(setofdata))
            {
                MessageBox.Show("Inserção com sucesso: \n" +
                                "Username: "******"\n" +
                                "Password: "******"\n" +
                                "Pode fazer o Login!");
                InserirConta();

                var formLogin = new Welcome();
                this.Hide();
                formLogin.Show();
            }
        }
Exemplo n.º 7
0
 protected CrudServiceBase(IRepository <TEntity, TPrimaryKeyType> repository,
                           IDomainNotificationHandler domainNotification, IValidation <TNewCommand> newValidation, IValidation <TUpdateCommand> updateValidation,
                           IUnitOfWork uow, TRemoveCommandValidation removeValidation)
     : base(repository, domainNotification, newValidation, updateValidation, uow)
 {
     _removeValidation = removeValidation;
 }
Exemplo n.º 8
0
 public ValidationMap(Expression <Func <T, object> > expression, IValidation validation)
 {
     _expression      = expression;
     PropertyDelegate = _expression.Compile();
     Validation       = validation;
     PropertyName     = GetPropertyName(_expression);
 }
Exemplo n.º 9
0
        /// <inheritdoc/>
        public async Task ValidateAsync(IValidation validation, object newValidationValue, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();

            validation.NotifyValidationStarted();

            var validatorEventArgs = new ValidatorEventArgs(newValidationValue);

            cancellationToken.ThrowIfCancellationRequested();

            if (validation.AsyncValidator != null)
            {
                await validation.AsyncValidator(validatorEventArgs, cancellationToken);
            }
            else
            {
                validation.Validator?.Invoke(validatorEventArgs);
            }

            var matchMessages = validatorEventArgs.Status == ValidationStatus.Error && !string.IsNullOrEmpty(validatorEventArgs.ErrorText)
                ? new string[] { validatorEventArgs.ErrorText }
                : null;

            cancellationToken.ThrowIfCancellationRequested();

            validation.NotifyValidationStatusChanged(validatorEventArgs.Status, matchMessages);
        }
Exemplo n.º 10
0
        internal void NotifyValidationStatusChanged(IValidation validation)
        {
            // Here we need to call ValidatedAll only when in Auto mode. Manuall call is already called through ValidateAll()
            if (Mode == ValidationMode.Manual)
            {
                return;
            }

            // NOTE: there is risk of calling RaiseStatusChanged multiple times for every field error.
            // Try to come up with solution that StatusChanged will be called only once while it will
            // still provide all of the failed messages.

            if (AllValidationsSuccessful)
            {
                RaiseStatusChanged(ValidationStatus.Success, null);

                ValidatedAll.InvokeAsync(null);
            }
            else if (HasFailedValidations)
            {
                RaiseStatusChanged(ValidationStatus.Error, FailedValidations);
            }
            else
            {
                RaiseStatusChanged(ValidationStatus.None, null);
            }
        }
 public AbstractAPIController(IAbstractRepository repo, IValidation validation)
 {
     paramDictionnary = new ParameterOverride("validationDictionnary", this.ModelState);
     paramRepo = new ParameterOverride("repo", repo);
     paramValidation = new ParameterOverride("validation", validation);
     Repo = repo;
 }
 public OrderManagementClient(IConfiguration configuration, IValidation validation)
 {
     _configuration          = configuration;
     _validation             = validation;
     _restClient             = new HttpClient();
     _restClient.BaseAddress = new Uri(configuration.GetBaseUrl());
 }
Exemplo n.º 13
0
 public ProductController(IProductMenager productMenager, IValidation validation, ICurrentDate currentDate, IGuidGenerator guidGenerator)
 {
     _productMenager = productMenager;
     _validation     = validation;
     _currentDate    = currentDate;
     _guidGenerator  = guidGenerator;
 }
Exemplo n.º 14
0
        public override void Execute(GrapeCity.Documents.Excel.Workbook workbook)
        {
            IWorksheet worksheet = workbook.Worksheets[0];

            worksheet.Range["A1"].Value = "aaa";
            worksheet.Range["A2"].Value = "bbb";
            worksheet.Range["A3"].Value = "ccc";

            worksheet.Range["C2:E4"].Value = new object[, ]
            {
                { "aaa", "bbb", "ccc" },
                { "aaa1", "bbb1", "ccc1" },
                { "aaa2", "bbb2", "ccc2" }
            };

            //create list validation.
            worksheet.Range["C2:E4"].Validation.Add(ValidationType.List, ValidationAlertStyle.Stop, ValidationOperator.Between, "=$a$1:$a$3");
            IValidation validation = worksheet.Range["C2:E4"].Validation;

            validation.InCellDropdown = true;

            //judge if Range["C2:E4"] has validation.
            for (int i = 1; i <= 3; i++)
            {
                for (int j = 2; j <= 4; j++)
                {
                    if (worksheet.Range[i, j].HasValidation)
                    {
                        //set the range[i, j]'s interior color.
                        worksheet.Range[i, j].Interior.Color = Color.LightBlue;
                    }
                }
            }
        }
Exemplo n.º 15
0
 public bool Equals(IValidation <T> other)
 {
     return
         (other != null &&
          !other.IsValid &&
          _errorMessage.Equals(other.ErrorMessage));
 }
Exemplo n.º 16
0
 internal void NotifyValidationInitialized(IValidation validation)
 {
     if (!validations.Contains(validation))
     {
         validations.Add(validation);
     }
 }
Exemplo n.º 17
0
        /// <summary>
        /// Initializes an instance of the proxy.
        /// </summary>
        /// <param name="jsonManagerAddress">address of json manager service to use</param>
        public JobProxy(IAppConfig config, IJsonManagerClient jsonManagerClient, IValidation validation)
        {
            _address = new Uri(config.JsonManagerUri);

            _jsonManagerClient = jsonManagerClient;
            _validation        = validation;
        }
Exemplo n.º 18
0
 internal void NotifyValidationRemoved(IValidation validation)
 {
     if (validations.Contains(validation))
     {
         validations.Remove(validation);
     }
 }
Exemplo n.º 19
0
            public static CastedValidation FromValidation <T>(IValidation <T> validation)
            {
                return(new CastedValidation(IsValid));

                bool IsValid(object value, out string?errorMessage) =>
                validation.IsValid((T)value, out errorMessage);
            }
 public OutputInvoiceValidation()
 {
     this.lineValidation    = new OutputInvoiceLineValidation();
     this.accountCodeFormat = new Regex(@"^[1-9]{1}[0-9]*$");
     this.nifFormat         = new Regex(@"^[A-Z0-9]*$");
     this.postalCodeFormat  = new Regex(@"^[0-9]{5}$");
 }
Exemplo n.º 21
0
 public UsersController(IUserService userService, IUserRepository userRepository, IValidation <User> userValidation, EFContext efContext)
 {
     service    = userService;
     repository = userRepository;
     validation = userValidation;
     context    = efContext;
 }
Exemplo n.º 22
0
 public CustomerBase(IValidation <ICustomer> obj,
                     IDiscount dis, IExtraCharge extra)
 {
     validation  = obj;
     discount    = dis;
     extracharge = extra;
 }
Exemplo n.º 23
0
        public IEnumerable <PaySlip> Calculate(IEnumerable <Employee> employees, IValidation validation)
        {
            List <PaySlip> payslip = new List <PaySlip>();

            CheckValidation(employees.ToList(), validation);
            if (validation.IsValid)
            {
                foreach (Employee Emp in employees)
                {
                    PaySlip employeePayslip = new PaySlip();
                    var     Name            = Emp.FirstName + " " + Emp.LastName;
                    var     AnnualSalary    = Emp.AnnualSalary;
                    var     taxrate         = _taxRates.Single(s => s.IsWithinIncomeRange(AnnualSalary));
                    var     superRate       = Emp.SuperRate;
                    var     incomeTax       = taxrate.CalculateTax(AnnualSalary);
                    var     grossSalary     = PaymentAmountsRounded(AnnualSalary);
                    var     totalSalary     = (grossSalary - incomeTax).RoundToNearestDollarAmount();
                    var     totalSuper      = CalculateSuper(grossSalary, superRate);
                    //var payPeriod = CalculatePaymentPeriods(Emp);

                    var payPeriod = Emp.PaymentStartDate.StartDate.ToString("MMMM dd") + " - " + Emp.PaymentStartDate.EndDate.ToString("MMMM dd");

                    employeePayslip.Name        = Name;
                    employeePayslip.PayPeriod   = payPeriod.ToString();
                    employeePayslip.GrossIncome = grossSalary;
                    employeePayslip.IncomeTax   = incomeTax;
                    employeePayslip.NetIncome   = totalSalary;
                    employeePayslip.Super       = totalSuper;
                    payslip.Add(employeePayslip);
                }
            }

            return(payslip);
        }
Exemplo n.º 24
0
        public virtual bool Validate <ValidationAdapterClass>(IOperationAction <T, U, V> operationAction)
        {
            IValidation <T> model = operationAction.OperationRequest().OpData().Valid() as IValidation <T>;

            var validationAdapter = CreateAdapterInstance <ValidationAdapterClass>(model) as IValidation <T>;

            return(validationAdapter.Valid());
        }
Exemplo n.º 25
0
 public Product(int id, string productName, int price, bool active, IValidation validation)
 {
     Validation = validation;
     Id         = id;
     Name       = productName;
     Price      = price;
     Active     = active;
 }
Exemplo n.º 26
0
 public ValidationResult Validate(IValidation <ChatMessage> validation)
 {
     return(new ValidationResult
     {
         Errors = validation.Errors(this),
         IsValid = validation.IsValid(this)
     });
 }
Exemplo n.º 27
0
        public BookCreationVM(IBookManager _bookManager, IValidation _validation)
        {
            bookManager = _bookManager;
            validation  = _validation;

            NewBook           = new Book();
            CreateBookCommand = new AddBookCommand(this);
        }
Exemplo n.º 28
0
        public override IValidation CreateValidation(IValidation validation)
        {
            ValidationEntity validationEntity = _ctx.Validations.Add((ValidationEntity)validation);

            _ctx.SaveChanges();

            return(validationEntity);
        }
        /// <summary>
        /// konstruktor klasy SlupPrzelotowyViewModel
        /// </summary>
        ///<values>
        /// ładuje dane z bazy do kolekcji SKlimat za pomocą funkcji ZalSKlimat()
        ///</values>
        public SlupPrzelotowyViewModel(IValidation valid, IDataAccess data)
        {
            _valid = valid;
            _data  = data;


            SKlimat = new BindableCollection <StrefaKlimatyczna>(ZalSKlimat());
        }
Exemplo n.º 30
0
 public LocalSaver(IValidation validation, IHostingEnvironment env, IHttpContextAccessor httpContextAccessor)
 {
     _configuration       = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").Build();
     localpath            = _configuration.GetSection("LocalStorage:Url").Value;
     _validation          = validation;
     _env                 = env;
     _httpContextAccessor = httpContextAccessor;
 }
Exemplo n.º 31
0
 public virtual void AddErrorFrom(int index, IValidation validation)
 {
     if (validation.HasErrors())
     {
         foreach (Error error in validation.Errors)
             errorList.Add(new ListItemError(error.Key, error.Message, index));
     }
 }
Exemplo n.º 32
0
 public VolunteerManager(IVolunteerRepository volunteerRepository, IInviteRepository inviteRepository, IOrganisationCallbackRepository organisationCallbackRepository, IEmailFunctions emailFunctions, IValidation validation)
 {
     _volunteerRepository            = volunteerRepository;
     _inviteRepository               = inviteRepository;
     _organisationCallbackRepository = organisationCallbackRepository;
     _emailFunctions = emailFunctions;
     _validation     = validation;
 }
Exemplo n.º 33
0
 public CustomerDetailViewModel(ICustomerRepository customerRepository, IValidation <ICustomer> customerValidation,
                                IMessagerLogger messagerLogger)
 {
     InitialViewModel();
     CustomerRepository = customerRepository;
     CustomerValidation = customerValidation;
     MessagerLogger     = messagerLogger;
 }
 public Storage(IMainForm mainForm, IValidation valid)
 {
 	
 	this.IMainForm = mainForm;
 	
 	this.Validation = valid;
 	
 }
        private void btnAdd_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {


                // imagebuttonetest2.Source = new BitmapImage(new Uri(@"/Images/Buttons/Large/Login.png", UriKind.Relative));
                if (AppProperties.Selected_Resource == "Arabic")
                {
                    btnAddImage.Source = new BitmapImage(new Uri(@"/Images/Buttons/Large/Add Arabic Up.png", UriKind.Relative));
                    _iValidate = (IValidation)new RecordViolationDefectsInputValidationAr();
                    _validationResult = _iValidate.Validate(this);

                    if (_validationResult != "Valid")
                    {
                        WPFMessageBoxResult _Result = WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                        return;
                    }
                    BtnArEnHandler();
                }
                else
                {
                    btnAddImage.Source = new BitmapImage(new Uri(@"/Images/Buttons/Large/Add.png", UriKind.Relative));
                    _iValidate = (IValidation)new RecordViolationDefectsInputValidation();
                    _validationResult = _iValidate.Validate(this);

                    if (_validationResult != "Valid")
                    {
                        WPFMessageBoxResult _Result = WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                        return;
                    }
                    BtnAddEnHandler();
                }
            }
            catch (Exception ex)
            {
                CommonUtils.WriteLog(ex.StackTrace);
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }
        }
Exemplo n.º 36
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);
            }
        }
 /// <summary>
 /// Constructor class for the answer manager.
 /// </summary>
 /// <param name="validation">An instance of <see cref="IValidation"/>.</param>
 public AnswerManager(IValidation validation)
     : base(validation)
 { }
 public ReviewManager(IValidation validation)
     : base(validation)
 {
 }
Exemplo n.º 39
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.º 40
0
 public void TestInit() {
     _customer = Customer.GetCustomer();
     _validation = new Validation();
 }
Exemplo n.º 41
0
 public void TestValidateEnglishName_Required_ErrorMessage_2() {
     _validation = new Validation2();
     _customer.EnglishName = null;
     var result = _validation.Validate( _customer );
     Assert.AreEqual( "英文名不能为空", result.First().ErrorMessage );
 }
 /// <summary>
 /// This constructor will construct the BaseManager and instantiate it's properties.
 /// The IValidation property is set to the given values.
 /// </summary>
 /// <param name="validation">IValidation to be set.</param>
 protected BaseManager(IValidation validation)
 {
     Validation = validation;
     ConvertEntities = new ConvertEntities();
     OpenIDContext = new OpenIDContext();
 }
 /// <summary>
 /// This constructor will construct the BaseManager and instantiate it's properties.
 /// The IValidation property is set to the given value.
 /// </summary>
 /// <param name="validation">IValidation to be set.</param>
 protected BaseManager(IValidation validation)
 {
     Validation = validation;
     ConvertEntities = new ConvertEntities();
 }
        private void btnStartInspection_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                if (AppProperties.Selected_Resource == "Arabic")
                {
                    imagebtnNext.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/Start Inspection Arabic Up.png", UriKind.Relative));
                    _iValidate = (IValidation)new RecordViolationNonDubaiArValidation();
                }
                else
                {
                    imagebtnNext.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/Start Inspection.png", UriKind.Relative));
                    _iValidate = (IValidation)new RecordViolationNonDubaiEnValidation();
                }

                // this.txtBoxOperatorName.Text = Regex.Replace(this.txtBoxOperatorName.Text, "[^a-zA-Z]+", "", RegexOptions.Compiled);
                this.txtBoxOperatorName.Text = this.txtBoxOperatorName.Text;
                _validationResult = _iValidate.Validate(this);
                if (_validationResult != "Valid")
                {
                    WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                    return;
                }
                else
                {

                    //////////////////
                    if (AppProperties.vehicle == null)
                    {
                        AppProperties.vehicle = new Vehicle();
                        if (AppProperties.Selected_Resource == "Arabic")
                        {
                            AppProperties.vehicle.Country = (string)vehicleSelection.countryTable[vehicleSelection.cmboxCountry.SelectedValue.ToString()];
                            if (null == (string)vehicleSelection.cmboxEmirates.SelectedItem)
                            {
                                AppProperties.vehicle.Emirate = "";
                            }
                            else
                            {
                                AppProperties.vehicle.Emirate = (string)vehicleSelection.emirateTable[vehicleSelection.cmboxEmirates.SelectedValue.ToString()];
                            }
                            if (vehicleSelection.cmboxPlateCode.Visibility == System.Windows.Visibility.Collapsed)
                            {
                                AppProperties.vehicle.PlateCode = vehicleSelection.txtPlateCode.Text;
                            }
                            else
                            {
                                AppProperties.vehicle.PlateCode = (string)vehicleSelection.plateCatTable[vehicleSelection.cmboxPlateCategory.SelectedValue.ToString()];
                            }
                            if (null == (string)vehicleSelection.cmboxPlateCategory.SelectedItem)
                            {
                                AppProperties.vehicle.PlateCategory = "";
                            }
                            else
                            {
                                AppProperties.vehicle.PlateCategory = (string)vehicleSelection.plateCatTable[vehicleSelection.cmboxPlateCategory.SelectedValue.ToString()];
                            }
                            //   vehicleSelection.cmboxCountry.SelectedValue.ToString();
                        }
                        else
                        {
                            AppProperties.vehicle.Country = vehicleSelection.cmboxCountry.SelectedValue.ToString();
                            if (null == (string)vehicleSelection.cmboxEmirates.SelectedItem)
                            {
                                AppProperties.vehicle.Emirate = "";
                            }
                            else
                            {
                                AppProperties.vehicle.Emirate = vehicleSelection.cmboxEmirates.SelectedValue.ToString();
                            }
                            if (vehicleSelection.cmboxPlateCode.Visibility == System.Windows.Visibility.Collapsed)
                            {
                                AppProperties.vehicle.PlateCode = vehicleSelection.txtPlateCode.Text;
                            }
                            else
                            {
                                AppProperties.vehicle.PlateCode = vehicleSelection.cmboxPlateCode.SelectedValue.ToString();
                            }
                            if (null == (string)vehicleSelection.cmboxPlateCategory.SelectedItem)
                            {
                                AppProperties.vehicle.PlateCategory = "";
                            }
                            else
                            {
                                AppProperties.vehicle.PlateCategory = "";
                            }
                        }




                        AppProperties.vehicle.PlateNumber = vehicleSelection.txtBoxPlateNumber.Text;


                        string vehicleCatAr = string.Empty;
                        if (AppProperties.Selected_Resource == "Arabic")
                        {
                            vehicleCatAr = ((IVehicleProfile)VehicleProfileManager.GetInstance()).GetAlternateCategory((string)vehicleSelection.vehicleCatTable[vehicleSelection.cmboxVehicleCategoty.Text], "ar-AE");
                            AppProperties.vehicle.VehicleCategory = (string)vehicleSelection.vehicleCatTable[vehicleSelection.cmboxVehicleCategoty.Text];
                        }

                        else
                        {
                            //    vehicleCatAr = vehicleCatAr;
                            //});
                            vehicleCatAr = ((IVehicleProfile)VehicleProfileManager.GetInstance()).GetAlternateCategory(vehicleSelection.cmboxVehicleCategoty.SelectedValue.ToString(), "en-US");
                            AppProperties.vehicle.VehicleCategory = vehicleSelection.cmboxVehicleCategoty.SelectedValue.ToString();
                        }


                        // string vehicleCatAr = ((IVehicleProfile)VehicleProfileManager.GetInstance()).GetAlternateCategory(vehicleSelection.cmboxVehicleCategoty.SelectedValue.ToString(), "en-US");
                        AppProperties.vehicle.VehicleCategoryAr = vehicleCatAr;
                    }





                    ////////////////////
                    if (AppProperties.vehicle.Operator == null)
                    {
                        AppProperties.vehicle.Operator = new Operator();
                    }
                    AppProperties.vehicle.Operator.OperatorName = txtBoxOperatorName.Text;
                    AppProperties.vehicle.ChassisNumber = txtBoxChassisNumber.Text;
                    AppProperties.vehicle.Make = txtBoxMake.Text;
                    AppProperties.vehicle.Model = txtModel.Text;
                    AppProperties.vehicle.Year = txtYear.Text;

                    //}
                    //Add Defect Scree
                    // RecordViolationDefectScreenEn RVDefect = new RecordViolationDefectScreenEn();

                    this.m_MainWindow.MainContentControl.Content = null;
                    this.m_MainWindow.MainContentControl.Content = new ucDefectAndViolationDetails(this.m_MainWindow);
                    return;
                }
            }
            catch (Exception ex)
            {
                CommonUtils.WriteLog(ex.StackTrace);
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);

            }

        }
Exemplo n.º 45
0
 //        public LoginController()
 //            : this(
 //            new Validation(),
 //            new UrlGeneration(
 //                new UserRepository(
 //                    ConfigurationManager.ConnectionStrings["UserRepository"].ConnectionString),
 //                new TicketGeneration()),
 //            new Login(
 //                new UserRepository(
 //                    ConfigurationManager.ConnectionStrings["UserRepository"].ConnectionString)
 //                ))
 //        {
 //        }
 public LoginController(IValidation validation, IUrlGeneration urlGeneration, ILogin login)
 {
     _validation = validation;
     _urlGeneration = urlGeneration;
     _login = login;
 }
Exemplo n.º 46
0
 public ValidationController(IUserService userService, IClientService clientService)
 {
     this.userService = userService;
     this.clientService = clientService;
 }
Exemplo n.º 47
0
 public virtual void Add(IValidation validation)
 {
     errorList.AddRange(validation.Errors);
 }
 public Lead(IValidation<ICustomer> obj)
     : base(obj)
 {
     //validation = obj;
 }
Exemplo n.º 49
0
        public void Login()
        {
            try
            {


                //MessageBox.Show("Button Click");
                //  busyIndicator.IsBusy = true;
              //  CultureInfo culture = new CultureInfo("en-US");
                             

            //    DateTime testValue = new DateTime(2013, 12, 15, 15, 33, 44);

               
               

                //////////////////////////////////////////////////////////////////
                if (AppProperties.Selected_Resource == "English")
                {

                    _iValidate = (IValidation)new LoginEnValidation();
                }
                else
                {
                    _iValidate = (IValidation)new LoginArValidation();
                }
                _validationResult = _iValidate.Validate(this);

                if (_validationResult != "Valid")
                {

                    WPFMessageBoxResult _Result = WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                    //MessageBox.Show(_validationResult);
                    return;
                }

                if (AppProperties.recordedViolation == null)
                {
                    AppProperties.recordedViolation = new Violation();
                }
                // MessageBox.Show("Connecting to Database");

                // SqlCeConnection con = ((IDBManager)DBConnectionManager.GetInstance()).GetConnection();
                //MessageBox.Show(con.ConnectionString);
                //((IDBDataLoad)DBDataLoadManager.GetInstance()).SetDefaultConfiguration();
                //AppProperties.recordedViolation.Inspector = AppProperties.empUserName;





                ILoginManager iLogin = (ILoginManager)LoginManager.GetInstance();
                AppProperties.empUserName = ((ucLoginEn)this).txtBoxUserName.Text;
                AppProperties.empPassword = ((ucLoginEn)this).txtpswd.Password.ToString();

                bool check = false;
                //  check = iLogin.LoginOnline(AppProperties.empUserName, AppProperties.empPassword);

                try
                {



                    /*
                     ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, lblLoggingIn.Content.ToString(), (bw, we) =>
                 {
                     check = iLogin.LoginOnline(AppProperties.empUserName, AppProperties.empPassword);
                 },ProgressDialogSettings.WithSubLabelAndCancel);


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


                    ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, new CommonUtils().GetStringValue("lblLoggingIn"), (bw, we) =>
                    {

                        check = iLogin.LoginOnline(AppProperties.empUserName, AppProperties.empPassword);

                        // 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 (check)
                    {
                        if (AppProperties.recordedViolation == null)
                        {
                            AppProperties.recordedViolation = new Violation();
                        }
                        ((IDBDataLoad)DBDataLoadManager.GetInstance()).SetDefaultConfiguration();
                        AppProperties.recordedViolation.Inspector = AppProperties.empUserName;
                        // LocationScreenEn locationScreen = new LocationScreenEn();
                        // _render.switchDisplay(form, locationScreen);
                        busyIndicator.IsBusy = false;
                        // this.m_MainWindow.MainContentControl.Content = m_MainWindow.m_PagesList[2];
                        //   this.m_MainWindow.MainContentControl.Content = new ucLocationSelectionEn(m_MainWindow);



                        //Timer to show Weolcom Screen
                        tmr = new System.Timers.Timer();
                        tmr.Elapsed += tmr_Elapsed;
                        // tmr.Interval = 5000; 

                        tmr.Interval = 5000;
                        tmr.Enabled = true; //Вкючаем таймер.   

                        this.m_MainWindow.MainContentControl.Content = new ucWellComeScreen(m_MainWindow);


                        AppProperties.isUserLoggedIn = true;


                    }
                    else
                    {

                        //  WPFMessageBoxResult _ServiceResult = WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), AppProperties.exceptionFromServiceCall, "", WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
                        //  ProgressDialogResult result2 = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, lblLoggingIn.Content.ToString() + "...", (bw, we) =>
                        //{

                        // });


                        ProgressDialogResult result_offline = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, new CommonUtils().GetStringValue("lblLoggingIn"), (bw, we) =>
                        {

                            check = iLogin.OfflineLogin(AppProperties.empUserName, AppProperties.empPassword);

                            // 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_offline.Cancelled)
                            return;
                        else if (result_offline.OperationFailed)
                            return;
                        if (check)
                        {
                            if (AppProperties.recordedViolation == null)
                            {
                                AppProperties.recordedViolation = new Violation();
                            }
                            ((IDBDataLoad)DBDataLoadManager.GetInstance()).SetDefaultConfiguration();
                            AppProperties.recordedViolation.Inspector = AppProperties.empUserName;
                            busyIndicator.IsBusy = false;
                            AppProperties.isUserLoggedIn = true;
                            tmr = new System.Timers.Timer();
                            tmr.Elapsed += tmr_Elapsed;
                            tmr.Interval = 5000;
                            tmr.Enabled = true; //Вкючаем таймер.                       
                            this.m_MainWindow.MainContentControl.Content = new ucWellComeScreen(m_MainWindow);

                            //  this.m_MainWindow.MainContentControl.Content = m_MainWindow.m_PagesList[2];


                        }
                        else
                        {

                            WPFMessageBoxResult _Result = WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), lblMessageBoxNotAuthorized.Content.ToString());
                            // MessageBox.Show(lblMessageBoxNotAuthorized.Content.ToString());

                          //  CommonUtils.WriteLog(e.StackTrace); 
                            //busyIndicator.IsBusy = false;
                            //To do 
                            // this.m_MainWindow.MainContentControl.Content = m_MainWindow.m_PagesList[2];
                        }
                        // MessageBox.Show(lblMessageBoxNotAuthorized.Content.ToString());
                        //busyIndicator.IsBusy = false;
                        //check = true;
                    }
                    check = true;
                }
                catch (Exception e)
                {

                    CommonUtils.WriteLog(e.StackTrace);
                    WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), AppProperties.exceptionFromServiceCall, "", WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
                    //System.Windows.Forms.MessageBox.Show(_resources.GetString("Unable to connect to the remote server"));
                    // System.Windows.Forms.MessageBox.Show(e.Message);
                    if (!check)
                    {
                        check = iLogin.OfflineLogin(AppProperties.empUserName, AppProperties.empPassword);
                        if (check)
                        {
                            if (AppProperties.recordedViolation == null)
                            {
                                AppProperties.recordedViolation = new Violation();
                            }
                            ((IDBDataLoad)DBDataLoadManager.GetInstance()).SetDefaultConfiguration();
                            AppProperties.recordedViolation.Inspector = AppProperties.empUserName;
                            busyIndicator.IsBusy = false;
                            tmr = new System.Timers.Timer();
                            tmr.Elapsed += tmr_Elapsed;
                            tmr.Interval = 5000;
                            tmr.Enabled = true; //Вкючаем таймер.                       
                            this.m_MainWindow.MainContentControl.Content = new ucWellComeScreen(m_MainWindow);
                            //  this.m_MainWindow.MainContentControl.Content = new ucLocationSelectionEn(m_MainWindow);


                        }
                        else
                        {
                            WPFMessageBoxResult _Result = WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), lblMessageBoxNotAuthorized.Content.ToString());
                            busyIndicator.IsBusy = false;
                            //this.m_MainWindow.MainContentControl.Content = m_MainWindow.m_PagesList[2];
                        }
                        check = true;
                    }
                }
            }
            catch (Exception ex)
            {
                CommonUtils.WriteLog(ex.StackTrace);
                WPFMessageBoxResult _Result = WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
                //MessageBox.Show(ex.Message.ToString());
            }
        }
        private void btnNext_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                if (AppProperties.Selected_Resource == "English")
                {
                    btnNextImage.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/Next.png", UriKind.Relative));
                }
                else
                {
                    btnNextImage.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/Next Arabic Up.png", UriKind.Relative));
                }
                // if (cmboxIsPlateConfiscated.Text == "Yes")
                // {
                //if (MessageBox.Show("You want to submit violation ?", "Submit Violation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                // {
                //this.m_mainWindow.MainContentControl.Content = null;//
                //this.m_mainWindow.MainContentControl.Content = new ucViolationSummary(this.m_mainWindow);



                //***************************************************************
                //For Handling Defect Details on Next Button

                //*******************************************************************
                List<string[]> dataRows = AppProperties.selectedDefectsEn;
                if (null == AppProperties.recordedViolation)
                {
                    AppProperties.recordedViolation = new Violation();
                }

                Violation.Defects[] defects = new Violation.Defects[dataRows.Count];

                int numberOfdays = 0;


                if (defects.Length > 0)
                {
                    if (AppProperties.Selected_Resource == "Arabic")
                    {
                        _iValidate = (IValidation)new DriverInfoArValidation();
                    }
                    else
                    {
                        _iValidate = (IValidation)new DriverInfoEnValidation();
                    }
                    _validationResult = _iValidate.Validate(this);
                    if (_validationResult != "Valid")
                    {
                        WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                        return;
                    }
                    for (int i = 0; i < defects.Length; i++)
                    {
                        string[] row = dataRows[i];
                        defects[i] = new Violation.Defects();
                        defects[i].DefectType = row[1].Trim();
                        defects[i].DefectName = row[4].Trim();
                        defects[i].DefectSeverity = row[5].Trim();
                        defects[i].DefectValue = row[7].Trim();
                        defects[i].DefectID = Int32.Parse(row[8].Trim());
                        if (defects[i].DefectType.Trim().Equals("Defect"))
                        {
                            AppProperties.isViolation = true;
                            AppProperties.isSafety = false;
                        }
                        if (defects[i].DefectType.Trim().Equals("Defect") && !AppProperties.isViolation)
                        {
                            AppProperties.isSafety = false;

                        }
                        //  AppProperties.recordedViolation.ViolationSeverity = ((IViolation)ViolationManager.GetInstance()).CalculateSeverity(AppProperties.recordedViolation.ViolationSeverity, row[5].Trim(), Resources.locale_EN);
                        // AppProperties.recordedViolation.ViolationSeverityAr = ((IViolation)ViolationManager.GetInstance()).CalculateSeverity(AppProperties.recordedViolation.ViolationSeverityAr, row[6].Trim(), Resources.locale_AR);
                        AppProperties.recordedViolation.ViolationSeverity = ((IViolation)ViolationManager.GetInstance()).CalculateSeverity(AppProperties.recordedViolation.ViolationSeverity, row[5].Trim(), "");
                        AppProperties.recordedViolation.ViolationSeverityAr = ((IViolation)ViolationManager.GetInstance()).CalculateSeverity(AppProperties.recordedViolation.ViolationSeverityAr, row[6].Trim(), "");

                    }

                    AppProperties.recordedViolation.Defect = null;
                    AppProperties.recordedViolation.Defect = defects;
                    string[] info;
                    //if (_resources.GetLocale().Equals(Resources.locale_EN))
                    //{
                    if (!AppProperties.isSafety)
                    {
                        info = ((IViolation)ViolationManager.GetInstance()).GetConfigurationDataForSeverity(AppProperties.recordedViolation.ViolationSeverity, defects.Length);
                    }
                    else
                    {
                        string[] calculation = ((IViolation)ViolationManager.GetInstance()).GetConfigurationDataForSeverity(AppProperties.recordedViolation.ViolationSeverity, defects.Length);
                        if (calculation != null)
                        {
                            numberOfdays = Int32.Parse(calculation[0]);
                            DateTime dt = DateTime.Now;
                            AppProperties.recordedViolation.ViolationDueDays = dt.AddDays(numberOfdays);
                        }
                        //Confiscations Not Required
                        // EnableDisableAddedDefectsOptions(false);
                        // EnableConfiscateOptions(false);
                        EnableDisableDriverInfoFields(false);
                        SbmitViolation();
                        /*
                        if (AppProperties.Selected_Resource == "English")
                            MessageBox.Show("Safety Violation Submitted");
                        else
                            MessageBox.Show("انتهاك سلامة نشره");
                       // SbmitViolation();
                        this.m_mainWindow.MainContentControl.Content = null;
                        this.m_mainWindow.MainContentControl.Content = new ucLocationSelectionEn(this.m_mainWindow);*/
                        return;
                    }
                    //}
                    //else
                    //{
                    //    info = ((IViolation)ViolationManager.GetInstance()).GetConfigurationDataForSeverity(AppProperties.recordedViolation.ViolationSeverityAr, defects.Length);
                    //}
                    if (null != info)
                    {
                        numberOfdays = Int32.Parse(info[0]);
                        int numberOfVehServSuspDays = Int32.Parse(info[1]);
                        int numberOfCompServSuspDays = Int32.Parse(info[2]);
                        //if (AppProperties.recordedViolation.ViolationSeverity.Equals("Severe",StringComparison.CurrentCultureIgnoreCase))
                        //{
                        //    AppProperties.confiscatePlates = true;

                        //}
                        DateTime currentDate = DateTime.Now;
                        DateTime vehServSuspDays = currentDate;
                        DateTime compServSuspDays = currentDate;

                        if (info[3].Equals("T", StringComparison.CurrentCultureIgnoreCase) && Int32.Parse(info[6]) == 0)
                        {
                            AppProperties.confiscatePlates = true;
                        }

                        AppProperties.receiptTitle = info[4];
                        AppProperties.receiptTitleAr = info[5];


                        AppProperties.vehicle.VehicleSuspensionDate = vehServSuspDays.AddDays(numberOfVehServSuspDays);
                        if (AppProperties.vehicle.Operator != null)
                            AppProperties.vehicle.Operator.CompanySuspensionDate = compServSuspDays.AddDays(numberOfCompServSuspDays);



                        // check if Emirate is null, don't go to confiscation screen
                        IDBDataLoad iDataLoad = ((IDBDataLoad)DBDataLoadManager.GetInstance());

                        if (AppProperties.vehicle.Emirate == null || AppProperties.vehicle.Emirate == "")
                        {
                            iDataLoad.GetCountryProperties(AppProperties.vehicle.Country);
                        }
                        else
                        {
                            iDataLoad.GetCountryProperties(AppProperties.vehicle.Emirate);
                        }
                        if (!AppProperties.canConfiscatePlates)
                        {
                            AppProperties.confiscatePlates = false;
                        }

                        if (AppProperties.confiscatePlates)
                        {
                            DateTime dt = currentDate;

                            AppProperties.recordedViolation.ViolationDueDays = dt.AddDays(numberOfdays);
                            AppProperties.routeFromDefect = true;
                            //Confiscate Option Enable
                            EnableDisableDriverInfoFields(false);
                            //  EnableConfiscateOptions(true);
                            //  PopulateConfiscateOption();
                            //  EnableDisableAddedDefectsOptions(false);
                            // return;
                        }
                        else
                        {
                            DateTime dt = currentDate;
                            AppProperties.recordedViolation.ViolationDueDays = dt.AddDays(numberOfdays);
                            EnableDisableDriverInfoFields(false);
                            //  EnableConfiscateOptions(false);
                            //  PopulateConfiscateOption();
                            //  EnableDisableAddedDefectsOptions(false);
                            // RecordViolationConfirmationScreenEn RVConfirmation = new RecordViolationConfirmationScreenEn();
                            // _render.switchDisplay(form, RVConfirmation);
                            // return;
                        }
                    }
                    else
                    {
                        //throw custom exception to notify that no configuration data exists
                    }
                    SbmitViolation();

                }
                else
                {
                    //Its just an inspection
                    if (AppProperties.Selected_Resource == "Arabic")
                    {
                        _iValidate = (IValidation)new DriverInfoArValidation();
                    }
                    else
                    {
                        _iValidate = (IValidation)new DriverInfoEnValidation();
                    }
                    _validationResult = _iValidate.Validate(this);
                    if (_validationResult != "Valid")
                    {
                        WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                        return;
                    }
                    AppProperties.Is_SubmitVilation = false;
                    if (WPFMessageBox.Show(new CommonUtils().GetStringValue("Confirmation"), new CommonUtils().GetStringValue("lblSubmitInspection"), WPFMessageBoxButtons.YesNo, WPFMessageBoxImage.Question) == WPFMessageBoxResult.Yes)
                    {
                        // ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_mainWindow, lblSubmitInspectionMessage.Content.ToString(), (bw, we) =>
                        //  {
                        //     AppProperties.isOnline = ((IViolation)ViolationManager.GetInstance()).SubmitViolation();
                        //  });


                        ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_mainWindow, new CommonUtils().GetStringValue("lblSubmitInspectionMessage"), (bw, we) =>
                        {

                            AppProperties.isOnline = ((IViolation)ViolationManager.GetInstance()).SubmitViolation();

                            // 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;
                        else
                        {
                            if (AppProperties.isInspectionUploaded)
                            {
                                if (AppProperties.Selected_Resource == "English")
                                    //System.Windows.MessageBox.Show("Inspection Uploaded");
                                    WPFMessageBox.Show(new CommonUtils().GetStringValue("Confirmation"), "Inspection Uploaded");
                                else
                                    WPFMessageBox.Show(new CommonUtils().GetStringValue("Confirmation"), "تم تسجيل عملية التفتيش بنجاح");
                            }
                            AppProperties.isInspectionUploaded = false;
                        }


                        //  AppProperties.isOnline = ((IViolation)ViolationManager.GetInstance()).SubmitViolation();

                        if (AppProperties.businessError)
                        {
                            WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("ErrorBusiness"));
                            AppProperties.businessError = false;

                        }
                        if (AppProperties.IsException)
                        {
                            WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("ErrorException"));
                            AppProperties.IsException = false;
                            return;
                        }
                        if (AppProperties.NotFoundError)
                        {
                            WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("ErrorNotFound"));
                            AppProperties.NotFoundError = false;
                            return;
                        }
                        AppProperties.recordedViolation = null;
                        AppProperties.recordedViolation = new Violation();
                        AppProperties.recordedViolation.InspectionArea = AppProperties.location;
                        AppProperties.vehicle = null;
                        AppProperties.Total_Vehicle_Inspected = AppProperties.Total_Vehicle_Inspected + 1;
                        if (AppProperties.Selected_Resource == "English")
                        {
                            if (AppProperties.Previous_Selected_LocationEn.Equals(AppProperties.Current_Selected_LocationEn))
                            {
                                AppProperties.Selected_Location_Count = AppProperties.Selected_Location_Count + 1;
                                AppProperties.Previous_Selected_LocationEn = AppProperties.Current_Selected_LocationEn;
                                // AppProperties.Previous_Selected_AreaEn = AppProperties.Previous_Selected_AreaEn
                            }
                            else
                            {
                                AppProperties.Previous_Selected_LocationEn = AppProperties.Current_Selected_LocationEn;
                                AppProperties.Selected_Location_Count = AppProperties.Selected_Location_Count + 1;
                                // AppProperties.Previous_Selected_AreaEn = AppProperties.location.area;
                            }

                        }
                        else
                        {
                            if (AppProperties.Previous_Selected_LocationAr.Equals(AppProperties.Current_Selected_LocationAr))
                            {
                                AppProperties.Selected_Location_Count = AppProperties.Selected_Location_Count + 1;
                                AppProperties.Previous_Selected_LocationAr = AppProperties.Current_Selected_LocationAr;
                                // AppProperties.Previous_Selected_AreaAr = AppProperties.location.area;
                            }
                            else
                            {
                                AppProperties.Previous_Selected_LocationAr = AppProperties.Current_Selected_LocationAr;
                                AppProperties.Selected_Location_Count = AppProperties.Selected_Location_Count + 1;
                                // AppProperties.Previous_Selected_AreaAr = AppProperties.location.area;
                            }
                        }
                        this.m_mainWindow.MainContentControl.Content = null;
                        // this.m_mainWindow.MainContentControl.Content = new ucLocationSelectionEn(this.m_mainWindow);
                        this.m_mainWindow.MainContentControl.Content = new ucLocationSelectionEn(this.m_mainWindow);
                        return;
                    }


                }



                //}
                //else
                //{
                //    System.Windows.Forms.MessageBox.Show("Select yes from the drop-down first");
                //}
                //  }
                // BtnNextDefectHandler();
            }

            catch (Exception ex)
            {
                CommonUtils.WriteLog(ex.StackTrace);
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }
        }
 public CustomerBase(IValidation<ICustomer> obj)
 {
     validation = obj;
 }
Exemplo n.º 52
0
        private void btnNext_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {



                if (AppProperties.Selected_Resource == "Arabic")
                {
                    _iValidate = (IValidation)new LocationArValidation();
                    imagebtnNext.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/Start Inspection Arabic Up.png", UriKind.Relative));
                    AppProperties.Current_Selected_LocationAr = cmboxLocation.Text;
                    AppProperties.Previous_Selected_AreaAr = cmboxArea.Text;
                    if (AppProperties.Previous_Selected_LocationAr.Equals(AppProperties.Current_Selected_LocationAr))
                    {
                        if (AppProperties.Selected_Location_Count == 5)
                        {
                            if (WPFMessageBox.Show(new CommonUtils().GetStringValue("Confirmation"), new CommonUtils().GetStringValue("lblInspectionConfirmationMessage") + "\"" + AppProperties.Current_Selected_LocationAr + "\"" + "؟", WPFMessageBoxButtons.YesNo, WPFMessageBoxImage.Question) == WPFMessageBoxResult.No)
                            {

                                return;
                            }
                        }
                    }
                }
                else
                {
                    _iValidate = (IValidation)new LocationEnValidation();
                    imagebtnNext.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/Start Inspection.png", UriKind.Relative));
                    AppProperties.Current_Selected_LocationEn = cmboxLocation.Text;
                    AppProperties.Previous_Selected_AreaEn = cmboxArea.Text;
                    if (AppProperties.Previous_Selected_LocationEn.Equals(AppProperties.Current_Selected_LocationEn))
                    {
                        if (AppProperties.Selected_Location_Count == 5)
                        {
                            if (WPFMessageBox.Show(new CommonUtils().GetStringValue("Confirmation"), new CommonUtils().GetStringValue("lblInspectionConfirmationMessage") + "\"" + AppProperties.Current_Selected_LocationEn + "\"?", WPFMessageBoxButtons.YesNo, WPFMessageBoxImage.Question) == WPFMessageBoxResult.No)
                            {

                                return;
                            }
                        }
                    }
                }
                _validationResult = _iValidate.Validate(this);
                if (_validationResult != "Valid")
                {
                    WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                    return;
                }

                if (AppProperties.recordedViolation == null)
                {
                    AppProperties.recordedViolation = new Violation();
                }
                AppProperties.location = new Violation.InspectionLocation();
                if (AppProperties.Selected_Resource == "Arabic")
                {
                    AppProperties.location.city = (string)citiesTable[(string)cmboxEmirates.SelectedItem];
                    AppProperties.location.area = (string)areasTable[(string)cmboxArea.SelectedItem];
                    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();
                    AppProperties.location.location = ((string)((ucLocationSelectionEn)this).cmboxLocation.Text).Trim();
                }
                AppProperties.recordedViolation.InspectionArea = AppProperties.location;
                this.m_MainWindow.MainContentControl.Content = m_MainWindow.m_PagesList[4];
                //  this.m_MainWindow.MainContentControl.Content = new  ucRecordViolationNonUAEVehicle(m_MainWindow,this));

                // LandingScreenEn landingEn = new LandingScreenEn();
                // _render.switchDisplay(form, landingEn);

                return;

            }
            catch (Exception ex)
            {
                CommonUtils.WriteLog(ex.StackTrace);
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }

        }
        public void SearchViolationArHandler()
        {
            try
            {
                _iValidate = (IValidation)new ViolationSeacrchArValidation();
                _validationResult = _iValidate.Validate(this);

                if (_validationResult != "Valid")
                {
                    WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                }
                else
                {
                    string country = (string)this.countryTable[cmboxCountry.Text];
                    string emirate = (string)this.emirateTable[cmboxEmirates.Text];
                    string plateCat = (string)this.plateCatTable[cmboxPlateCategory.Text];
                    string plateCode = (string)this.plateCodeTable[cmboxPlateCode.Text];
                    string plateNumber = this.txtBoxPlateNumber.Text.Trim();
                    string violationID = this.txtBoxViolationID.Text.Trim();



                    if (rdoBtnPlateNumber.IsChecked == true)
                    {
                        //AppProperties.vehicle = null;
                        // ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, "جاري البحث عن بيانات المركبة...", (bw, we) =>
                        // {
                        //Do Work
                        //    ((IVehicleProfile)VehicleProfileManager.GetInstance()).GetVehicleProfileDetails(country, emirate, plateCat, plateNumber, plateCode);
                        //   });

                        ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, "جاري البحث عن بيانات المركبة...", (bw, we) =>
                        {

                            ((IViolationHistory)ViolationHistoryManager.GetInstance()).GetViolationHistoryByPlateNumber(country, emirate, plateCat, plateNumber, plateCode);

                            // 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;

                    }
                    else
                    {
                        if (AppProperties.vehicle != null)
                        {
                            AppProperties.vehicle.Violations = null;
                        }
                        //   ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, "...جاري البحث على بيانات التجاوزات", (bw, we) =>
                        //  {
                        //Do Work
                        //    ((IViolationHistory)ViolationHistoryManager.GetInstance()).GetViolationHistoryByID(violationID);
                        //  });

                        ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, "...جاري البحث على بيانات التجاوزات ", (bw, we) =>
                        {

                            ((IViolationHistory)ViolationHistoryManager.GetInstance()).GetViolationHistoryByID(violationID);

                            // 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;
                        //System.Windows.Forms.MessageBox.Show(AppProperties.errorMessageFromBusiness);
                        WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("ErrorBusiness"));
                        AppProperties.businessError = false;
                        AppProperties.vehicle = null;
                        // LandingScreenEn landing = new LandingScreenEn();
                        // _render.switchDisplay(form, landing);
                        //   this.m_MainWindow.MainContentControl.Content = null;
                        //  this.m_MainWindow.MainContentControl.Content = new ucLocationSelectionEn(m_MainWindow);
                        return;
                    }
                    if (AppProperties.IsException)
                    {
                        AppProperties.IsException = false;
                        WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("ErrorException"));
                        AppProperties.vehicle = null;
                        ClearFields();
                        return;
                    }
                    if (AppProperties.NotFoundError)
                    {
                        AppProperties.NotFoundError = false;
                        WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), new CommonUtils().GetStringValue("ErrorNotFound"));
                        AppProperties.vehicle = null;
                        ClearFields();
                        return;
                    }


                    if (null != AppProperties.vehicle)
                    {
                        // System.Windows.MessageBox.Show("Vehicle Data Found");
                        if (null != AppProperties.vehicle.Violations && AppProperties.vehicle.Violations.Length > 0)
                        {
                            PopulateViolationHistoryDetails();
                            // ViolationHistoryDetailScreenEn violationDetail = new ViolationHistoryDetailScreenEn();
                            //_render.switchDisplay(form, violationDetail);
                            return;
                        }
                        else
                        {
                            AppProperties.vehicle = null;
                            WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), "لم يم العثور على تجاوزات");

                            //  LandingScreenEn landing = new LandingScreenEn();
                            //  _render.switchDisplay(form, landing);
                            //  this.m_MainWindow.MainContentControl.Content = null;
                            // this.m_MainWindow.MainContentControl.Content = new ucLocationSelectionEn(m_MainWindow);
                            return;

                        }
                    }
                    else
                    {
                        if (this.rdoBtnPlateNumber.IsChecked == true)
                        {
                            WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), "لم يتم العثور على بيانات المركبة");
                        }
                        else
                        {
                            WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), "لم يم العثور على تجاوزات");
                            //System.Windows.Forms.MessageBox.Show("لم يم العثور على تجاوزات");
                        }
                        AppProperties.vehicle = null;
                        // this.m_MainWindow.MainContentControl.Content = null;
                        // this.m_MainWindow.MainContentControl.Content = new ucLocationSelectionEn(m_MainWindow);
                        // LandingScreenEn landing = new LandingScreenEn();
                        //_render.switchDisplay(form, landing);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                CommonUtils.WriteLog(ex.StackTrace);
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }
        }
 public ValidationInfo(PropertyInfo property, IValidation validation, string[] groups)
 {
     Groups = groups;
     Property = property;
     Validation = validation;
 }
 /// <summary>
 /// Constructor class for the question manager.
 /// </summary>
 /// <param name="validation">An in stance of <see cref="IValidation"/>.</param>
 public QuestionManager(IValidation validation)
     : base(validation)
 {
 }
 /// <summary>
 /// Constructor that sets the IValidation property to the given value.
 /// </summary>
 /// <param name="validation">IValidation to be set.</param>
 public UserManager(IValidation validation)
     : base(validation)
 {
 }
 public TwitterSendAnswerPlugin()
 {
     validation = new Validation();
 }
        private void btnStartInspection_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {

                if (AppProperties.Selected_Resource == "English")
                {
                    imagebtnNext.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/Start Inspection.png", UriKind.Relative));
                    _iValidate = (IValidation)new SearchedVehicleDetailsEnValidation();
                    //  this.txtBoxOperatorName.Text = Regex.Replace(this.txtBoxOperatorName.Text, "[^a-zA-Z]+", "", RegexOptions.Compiled);
                    _validationResult = _iValidate.Validate(this);
                }
                else
                {
                    _iValidate = (IValidation)new VehicleProfileInspectionArValidation();
                    //  this.txtBoxOperatorName.Text = Regex.Replace(this.txtBoxOperatorName.Text, "[^a-zA-Z]+", "", RegexOptions.Compiled);
                    _validationResult = _iValidate.Validate(this);
                    imagebtnNext.Source = new BitmapImage(new Uri(@"/Images/Buttons/Small/Start Inspection Arabic Up.png", UriKind.Relative));
                }
                if (_validationResult != "Valid")
                {
                    WPFMessageBox.Show(new CommonUtils().GetStringValue("DataValidation"), _validationResult);
                }
                else
                {
                    this.m_mainWindow.MainContentControl.Content = null;

                    this.m_mainWindow.MainContentControl.Content = new ucDefectAndViolationDetails(this.m_mainWindow, false);
                }

            }
            catch (Exception ex)
            {
                CommonUtils.WriteLog(ex.StackTrace);
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }
        }
        private void InitiateStartParams(bool downloadImmediately)
        {
        	
        	this.Icon = formIcon;
            
            this.changeSaveLocation.BackgroundImage = imageList[0];
            
            this.changeTemporaryLocation.BackgroundImage = imageList[0];
            
            this.moveQueuedItemUp.BackgroundImage = imageList[1];
            
            this.moveQueuedItemDown.BackgroundImage = imageList[2];
			
            this.iMainForm = (this as IMainForm);
            
            this.mainForm = this;
            
            this.Validation = (new Validation() as IValidation);
            
            this.Storage = (new Storage(this.iMainForm, this.Validation) as IStorage);
            
            this.Download = (new Download(this.iMainForm, this.Storage) as IDownload);
            
            Storage.ReadFromRegistry();
            
            VideoQueue.Items = Storage.ReadUrls();
            
            this.RefreshQueue(0, false);
            
            writeFileVersionToStatBar();
  			
            if (this.queuedBox.Items.Count >= 1)
            {
            	
                this.urlToModify.Text = VideoQueue.Items [0].Location;
            	
                this.resolutionToModify.Value = VideoQueue.Items [0].Resolution;
                
                this.formatToModify.SelectedItem = VideoQueue.Items [0].Format.ToString();
                
                if (downloadImmediately)
                {
                	
                    StartDownloadButtonClick(null, null);
                	
                }
          	  
            }
            
            SchedulingEnabledCheckedChanged(null, null);
        	
        }
Exemplo n.º 60
0
 public MailController(IMailConfigRepository repo, IValidation<MailModel> validation) : base(repo, validation)
 {
     this.repo = repo;
 }