public override List <BusinessValidation> Validate <T>(T entity)
        {
            List <BusinessValidation> validations = new List <BusinessValidation>();
            BusinessValidation        validation  = new BusinessValidation();

            if (ObjectType <= 0)
            {
                validations.Add(new BusinessValidation {
                    ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "ObjectType is required"
                });
            }
            else if (!Enum.IsDefined(typeof(GBEnums.ObjectTypes), ObjectType))
            {
                validations.Add(new BusinessValidation {
                    ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "ObjectType is not defined"
                });
            }

            if (string.IsNullOrEmpty(DocumentType))
            {
                validations.Add(new BusinessValidation {
                    ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "DocumentType is required"
                });
            }
            if (CompanyId <= 0)
            {
                validations.Add(new BusinessValidation {
                    ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "CompanyId is required"
                });
            }



            return(validations);
        }
Пример #2
0
        public override List <BusinessValidation> Validate <T>(T entity)
        {
            List <BusinessValidation> validations = new List <BusinessValidation>();
            BusinessValidation        validation  = new BusinessValidation();

            return(validations);
        }
Пример #3
0
        public override List <BusinessValidation> Validate <T>(T entity)
        {
            List <BusinessValidation> validations = new List <BusinessValidation>();
            BusinessValidation        validation  = new BusinessValidation();

            //Implement logic for validation

            if (string.IsNullOrEmpty(Name))
            {
                validations.Add(new BusinessValidation {
                    ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "Name is required"
                });
            }

            //if (string.IsNullOrEmpty(TaxID))
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "TaxID is required" });
            //}

            //if (TaxID.Length!=10)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "Please input valid TaxID" });
            //}

            return(validations);
        }
Пример #4
0
        public override List <BusinessValidation> Validate <T>(T entity)
        {
            List <BusinessValidation> businessValidations = new List <BusinessValidation>();
            BusinessValidation        businessValidation  = new BusinessValidation();

            if (location.ID == 0)
            {
                if (string.IsNullOrEmpty(this.location.Name))
                {
                    businessValidations.Add(new BusinessValidation()
                    {
                        ValidationResult  = BusinessValidationResult.Failure,
                        ValidationMessage = "Location name is required"
                    });
                }
                if (string.IsNullOrEmpty(this.location.LocationType.ToString()))
                {
                    businessValidations.Add(new BusinessValidation()
                    {
                        ValidationResult  = BusinessValidationResult.Failure,
                        ValidationMessage = "Location type is required"
                    });
                }
                if (string.IsNullOrEmpty(this.location.IsDefault.ToString()))
                {
                    businessValidations.Add(new BusinessValidation()
                    {
                        ValidationResult  = BusinessValidationResult.Failure,
                        ValidationMessage = "Default location  is required"
                    });
                }
            }
            return(businessValidations);
        }
Пример #5
0
        public override List <BusinessValidation> Validate <T>(T entity)
        {
            List <BusinessValidation> validations = new List <BusinessValidation>();
            BusinessValidation        validation  = new BusinessValidation();

            //Implement logic for validation

            return(validations);
        }
Пример #6
0
        public override List <BusinessValidation> Validate <T>(T entity)
        {
            List <BusinessValidation> validations = new List <BusinessValidation>();
            BusinessValidation        validation  = new BusinessValidation();

            /*/Check for allowed file extensions [per file]
             * if (!streamContent.ToList().TrueForAll(x => Enum.IsDefined(typeof(GBEnums.FileTypes), x.Headers.ContentDisposition.FileName.Split('.')[1].Replace("\"", string.Empty))))
             *  validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "Invalid File extension" });
             * //Check for allowed file size <= 1MB [per file]
             * if (!streamContent.ToList().TrueForAll(x => (Convert.ToDecimal(x.Headers.ContentLength / (1024.0m * 1024.0m)) > 0 && Convert.ToDecimal(x.Headers.ContentLength / (1024.0m * 1024.0m)) <= 1)))
             *  validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "Filesize exceeded the limit 1MB" });*/

            return(validations);
        }
Пример #7
0
        public override List <BusinessValidation> Validate <T>(T entity)
        {
            List <BusinessValidation> validations = new List <BusinessValidation>();
            BusinessValidation        validation  = new BusinessValidation();

            //if (companyId == null || companyId <= 0)
            //    validations.Add(new BusinessValidation
            //    {
            //        ValidationResult = BusinessValidationResult.Failure,
            //        ValidationMessage = "CompanyId is required"
            //    });

            return(validations);
        }
Пример #8
0
        public override List <BusinessValidation> Validate <T>(T entity)
        {
            List <BusinessValidation> validations = new List <BusinessValidation>();
            BusinessValidation        validation  = new BusinessValidation();
            //Implement logic for validation

            Guid UniqueID_ = new Guid();

            if (!Guid.TryParse(UniqueID.ToString(), out UniqueID_))
            {
                validations.Add(new BusinessValidation {
                    ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "Invalid appkey."
                });
            }

            return(validations);
        }
Пример #9
0
        public override List <BusinessValidation> Validate <T>(T entity)
        {
            List <BusinessValidation> validations = new List <BusinessValidation>();
            BusinessValidation        validation  = new BusinessValidation();

            if (user.ID == 0)
            {
                if (string.IsNullOrEmpty(user.FirstName))
                {
                    validations.Add(new BusinessValidation {
                        ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "FirstName is required"
                    });
                }

                if (string.IsNullOrEmpty(user.LastName))
                {
                    validations.Add(new BusinessValidation {
                        ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "LastName is required"
                    });
                }

                if (string.IsNullOrEmpty(user.UserName))
                {
                    validations.Add(new BusinessValidation {
                        ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "UserName is required"
                    });
                }
                if (string.IsNullOrEmpty(user.UserType.ToString()))
                {
                    validations.Add(new BusinessValidation {
                        ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "UserType is required"
                    });
                }
            }

            return(validations);
        }
Пример #10
0
        public override List <BusinessValidation> Validate <T>(T entity)
        {
            List <BusinessValidation> validations = new List <BusinessValidation>();
            BusinessValidation        validation  = new BusinessValidation();

            //if (ID < 0)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "ID cannot be less than zero." });
            //}

            //if (PatientID < 0)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "PatientID cannot be less than zero." });
            //}

            //if (User != null && User.ID != PatientID)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "PatientID dosent match." });
            //}

            //if (string.IsNullOrWhiteSpace(SSN) == true)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "SSN cannot be empty." });
            //}

            //if (string.IsNullOrWhiteSpace(WCBNo) == true)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "WCBNo cannot be empty." });
            //}

            //if (string.IsNullOrWhiteSpace(JobTitle) == true)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "JobTitle cannot be empty." });
            //}

            //if (string.IsNullOrWhiteSpace(WorkActivities) == true)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "WorkActivities cannot be empty." });
            //}

            //if (string.IsNullOrWhiteSpace(CarrierCaseNo) == true)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "CarrierCaseNo cannot be empty." });
            //}

            //if (string.IsNullOrWhiteSpace(ChartNo) == true)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "ChartNo cannot be empty." });
            //}

            //if (CompanyId < 0)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "CompanyID cannot be less than zero." });
            //}

            //if (Company != null && Company.ID != CompanyId)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "CompanyID dosent match." });
            //}

            //if (LocationID < 0)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "LocationID cannot be less than zero." });
            //}

            //if (Location != null && Location.ID != LocationID)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "LocationID dosent match." });
            //}

            //if (Weight.HasValue == true && Weight < 0)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "Weight cannot be less than zero." });
            //}

            //if (Height.HasValue == true && Height < 0)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "Height cannot be less than zero." });
            //}

            //if (MaritalStatusId.HasValue == true && MaritalStatusId < 0)
            //{
            //    validations.Add(new BusinessValidation { ValidationResult = BusinessValidationResult.Failure, ValidationMessage = "Please select MaritalStatus." });
            //}



            return(validations);
        }