internal void PerformCustomValueConversion(ValueConvertEventArgs e)
 {
     if (ValueConvert != null)
     {
         ValueConvert(this, e);
     }
 }
 public void SetUp()
 {
     MockValidator<object>.ResetCaches();
     validationStatusOnCallback = null;
     valueConvertEventArgs = null;
     validationPerformedEventArgs = null;
 }
 void OnValueConvertWithFailure(object source,
                                ValueConvertEventArgs e)
 {
     valueToConvert           = e.ValueToConvert;
     originalConvertedValue   = e.ConvertedValue;
     e.ConversionErrorMessage = conversionErrorMessage;
 }
 void IValidationIntegrationProxy.PerformCustomValueConversion(ValueConvertEventArgs e)
 {
     if (this.ValueConvert != null)
     {
         this.ValueConvert(this, e);
     }
 }
 void OnValueConvert(object source,
                     ValueConvertEventArgs e)
 {
     valueToConvert         = e.ValueToConvert;
     originalConvertedValue = e.ConvertedValue;
     e.ConvertedValue       = convertedValue;
 }
 public void TestInitialize()
 {
     ValidationFactory.SetDefaultConfigurationValidatorFactory(new SystemConfigurationSource(false));
     MockValidator<object>.ResetCaches();
     validationStatusOnCallback = null;
     valueConvertEventArgs = null;
     validationPerformedEventArgs = null;
 }
Exemple #7
0
 protected void PropertyProxyValidatorReprotType_ValueConvert(object sender, ValueConvertEventArgs e)
 {
     if (e.ValueToConvert.ToString() == "0")
     {
         e.ConvertedValue = null;
     }
     else
     {
         e.ConvertedValue = e.ValueToConvert.ToString();
     }
 }
Exemple #8
0
        /// <summary>
        /// Converts value to State instance during validation.
        /// </summary>
        /// <param name="e">The <see cref="Microsoft.Practices.EnterpriseLibrary.Validation.Integration.ValueConvertEventArgs"/> instance containing the event data.</param>
        /// <returns>The converted State instance.</returns>
        public static State?ValueConvertState(this ValueConvertEventArgs e)
        {
            if (string.IsNullOrEmpty(e.ValueToConvert.ToString()))
            {
                return(null);
            }

            var state = new State(e.ValueToConvert.ToString());

            return((string.IsNullOrEmpty(state.Code)) ? (State?)null : state);
        }
Exemple #9
0
 void IValidationIntegrationProxy.PerformCustomValueConversion(ValueConvertEventArgs e)
 {
     if (this.Converter != null)
     {
         try
         {
             e.ConvertedValue = Converter.ConvertBack(e.ValueToConvert, e.TargetType, ConverterParameter, ConverterCulture);
         }
         catch (Exception x)
         {
             e.ConversionErrorMessage = x.Message;
         }
     }
 }
Exemple #10
0
        protected void AmountValueConvert(object sender, ValueConvertEventArgs e)
        {
            double convertedValue;

            if (double.TryParse(e.ValueToConvert as string, NumberStyles.AllowDecimalPoint, NumberFormatInfo.CurrentInfo, out convertedValue))
            {
                e.ConvertedValue = convertedValue;
            }
            else
            {
                e.ConversionErrorMessage = Properties.Resources.AmountRangeTypeValidation;
                e.ConvertedValue         = null;
            }
        }
Exemple #11
0
    protected void CustomConvert(object sender, ValueConvertEventArgs args)
    {
        string valueToConvert = args.ValueToConvert as string;

        if (valueToConvert != null)
        {
            char[] chars = valueToConvert.ToCharArray();
            Array.Reverse(chars);
            args.ConvertedValue = Int32.Parse(new string(chars));
        }
        else
        {
            args.ConvertedValue = null;
        }
    }
Exemple #12
0
        /// <summary>
        /// Converts an enum value during validation.
        /// </summary>
        /// <typeparam name="T">The type of enum to convert.</typeparam>
        /// <param name="e">The <see cref="Microsoft.Practices.EnterpriseLibrary.Validation.Integration.ValueConvertEventArgs"/> instance containing the event data.</param>
        /// <returns>The converted enum instance.</returns>
        public static T ValueConvertEnum <T>(this ValueConvertEventArgs e)
        {
            var result = default(T);
            var type   = (typeof(T).IsGenericType) ? Nullable.GetUnderlyingType(typeof(T)) : typeof(T);
            var @enum  = (T)Enum.Parse(type, e.ValueToConvert.ToString());
            var values = Enum.GetValues(type);

            foreach (var value in values)
            {
                if (!value.Equals(@enum))
                {
                    continue;
                }

                result = @enum;

                break;
            }

            return(result);
        }
Exemple #13
0
 protected void proxyValidatorEmptyStringToNull_ValueConvert(object sender, ValueConvertEventArgs e)
 {
     e.ConvertedValue = (!string.IsNullOrEmpty(e.ValueToConvert.ToString())) ? e.ValueToConvert.ToString() : null;
 }
Exemple #14
0
 protected void proxyValidatorMailingState_ValueConvert(object sender, ValueConvertEventArgs e)
 {
     e.ConvertedValue = e.ValueConvertState();
 }
 protected void CustomConvert(object sender, ValueConvertEventArgs args)
 {
     args.ConversionErrorMessage = "custom conversion error message";
 }
Exemple #16
0
 protected void proxyValidatorType_ValueConvert(object sender, ValueConvertEventArgs e)
 {
     e.ConvertedValue = e.ValueConvertEnum <AgencyType?>();
 }
 void OnValueConvertFailing(object source,
                            ValueConvertEventArgs e)
 {
     valueConvertEventArgs = e;
     valueConvertEventArgs.ConversionErrorMessage = "failed conversion";
 }
Exemple #18
0
 public static string ValueConvertPhoneNumber(this ValueConvertEventArgs e)
 {
     return(e.ValueToConvert.ToString().FormatPhoneNumber());
 }
Exemple #19
0
 /// <summary>
 /// Performs the custom value conversion.
 /// </summary>
 /// <param name="e">The <see cref="T:Microsoft.Practices.EnterpriseLibrary.Validation.Integration.ValueConvertEventArgs"/> instance containing the event data.</param>
 public void PerformCustomValueConversion(ValueConvertEventArgs e)
 {
     throw new NotSupportedException("The method or operation is not supported.");
 }
 void IValidationIntegrationProxy.PerformCustomValueConversion(ValueConvertEventArgs e)
 {
     this.validationProvider.PerformCustomValueConversion(e);
 }
 public void PerformCustomValueConversion(ValueConvertEventArgs e)
 {
 }
 void OnValueConvert(object source,
                     ValueConvertEventArgs args)
 {
     valueToConvert = args.ValueToConvert;
     args.ConvertedValue = "converted control text";
 }
Exemple #23
0
        protected void proxyValidatorHoursAndMinutes_ValueConvert(object sender, ValueConvertEventArgs e)
        {
            int value;

            e.ConvertedValue = (int.TryParse(e.ValueToConvert.ToString().Replace("_", ""), out value)) ? value : 0;
        }
 void OnValueConvert(object source,
                     ValueConvertEventArgs e)
 {
     valueConvertEventArgs = e;
     valueConvertEventArgs.ConvertedValue = 500;
 }
Exemple #25
0
        protected void proxyValidatorPrescriptionDrugAssistance_ValueConvert(object sender, ValueConvertEventArgs e)
        {
            var checkBoxListMedicarePrescriptionDrugCoverageTopics = formViewEditClientContact.FindControl("checkBoxListMedicarePrescriptionDrugCoverageTopics") as ShiptalkWebControls.CheckBoxList;
            var checkBoxListPartDLowIncomeSubsidyTopics            = formViewEditClientContact.FindControl("checkBoxListPartDLowIncomeSubsidyTopics") as ShiptalkWebControls.CheckBoxList;
            var checkBoxListOtherPrescriptionAssitanceTopics       = formViewEditClientContact.FindControl("checkBoxListOtherPrescriptionAssitanceTopics") as ShiptalkWebControls.CheckBoxList;
            var checkBoxListMedicarePartsAandBTopics = formViewEditClientContact.FindControl("checkBoxListMedicarePartsAandBTopics") as ShiptalkWebControls.CheckBoxList;
            var checkBoxListMedicareAdvantageTopics  = formViewEditClientContact.FindControl("checkBoxListMedicareAdvantageTopics") as ShiptalkWebControls.CheckBoxList;
            var checkBoxListMedicareSupplementTopics = formViewEditClientContact.FindControl("checkBoxListMedicareSupplementTopics") as ShiptalkWebControls.CheckBoxList;
            var checkBoxListMedicaidTopics           = formViewEditClientContact.FindControl("checkBoxListMedicaidTopics") as ShiptalkWebControls.CheckBoxList;
            var checkBoxListOtherDrugTopics          = formViewEditClientContact.FindControl("checkBoxListOtherDrugTopics") as ShiptalkWebControls.CheckBoxList;

            e.ConvertedValue = checkBoxListMedicarePrescriptionDrugCoverageTopics.SelectedItemCount
                               + checkBoxListPartDLowIncomeSubsidyTopics.SelectedItemCount
                               + checkBoxListOtherPrescriptionAssitanceTopics.SelectedItemCount
                               + checkBoxListMedicarePartsAandBTopics.SelectedItemCount
                               + checkBoxListMedicareAdvantageTopics.SelectedItemCount
                               + checkBoxListMedicareSupplementTopics.SelectedItemCount
                               + checkBoxListMedicaidTopics.SelectedItemCount
                               + checkBoxListOtherDrugTopics.SelectedItemCount;
        }
 internal void PerformCustomValueConversion(ValueConvertEventArgs e)
 {
     if (this.ValueConvert != null)
     {
         this.ValueConvert(this, e);
     }
 }
 void OnValueConvert(object source,
                     ValueConvertEventArgs e)
 {
     e.ConvertedValue = "converted value";
 }
Exemple #28
0
 private void OnValueConvert(object source, ValueConvertEventArgs args)
 {
     this.valueToConvert = args.ValueToConvert;
     args.ConvertedValue = "converted control text";
 }
 void IValidationIntegrationProxy.PerformCustomValueConversion(ValueConvertEventArgs e)
 {
     if (this.ValueConvert != null)
     {
         this.ValueConvert(this, e);
     }
 }
Exemple #30
0
 void IValidationIntegrationProxy.PerformCustomValueConversion(ValueConvertEventArgs e)
 {
     this.validationProvider.PerformCustomValueConversion(e);
 }
 void OnValueConvert(object source,
                     ValueConvertEventArgs e)
 {
     e.ConvertedValue = "converted value";
 }