コード例 #1
0
        public string RemoveNumberFormats(string value)
        {
            if (this.ShouldAddMinusSign(value))
            {
                value = this.Culture.NumberFormat.NegativeSign + value;
            }
            value = value.Replace("(", "").Replace(")", "").Replace(" ", "").Replace(" ", "").Replace("/", "").Replace("\\", "").Replace(":", "");
            NumericMaskTextBoxProvider provider = this.provider as NumericMaskTextBoxProvider;

            if (provider != null)
            {
                switch (provider.NumericType)
                {
                case NumericCharacterTextBoxProvider.RadNumericMaskFormatType.Currency:
                    value = value.Replace(this.GetSafe(this.Culture.NumberFormat.CurrencyGroupSeparator), "").Replace(this.GetSafe(this.Culture.NumberFormat.CurrencySymbol), "");
                    break;

                case NumericCharacterTextBoxProvider.RadNumericMaskFormatType.Percent:
                    value = value.Replace(this.GetSafe(this.Culture.NumberFormat.PercentGroupSeparator), "");
                    break;

                default:
                    value = value.Replace(this.GetSafe(this.Culture.NumberFormat.NumberGroupSeparator), "");
                    break;
                }
            }
            return(value);
        }
コード例 #2
0
 public NumericMaskTextBoxProvider(
     string mask,
     CultureInfo culture,
     RadMaskedEditBoxElement owner)
 {
     if (mask.ToLower() == "d")
     {
         mask += "0";
     }
     this.owner       = owner;
     this.numericType = NumericMaskTextBoxProvider.GetFormat(mask, culture);
     this.mask        = mask;
     this.culture     = culture;
     this.provider    = this.CreateNumericCharacterTextBoxProvider(mask, culture, this.numericType, owner);
     this.promptChar  = this.provider.PromptChar;
     this.textBoxItem = owner.TextBoxItem;
 }
コード例 #3
0
        private bool ShouldAddMinusSign(string value)
        {
            if (this.TextMaskFormat != MaskFormat.ExcludePromptAndLiterals && this.TextMaskFormat != MaskFormat.IncludePrompt)
            {
                return(false);
            }
            NumericMaskTextBoxProvider provider = this.provider as NumericMaskTextBoxProvider;

            if (provider == null || provider.NumericType != NumericCharacterTextBoxProvider.RadNumericMaskFormatType.Currency || (value.IndexOf("(") < 0 || value.IndexOf(")") < 0))
            {
                return(false);
            }
            switch (this.Culture.NumberFormat.CurrencyNegativePattern)
            {
            case 0:
            case 4:
            case 14:
            case 15:
                return(true);

            default:
                return(false);
            }
        }