コード例 #1
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            if (value == null)
            {
                return(ValidationResult.Success);
            }

            int valueNumber = -1;

            try
            {
                valueNumber = Int32.Parse(value.ToString());
            }
            catch (Exception)
            {
                return(new ValidationResult("Property is invalid"));
            }
            if (valueNumber < 0)
            {
                return(new ValidationResult("Property is invalid"));
            }

            using (CommonReferenceDataRepository db = new CommonReferenceDataRepository())
            {
                var clientGroup = db.GetAssetTypes().SingleOrDefault(s => s.AssetTypeID == valueNumber);
                if (clientGroup != null)
                {
                    return(ValidationResult.Success);
                }
                else
                {
                    return(new ValidationResult(ErrorMessage));
                }
            }
        }
コード例 #2
0
        public void CanGenerateFilteredCommissionsAndFees()
        {
            CommonReferenceDataRepository repo = new CommonReferenceDataRepository(null);
            var fees = repo.GetCommissionAndFees_Filtered(c => c.CommissionsAndFeesId == 1);

            Assert.AreEqual(1, fees.Count);
        }
コード例 #3
0
        public void EnumCanProduceItems()
        {
            CommonReferenceDataRepository repo = new CommonReferenceDataRepository(null);

            var professionTypes = repo.GetAllProfessionTypes();

            Assert.AreEqual(7, professionTypes.Count);
        }
コード例 #4
0
 public EducationLevelController()
 {
     repo = new CommonReferenceDataRepository();
 }