コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = 17;
         hash = hash * 29 + Symbol.GetHashCode();
         hash = hash * 29 + Exchange.GetHashCode();
         hash = hash * 29 + RegionalBid.GetHashCode();
         hash = hash * 29 + RegionalBidSize.GetHashCode();
         hash = hash * 29 + RegionalBidTime.GetHashCode();
         hash = hash * 29 + RegionalAsk.GetHashCode();
         hash = hash * 29 + RegionalAskSize.GetHashCode();
         hash = hash * 29 + RegionalAskTime.GetHashCode();
         hash = hash * 29 + FractionDisplayCode.GetHashCode();
         hash = hash * 29 + DecimalPrecision.GetHashCode();
         hash = hash * 29 + MarketCenter.GetHashCode();
         return(hash);
     }
 }
コード例 #2
0
        protected override void Execute(CodeActivityContext eContext)
        {
            // Read Variables
            int precision = DecimalPrecision.Get(eContext);

            // Setup
            var             context        = eContext.GetExtension <IWorkflowContext>();
            var             serviceFactory = eContext.GetExtension <IOrganizationServiceFactory>();
            var             service        = serviceFactory.CreateOrganizationService(null);
            ITracingService tracer         = eContext.GetExtension <ITracingService>();


            tracer.Trace("Retrieving User Settings");
            // Read Settings
            var settings = UserSettings.GetUserSettings(service, context.UserId);

            tracer.Trace("User Settings Retrieved");


            tracer.Trace("Retrieving User Setting Attributes");
            var uilang                     = GetEntityValue <int>(tracer, settings, "uilanguageid");
            var currencyPrecision          = GetEntityValue <int>(tracer, settings, "currencydecimalprecision");
            var currencyFormatCode         = GetEntityValue <int>(tracer, settings, "currencyformatcode");
            var currencySymbol             = GetEntityValue <string>(tracer, settings, "currencysymbol");
            var numberGroupFormat          = GetEntityValue <string>(tracer, settings, "numbergroupformat");
            var negativeCurrencyFormatCode = GetEntityValue <int>(tracer, settings, "negativecurrencyformatcode");
            var negativeFormatCode         = GetEntityValue <int>(tracer, settings, "negativeformatcode");
            var decimalSymbol              = GetEntityValue <string>(tracer, settings, "decimalsymbol");
            var numberSeparator            = GetEntityValue <string>(tracer, settings, "numberseparator");
            var businessUnitId             = GetEntityValue <Guid>(tracer, settings, "businessunitid");
            var timeFormatString           = GetEntityValue <string>(tracer, settings, "timeformatstring");
            var dateFormatString           = GetEntityValue <string>(tracer, settings, "dateformatstring");
            var timeZoneCode               = GetEntityValue <int>(tracer, settings, "timezonecode");
            var localeid                   = GetEntityValue <int>(tracer, settings, "localeid");

            // Calculate Fields
            tracer.Trace("Calculating Fields");
            var uiCulture = new CultureInfo(uilang);

            var currencyFormat = NumberFormat.GetFormatString(decimalSymbol, numberSeparator,
                                                              currencyPrecision, numberGroupFormat,
                                                              negativeCurrencyFormatCode, true,
                                                              currencySymbol,
                                                              currencyFormatCode);

            var numberFormat = NumberFormat.GetFormatString(decimalSymbol, numberSeparator,
                                                            precision, numberGroupFormat,
                                                            negativeFormatCode);

            var businessUnit = new EntityReference("businessunit", businessUnitId);

            // Store Results
            tracer.Trace("Storing Results");
            Locale.Set(eContext, localeid);
            BusinessUnit.Set(eContext, businessUnit);
            CurrencySymbol.Set(eContext, currencySymbol);
            CurrencyFormatString.Set(eContext, currencyFormat);
            NumberFormatString.Set(eContext, numberFormat);
            DateFormatString.Set(eContext, dateFormatString);
            TimeFormatString.Set(eContext, timeFormatString);
            TimeZoneCode.Set(eContext, timeZoneCode);
            UILanguageCode.Set(eContext, uilang);
            UILanguageName.Set(eContext, uiCulture.DisplayName);
            UILanguageEnglishName.Set(eContext, uiCulture.EnglishName);
        }