public static void FormatAsCurrency(this ICurrencyControlMixin thiz)
 {
     if (thiz.Amount == 0m)
     {
         thiz.Text = string.Empty;
     }
     else
     {
         thiz.Text = thiz.Amount.ToString(thiz.GetCurrencyFormatString());
     }
 }
 public static void Reparse(this ICurrencyControlMixin thiz)
 {
     if (string.IsNullOrEmpty(thiz.Text))
     {
         thiz.SetInternal(0);
     }
     else
     {
         decimal xx;
         if (decimal.TryParse(thiz.Text, System.Globalization.NumberStyles.Currency,
                              CultureInfo.CurrentCulture, out xx))
         {
             thiz.SetInternal(xx);
         }
         else
         {
             System.Diagnostics.Debug.WriteLine("Wrong input");
         }
     }
 }
 public static string GetCurrencyFormatString(this ICurrencyControlMixin thiz)
 {
     return(string.Format("C{0}", thiz.DecimalPlaces));
 }
 public static string GetDecimalFormatString(this ICurrencyControlMixin thiz)
 {
     return("0." + new string('#', thiz.DecimalPlaces));
 }