public void ElectronicServiceRecepientValidation(Microsoft.Practices.EnterpriseLibrary.Validation.ValidationResults results)
        {
            ValidationResults valResults = null;

            Microsoft.Practices.EnterpriseLibrary.Validation.Validator validator = null;

            if (Entity != null)
            {
                validator = ValidationFactory.CreateValidator <EntityBasicData>();
            }
            else if (ForeignEntity != null)
            {
                validator = ValidationFactory.CreateValidator <ForeignEntityBasicData>();
            }
            else if (ForeignCitizen != null)
            {
                validator = ValidationFactory.CreateValidator <ForeignCitizenBasicData>();
            }
            else if (Person != null)
            {
                validator = ValidationFactory.CreateValidator <PersonBasicData>();
            }

            if (validator != null)
            {
                valResults = validator.Validate(Item);
                results.AddAllResults(valResults);
            }
        }
示例#2
0
        public void ServiceApplicantReceiptDataValidation(Microsoft.Practices.EnterpriseLibrary.Validation.ValidationResults results)
        {
            string            message;
            ValidationResults valResults = null;

            Microsoft.Practices.EnterpriseLibrary.Validation.Validator validator = null;

            if (!this.ServiceResultReceiptMethodSpecified)
            {
                message = string.Format(Resources.Terms._0006_000015, Resources.Fields._0008_000197, Resources.Sections._0009_000141);
                results.AddResult(new Microsoft.Practices.EnterpriseLibrary.Validation.ValidationResult(message, this, "", "0006-000015", null));
            }

            //Задължителни полета, ако получаването е на гише в администрация
            if (this.ServiceResultReceiptMethod.Equals(ServiceResultReceiptMethod.PerCounterInMunicipality))
            {
                if (MunicipalityAdministrationAddress != null)
                {
                    validator = ValidationFactory.CreateValidator <ServiceApplicantReceiptDataMunicipalityAdministrationAdress>();
                }
            }
            //Задължителни полета, ако получаването е по поща
            else if (this.ServiceResultReceiptMethod.Equals(ServiceResultReceiptMethod.PerPostOfficeBox))
            {
                if (string.IsNullOrEmpty(PostOfficeBox))
                {
                    message = string.Format(Resources.Terms._0006_000015, Resources.Fields._0008_000136, Resources.Sections._0009_000141);
                    results.AddResult(new Microsoft.Practices.EnterpriseLibrary.Validation.ValidationResult(message, this, "", "0006-000015", null));
                }
            }
            //Задължителни полета, ако получаването е на друг адрес
            else if (this.ServiceResultReceiptMethod.Equals(ServiceResultReceiptMethod.PerCourierOthers))
            {
                if (ApplicantAddress != null)
                {
                    validator = ValidationFactory.CreateValidator <ServiceApplicantReceiptDataApplicantAdress>();
                }
            }

            if (validator != null)
            {
                valResults = validator.Validate(Item);
                results.AddAllResults(valResults);
            }
        }
        public void ElectronicStatementAuthorValidation(Microsoft.Practices.EnterpriseLibrary.Validation.ValidationResults results)
        {
            Microsoft.Practices.EnterpriseLibrary.Validation.ValidationResults authorResults = null;
            Microsoft.Practices.EnterpriseLibrary.Validation.Validator         validator     = null;

            if ((Item as PersonBasicData) != null)
            {
                validator = ValidationFactory.CreateValidator <PersonBasicData>();
            }
            else if ((Item as ForeignCitizenBasicData) != null)
            {
                validator = ValidationFactory.CreateValidator <ForeignCitizenBasicData>();
            }

            if (validator != null)
            {
                authorResults = validator.Validate(Item);
                results.AddAllResults(authorResults);
            }
        }