Beispiel #1
0
 private void validationProvider1_ValueConvert(object sender, Microsoft.Practices.EnterpriseLibrary.Validation.Integration.ValueConvertEventArgs e)
 {
     if (e.SourcePropertyName == "NoOfCourses")
     {
         string originalValue = e.ValueToConvert as string;
         int    convertedValue;
         bool   success = Int32.TryParse(originalValue, out convertedValue);
         if (success)
         {
             e.ConvertedValue = convertedValue;
         }
         else
         {
             e.ConversionErrorMessage = "No. Of Courses Points must be a valid integer";
         }
     }
 }
Beispiel #2
0
 private void customerValidationProvider_ValueConvert(object sender, Microsoft.Practices.EnterpriseLibrary.Validation.Integration.ValueConvertEventArgs e)
 {
     // Get the value of the RewardPoints control and convert to an integer
     if (e.SourcePropertyName == "RewardPoints")
     {
         string originalValue = e.ValueToConvert as string;
         int    convertedValue;
         bool   success = Int32.TryParse(originalValue, out convertedValue);
         if (success)
         {
             e.ConvertedValue = convertedValue;
         }
         else
         {
             e.ConversionErrorMessage = "Reward Points must be a valid integer";
         }
     }
 }