Пример #1
0
        private string DoubleOuptPut()
        {
            string result = string.Empty;

            Int32       decLength   = 0;
            CultureInfo cultureInfo = new CultureInfo(CultureInfo.CurrentCulture.Name);

            NumberFormatInfo numberFormat = cultureInfo.NumberFormat;

            numberFormat.NumberDecimalSeparator = InternalDecimalSepartor;
            numberFormat.NumberGroupSeparator   = InternalGroupSepartor;

            List <string> strformat = InternalFormat.Split(',').ToList();
            List <Int32>  NumberArr = strformat.Select(a => a.Length).ToList();

            NumberArr = NumberArr.AsEnumerable().Reverse().ToList();
            NumberArr.RemoveAt(NumberArr.Count - 1);
            NumberArr.Add(0);
            numberFormat.NumberGroupSizes = NumberArr.ToArray();

            decLength = InternalAfterDecimalCount.Length;

            if (decLength == 0)
            {
                InternalInputValue = Math.Round(InternalInputValue, 0);
            }

            result = InternalInputValue.ToString("N" + decLength, numberFormat);

            return(result);
        }
Пример #2
0
        protected override void Execute(CodeActivityContext context)
        {
            this.SetValues(context);

            if (InternalInputValue != 0)
            {
                Result.Set(context, DoubleOuptPut());
            }
            else
            {
                Result.Set(context, InternalInputValue.ToString());
            }
        }
Пример #3
0
        private string NumberOuptPut()
        {
            CultureInfo      cultureInfo  = new CultureInfo("en-US");
            NumberFormatInfo numberFormat = cultureInfo.NumberFormat;

            numberFormat.NumberGroupSeparator = InternalGroupSepartor;

            List <string> strformat = InternalFormat.Split(',').ToList();
            List <Int32>  NumberArr = strformat.Select(a => a.Length).ToList();

            NumberArr = NumberArr.AsEnumerable().Reverse().ToList();
            NumberArr.RemoveAt(NumberArr.Count - 1);
            NumberArr.Add(0);
            numberFormat.NumberGroupSizes = NumberArr.ToArray();

            return(InternalInputValue.ToString("N0", numberFormat));
        }