void ColorizeTiles(MatchStageInfo stage) { int colorCount = stage.Colors; List <Color> allColors = GameConstants.MatchGameColorList; IExtensions.Shuffle <Color>(allColors); List <Color> colors = new List <Color>(); for (int i = 0; i < colorCount; i++) { colors.Add(allColors[i]); } int curColor = 0; List <Color> tileColors = new List <Color>(); for (int i = 0; i < Tiles.Count / 2; i++) { tileColors.Add(colors[curColor]); tileColors.Add(colors[curColor]); curColor = (curColor + 1) % colorCount; } IExtensions.Shuffle <Color>(tileColors); for (int i = 0; i < Tiles.Count; i++) { Tiles[i].Setup(tileColors[i]); } }
public ParseTableTest() { ExcelPackage.LicenseContext = LicenseContext.NonCommercial; _excelExtensionsProvider = new ExcelExtensions.Providers.Extensions(); _parserProvider = new Parser(); _tableParser = new TableParser <ParseTableTestBaseModel>(_excelExtensionsProvider, _parserProvider); }
public Column(IExtensions _excelExtensions, Type modelType, string modelPropertyName, FormatType format, int columnLetterAsInt, int?decimalPrecision = null) { _excelExtensions.GetExportModelPropertyNameAndDisplayName(modelType, modelPropertyName, out string textTitle); ColumnLetter = _excelExtensions.GetColumnLetter(columnLetterAsInt); ModelProperty = modelPropertyName; HeaderTitle = textTitle; Format = format; DecimalPrecision = decimalPrecision; }
public TableParser(IExtensions excelExtensions, IParser parser) { _excelExtensions = excelExtensions; _parser = parser; _model = Activator.CreateInstance <T>(); _singleRowErrors = new List <KeyValuePair <int, ParseException> >(); _requiredFieldsColumnLocations = new List <string>(); _parseResults = new ParsedTable <T>(); _requiredFieldMissingMessages = new List <ParseException>(); }
public InputViewModel(IExtensions extensions) { if (extensions == null) { throw new ArgumentNullException(nameof(extensions)); } _extensions = extensions; Extensions = new ExtensionCollection(_extensions.DisplayInputFileExtensions); SelectedExtension = Extensions.FirstOrDefault(); }
/// <summary> /// Configure the Jasper HTTP routing /// </summary> /// <param name="extensions"></param> /// <param name="configure"></param> /// <returns></returns> public static void ConfigureHttp(this IExtensions extensions, Action <JasperHttpOptions> configure) { var extension = extensions.GetRegisteredExtension <JasperHttpExtension>(); if (extension == null) { extensions.Include <JasperHttpExtension>(); extension = extensions.GetRegisteredExtension <JasperHttpExtension>(); } configure(extension.Options); }
public SampleProvider(IExtensions excelUtilityProvider, IFileAndSheetValidatior validationProvider, IParser parserProvider, IExporter exporter) { _excelExtensions = excelUtilityProvider; _validatior = validationProvider; _exporter = exporter; _style = new Style() { BackgroundColor = ColorTranslator.FromHtml("#001762") }; _tableParser = new TableParser <SampleTableModel>(_excelExtensions, parserProvider); }
/// <summary> /// Register sql server backed message persistence to a known connection string /// </summary> /// <param name="extensions"></param> /// <param name="connectionString"></param> /// <param name="schema"></param> public static void PersistMessagesWithPostgresql(this IExtensions extensions, string connectionString, string schema = null) { extensions.Include <PostgresqlBackedPersistence>(o => { o.Settings.ConnectionString = connectionString; if (schema.IsNotEmpty()) { o.Settings.SchemaName = schema; } }); }
/// <summary> /// Register sql server backed message persistence to a known connection string /// </summary> /// <param name="settings"></param> /// <param name="connectionString"></param> /// <param name="schema"></param> public static void PersistMessagesWithSqlServer(this IExtensions extensions, string connectionString, string schema = null) { extensions.Include <SqlServerBackedPersistence>(x => { x.Settings.ConnectionString = connectionString; if (schema.IsNotEmpty()) { x.Settings.SchemaName = schema; } }); }
public SearchQueriesViewModel(ISearchService searchService, IExtensions extensions) { if (searchService == null) { throw new ArgumentNullException(nameof(searchService)); } if (extensions == null) { throw new ArgumentNullException(nameof(extensions)); } _searchService = searchService; _extensions = extensions; Queries.CollectionChanged += (sender, args) => { ClearQueriesCommand.RaiseCanExecuteChanged(); RaiseQueriesChanged(); }; }
/// <summary> /// Integrate Marten with this Jasper application. Adds basic Marten IDocumentStore, /// IDocumentSession, IQuerySession, enabling Marten backed Saga persistence, /// and using Postgresql for message durability. This overload allows for customizing /// Marten's StoreOptions /// </summary> /// <param name="options"></param> /// <param name="connectionString"></param> public static void UseMarten(this IExtensions extensions, Action <StoreOptions> configureMarten) { extensions.Include <MartenExtension>(x => configureMarten(x.Options)); }
/// <summary> /// Integrate Marten with this Jasper application. Adds basic Marten IDocumentStore, /// IDocumentSession, IQuerySession, enabling Marten backed Saga persistence, /// and using Postgresql for message durability using default Marten configuration /// </summary> /// <param name="options"></param> /// <param name="connectionString"></param> public static void UseMarten(this IExtensions extensions, string connectionString) { extensions.UseMarten(o => o.Connection(connectionString)); }
/// <summary> /// Add the message tracking support to your application /// for reliable automated testing /// </summary> /// <param name="extensions"></param> public static void UseMessageTrackingTestingSupport(this IExtensions extensions) { extensions.Include <MessageTrackingExtension>(); }
internal static GenerateCardTokenRequest ConvertFrom(Request request, PaymentProperty[] requiredInteractionProperties) { var tokenizeRequest = new GenerateCardTokenRequest(); var errors = new List <PaymentError>(); tokenizeRequest.ReadBaseProperties(request, errors); PaymentProperty[] cardProperties = null; if (requiredInteractionProperties != null) { // Get card data from interaction form IExtensions handler = SDKExtensions.Extension; if (handler != null) { // We have found the implementation for the form Dictionary <string, PaymentProperty> interactionPropertyDictionary = null; if (handler.GetCreditCardDetails(requiredInteractionProperties, out interactionPropertyDictionary)) { cardProperties = interactionPropertyDictionary.Values.ToArray(); } } else { errors.Add(new PaymentError(ErrorCode.UserAborted, "User aborted data entry form.")); } } else { // Get card data from request. cardProperties = request.Properties; } // Read card data tokenizeRequest.OtherCardProperties = new List <PaymentProperty>(); if (cardProperties != null) { Hashtable hashtable = PaymentProperty.ConvertToHashtable(cardProperties); tokenizeRequest.CardType = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.CardType, errors, ErrorCode.InvalidRequest); if (tokenizeRequest.CardType != null && (!PaymentUtilities.ValidateCardType(tokenizeRequest.SupportedTenderTypes, tokenizeRequest.CardType) || tokenizeRequest.CardType.Equals(Microsoft.Dynamics.Retail.PaymentSDK.Portable.CardType.Debit.ToString(), StringComparison.OrdinalIgnoreCase))) { errors.Add(new PaymentError(ErrorCode.CardTypeNotSupported, string.Format("Card type is not supported: {0}.", tokenizeRequest.CardType))); } tokenizeRequest.CardNumber = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.CardNumber, errors, ErrorCode.InvalidCardNumber); if (tokenizeRequest.CardNumber != null && !HelperUtilities.ValidateBankCardNumber(tokenizeRequest.CardNumber)) { errors.Add(new PaymentError(ErrorCode.InvalidCardNumber, "Invalid card number.")); } tokenizeRequest.ExpirationYear = PaymentUtilities.GetPropertyDecimalValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.ExpirationYear, errors, ErrorCode.InvalidExpirationDate); tokenizeRequest.ExpirationMonth = PaymentUtilities.GetPropertyDecimalValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.ExpirationMonth, errors, ErrorCode.InvalidExpirationDate); if (tokenizeRequest.ExpirationYear.HasValue && tokenizeRequest.ExpirationMonth.HasValue && tokenizeRequest.ExpirationYear >= 0M && tokenizeRequest.ExpirationMonth >= 0M && !PaymentUtilities.ValidateExpirationDate(tokenizeRequest.ExpirationYear.Value, tokenizeRequest.ExpirationMonth.Value)) { errors.Add(new PaymentError(ErrorCode.InvalidExpirationDate, "Invalid expiration date.")); } tokenizeRequest.Name = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.Name); tokenizeRequest.StreetAddress = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.StreetAddress); tokenizeRequest.StreetAddress2 = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.StreetAddress2); tokenizeRequest.City = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.City); tokenizeRequest.State = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.State); tokenizeRequest.PostalCode = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.PostalCode); tokenizeRequest.Country = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.Country); tokenizeRequest.Phone = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.Phone); tokenizeRequest.AccountType = PaymentUtilities.GetPropertyStringValue( hashtable, GenericNamespace.PaymentCard, PaymentCardProperties.AccountType); // Add other custom card properties from interaction properties foreach (var cardProperty in cardProperties) { if (GenericNamespace.PaymentCard.Equals(cardProperty.Namespace) && IsCustomCardProperty(cardProperty.Name)) { tokenizeRequest.OtherCardProperties.Add(cardProperty); } } } // Add other custom card properties from request properties foreach (var requestProperty in request.Properties) { if (GenericNamespace.PaymentCard.Equals(requestProperty.Namespace) && !tokenizeRequest.OtherCardProperties.Any(p => p.Name.Equals(requestProperty.Name, StringComparison.OrdinalIgnoreCase)) && IsCustomCardProperty(requestProperty.Name)) { tokenizeRequest.OtherCardProperties.Add(requestProperty); } } if (errors.Count > 0) { throw new SampleException(errors); } return(tokenizeRequest); }
public Exporter(IExtensions excelProvider) { _excelProvider = excelProvider; }
public ImportColumnWithCellAddress(IExtensions excelExtensions, ImportColumnTemplate template) : base(template.Column, template.IsRequired, template.ColumnHeaderOptions) { ColumnNumber = template.Column.ColumnLetter == null ? 0 : excelExtensions.GetColumnNumber(template.Column.ColumnLetter); }
/// <summary> /// Uses Entity Framework Core for Saga persistence and transactional /// middleware /// </summary> /// <param name="extensions"></param> public static void UseEntityFrameworkCorePersistence(this IExtensions extensions) { extensions.Include <EntityFrameworkCoreBackedPersistence>(); }
public ExtensionsTestHooks(ILogTracer log, IConfigOperations configOps, IExtensions extensions) { _log = log.WithTag("TestHooks", nameof(ExtensionsTestHooks)); _configOps = configOps; _extensions = extensions; }