public override INode AddNode(INode currentParent, IConverter converter) { //If the current parent is neither the root nor a group if(!(currentParent is IMotherNode)) throw new ArgumentException("Trying to insert an 'AS' node, but the current node's type '" + currentParent.GetType() + "' is illegal. " + CheckString); GroupNode group; //If the current parent is the root if (currentParent is RootNode) { group = (currentParent as IMotherNode).Children.Last() as GroupNode; if (group == null) throw new ArgumentException("Trying to insert an 'AS' node, but no Group found at root nor in its children. " + CheckString); } // The current parent is the group else if (currentParent is GroupNode) group = currentParent as GroupNode; // The group is the last child of the current parent else if ((currentParent as IMotherNode).Children.Last() is GroupNode) group = (currentParent as IMotherNode).Children.Last() as GroupNode; else throw new ArgumentException("Trying to insert an 'AS' node, but the current node is neither a group nor contains a group as children. " + CheckString); if (converter != null && converter.Function != null && converter.Function.Arguments != null && converter.Function.Arguments.Any()) group.Name = converter.Function.Arguments[0].ToString(); return currentParent; }
/// <summary>Initializes a new instance of the <see cref="ArmorConverter"/> class.</summary> /// <param name="converterFactory"></param> /// <param name="weightClassConverter">The converter for <see cref="WeightClass"/>.</param> /// <param name="infusionSlotCollectionConverter">The converter for <see cref="ICollection{InfusionSlot}"/>.</param> /// <param name="infixUpgradeConverter">The converter for <see cref="InfixUpgrade"/>.</param> public ArmorConverter( ITypeConverterFactory<ItemDTO, Armor> converterFactory, IConverter<string, WeightClass> weightClassConverter, IConverter<ICollection<InfusionSlotDTO>, ICollection<InfusionSlot>> infusionSlotCollectionConverter, IConverter<InfixUpgradeDTO, InfixUpgrade> infixUpgradeConverter) : this(converterFactory) { if (weightClassConverter == null) { throw new ArgumentNullException("weightClassConverter"); } if (infusionSlotCollectionConverter == null) { throw new ArgumentNullException("infusionSlotCollectionConverter"); } if (infixUpgradeConverter == null) { throw new ArgumentNullException("infixUpgradeConverter"); } this.weightClassConverter = weightClassConverter; this.infusionSlotCollectionConverter = infusionSlotCollectionConverter; this.infixUpgradeConverter = infixUpgradeConverter; }
/// <summary>Initializes a new instance of the <see cref="WeaponConverter"/> class.</summary> /// <param name="converterFactory"></param> /// <param name="damageTypeConverter"></param> /// <param name="infusionSlotCollectionConverter"></param> /// <param name="infixUpgradeConverter"></param> public WeaponConverter( ITypeConverterFactory<ItemDTO, Weapon> converterFactory, IConverter<string, DamageType> damageTypeConverter, IConverter<ICollection<InfusionSlotDTO>, ICollection<InfusionSlot>> infusionSlotCollectionConverter, IConverter<InfixUpgradeDTO, InfixUpgrade> infixUpgradeConverter) : this(converterFactory) { if (damageTypeConverter == null) { throw new ArgumentNullException("damageTypeConverter"); } if (infixUpgradeConverter == null) { throw new ArgumentNullException("infixUpgradeConverter"); } if (infusionSlotCollectionConverter == null) { throw new ArgumentNullException("infusionSlotCollectionConverter"); } this.damageTypeConverter = damageTypeConverter; this.infixUpgradeConverter = infixUpgradeConverter; this.infusionSlotCollectionConverter = infusionSlotCollectionConverter; }
/// <summary>Initializes a new instance of the <see cref="CompetitiveMapConverter"/> class.</summary> /// <param name="converterFactory"></param> /// <param name="scoreboardConverter">The converter for <see cref="Scoreboard"/>.</param> /// <param name="objectiveConverter">The converter for <see cref="Objective"/>.</param> /// <param name="mapBonusConverter">The converter for <see cref="MapBonus"/>.</param> public CompetitiveMapConverter( ITypeConverterFactory<CompetitiveMapDTO, CompetitiveMap> converterFactory, IConverter<int[], Scoreboard> scoreboardConverter, IConverter<ObjectiveDTO, Objective> objectiveConverter, IConverter<MapBonusDTO, MapBonus> mapBonusConverter) : this(converterFactory) { if (scoreboardConverter == null) { throw new ArgumentNullException("scoreboardConverter"); } if (objectiveConverter == null) { throw new ArgumentNullException("objectiveConverter"); } if (mapBonusConverter == null) { throw new ArgumentNullException("mapBonusConverter"); } this.scoreboardConverter = scoreboardConverter; this.objectiveConverter = objectiveConverter; this.mapBonusConverter = mapBonusConverter; }
/// <summary>Initializes a new instance of the <see cref="BuildService"/> class.</summary> /// <param name="serviceClient">The service client.</param> /// <param name="converterForBuild">The converter for <see cref="Build"/>.</param> internal BuildService(IServiceClient serviceClient, IConverter<BuildDataContract, Build> converterForBuild) { Debug.Assert(serviceClient != null, "serviceClient != null"); Debug.Assert(converterForBuild != null, "converterForBuild != null"); this.serviceClient = serviceClient; this.converterForBuild = converterForBuild; }
public static IEnumerable<ConversionUnit> CreateFrom(IConverter converter) { if (converter == null || converter.Placeholders == null) return ArrayHelper<ConversionUnit>.Empty; else return EnumerateFrom(converter); }
private static void LoadConverter() { if (_converter == null) { _converter = (IConverter)Activator.CreateInstance(ConfigurationManager.Converter.Type); } }
public QuestionsService(IStatRepository<Stat> statRepository, IRepository<Word> wordRepository, IConverter converter) { this.statRepository = statRepository; this.wordRepository = wordRepository; this.converter = converter; }
/// <summary>Initializes a new instance of the <see cref="UpgradeComponentConverter"/> class.</summary> /// <param name="converterFactory"></param> /// <param name="upgradeComponentFlagCollectionConverter">The converter for <see cref="UpgradeComponentFlags"/>.</param> /// <param name="infusionSlotFlagCollectionConverter">The converter for <see cref="ICollection{InfusionSlotFlags}"/>.</param> /// <param name="infixUpgradeConverter">The converter for <see cref="InfixUpgrade"/>.</param> public UpgradeComponentConverter( ITypeConverterFactory<ItemDTO, UpgradeComponent> converterFactory, IConverter<ICollection<string>, UpgradeComponentFlags> upgradeComponentFlagCollectionConverter, IConverter<ICollection<string>, InfusionSlotFlags> infusionSlotFlagCollectionConverter, IConverter<InfixUpgradeDTO, InfixUpgrade> infixUpgradeConverter) : this(converterFactory) { if (upgradeComponentFlagCollectionConverter == null) { throw new ArgumentNullException("upgradeComponentFlagCollectionConverter"); } if (infusionSlotFlagCollectionConverter == null) { throw new ArgumentNullException("infusionSlotFlagCollectionConverter"); } if (infixUpgradeConverter == null) { throw new ArgumentNullException("infixUpgradeConverter"); } this.upgradeComponentFlagCollectionConverter = upgradeComponentFlagCollectionConverter; this.infusionSlotFlagCollectionConverter = infusionSlotFlagCollectionConverter; this.infixUpgradeConverter = infixUpgradeConverter; }
public void Add(IConverter converter) { if (Converter.ContainsKey(converter.Type)) Converter[converter.Type] = converter; else Converter.Add(converter.Type, converter); }
public ScheduleIndexJobs(SourceStorageFactory sourceStorageFactory, IScheduler scheduler) { _sourceStorageFactory = sourceStorageFactory; _scheduler = scheduler; Sources = new IItemSource[] { }; Converters = new IConverter[] { }; }
public LetteraMessageService(IMessaggisticaService messaggisticaService, IConfigurationMessageService configurationService, IConverter converter, IDaoFactory daoFactory) { _messaggisticaService = messaggisticaService; _configurationService = configurationService; _converter = converter; _daoFactory = daoFactory; }
/// <summary>Initializes a new instance of the <see cref="RecipeConverter"/> class.</summary> /// <param name="converterFactory"></param> /// <param name="craftingDisciplineCollectionConverter">The converter for <see cref="CraftingDisciplines"/>.</param> /// <param name="recipeFlagCollectionConverter">The converter for <see cref="RecipeFlags"/>.</param> /// <param name="itemQuantityCollectionConverter">The converter for <see cref="T:ICollection{ItemQuantity}"/>.</param> public RecipeConverter( ITypeConverterFactory<RecipeDTO, Recipe> converterFactory, IConverter<ICollection<string>, CraftingDisciplines> craftingDisciplineCollectionConverter, IConverter<ICollection<string>, RecipeFlags> recipeFlagCollectionConverter, IConverter<ICollection<IngredientDTO>, ICollection<ItemQuantity>> itemQuantityCollectionConverter) : this(converterFactory) { if (craftingDisciplineCollectionConverter == null) { throw new ArgumentNullException("craftingDisciplineCollectionConverter"); } if (recipeFlagCollectionConverter == null) { throw new ArgumentNullException("recipeFlagCollectionConverter"); } if (itemQuantityCollectionConverter == null) { throw new ArgumentNullException("itemQuantityCollectionConverter"); } this.craftingDisciplineCollectionConverter = craftingDisciplineCollectionConverter; this.recipeFlagCollectionConverter = recipeFlagCollectionConverter; this.itemQuantityCollectionConverter = itemQuantityCollectionConverter; }
public static void TestConversion(IConverter converter, string sourceFileName, FileTypes sourceFormat, FileTypes targetFormat, bool assertSuccess) { string sourceFile = Path.GetFullPath(sourceFileName); // Get a temporary target file TempFolder tempFolder = new TempFolder(); string targetFile = tempFolder.getFilePath("target." + targetFormat); // Do the conversion bool converted = converter.Convert(sourceFile, (int)sourceFormat, targetFile, (int)targetFormat); if (assertSuccess) { // Check that converter returned true Assert.IsTrue(converted); // Check that converter created the target file and it's not empty Assert.AreNotEqual(0, new FileInfo(targetFile).Length); } else { // Check that converter returned false Assert.IsFalse(converted); } // Delete the temp folder created tempFolder.Release(); }
/// <summary>Initializes a new instance of the <see cref="ItemConverter"/> class.</summary> /// <param name="converterFactory"></param> /// <param name="itemRarityConverter">The converter for <see cref="ItemRarity"/>.</param> /// <param name="gameTypesConverter">The converter for <see cref="GameTypes"/>.</param> /// <param name="itemFlagsConverter">The converter for <see cref="ItemFlags"/>.</param> /// <param name="itemRestrictionsConverter">The converter for <see cref="ItemRestrictions"/>.</param> public ItemConverter( ITypeConverterFactory<ItemDTO, Item> converterFactory, IConverter<string, ItemRarity> itemRarityConverter, IConverter<ICollection<string>, GameTypes> gameTypesConverter, IConverter<ICollection<string>, ItemFlags> itemFlagsConverter, IConverter<ICollection<string>, ItemRestrictions> itemRestrictionsConverter) : this(converterFactory) { if (itemRarityConverter == null) { throw new ArgumentNullException("itemRarityConverter"); } if (gameTypesConverter == null) { throw new ArgumentNullException("gameTypesConverter"); } if (itemFlagsConverter == null) { throw new ArgumentNullException("itemFlagsConverter"); } if (itemRestrictionsConverter == null) { throw new ArgumentNullException("itemRestrictionsConverter"); } this.itemRarityConverter = itemRarityConverter; this.gameTypesConverter = gameTypesConverter; this.itemFlagsConverter = itemFlagsConverter; this.itemRestrictionsConverter = itemRestrictionsConverter; }
public AzureTableServiceContext(string baseAddress, StorageCredentials credentials, IConverter converter) : base(baseAddress, credentials) { _converter = converter; WritingEntity += OnWritingEntity; ReadingEntity += OnReadingEntity; }
public XmlSettings() { _typeInstantiator = new TypeInstantiator(); _converter = new Converter(_typeInstantiator); _xmlInstantiator = new CustomXmlSerializer(this); _xmlPattern = Xml.XmlPattern.Default; }
public override INode AddNode(INode currentParent, IConverter converter) { INode orNode = new OrNode(converter); //// First element of a chain //if (currentParent is RootNode) // throw new NotImplementedException("Or cannot be the first element"); // Insert at root if (currentParent is RootNode) { var root = (currentParent as RootNode); var firstChild = root.Children.First(); firstChild.Parent = orNode; (orNode as OrNode).Children.Add(firstChild); orNode.Parent = root; root.Children.Remove(firstChild); } // Insert before its parent else if (currentParent.Parent != null && currentParent.Parent as IMotherNode != null) { var grandParent = currentParent.Parent as IMotherNode; grandParent.Children.Remove(currentParent); (orNode as OrNode).Children.Add(currentParent); currentParent = currentParent.Parent; } this.LinkNodeToParent(currentParent, orNode); return orNode; }
/// <inheritdoc /> public ConversionCost GetConversionCost(Type sourceType, Type targetType, IConverter elementConverter) { if (typeof(string).IsAssignableFrom(sourceType)) return elementConverter.GetConversionCost(typeof(XmlDocument), targetType).Add(ConversionCost.Typical); return ConversionCost.Invalid; }
public ArtistPageViewModel( INavigationService navigationService, ILibraryService libraryService, IEnumerable<IMetadataProvider> metadataProviders, IConverter<WebAlbum, Album> webAlbumConverter, IConverter<WebArtist, Artist> webArtistConverter, IConverter<WebSong, Track> webSongConverter, ISettingsUtility settingsUtility) { _navigationService = navigationService; _libraryService = libraryService; _webAlbumConverter = webAlbumConverter; _metadataProviders = metadataProviders.FilterAndSort<IExtendedMetadataProvider>(); _webArtistConverter = webArtistConverter; _webSongConverter = webSongConverter; _settingsUtility = settingsUtility; AlbumClickCommand = new DelegateCommand<ItemClickEventArgs>(AlbumClickExecute); WebAlbumClickCommand = new DelegateCommand<ItemClickEventArgs>(WebAlbumClickExecute); if (IsInDesignMode) { OnNavigatedTo("Childish Gambino", NavigationMode.New, new Dictionary<string, object>()); } }
/// <summary> /// Creates a conversion to string formatting rule. /// </summary> /// <param name="converter">The converter to use.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="converter"/> is null.</exception> public ConvertToStringFormattingRule(IConverter converter) { if (converter == null) throw new ArgumentNullException("converter"); this.converter = converter; }
/// <summary> /// Initializes a new instance of the <see cref="EntityBindingDetail"/> class. /// </summary> /// <param name="entityProperty">The entity property.</param> /// <param name="valueKey">The value key.</param> /// <param name="converter">The converter.</param> /// <param name="bindingType">Type of the binding.</param> public EntityBindingDetail(PropertyInfo entityProperty, string valueKey, IConverter converter, BindingType bindingType) { this.EntityProperty = entityProperty; this.ValueKey = valueKey; this.Converter = converter; this.BindingType = bindingType; }
public ValueNode(IConverter converter) : base(converter) { if (converter.Function != null && converter.Function.Arguments != null) this.Value = converter.Function.Arguments[0].ToString(); else this.Value = ""; }
/// <inheritdoc /> public ConversionCost GetConversionCost(Type sourceType, Type targetType, IConverter elementConverter) { if (typeof(IConvertible).IsAssignableFrom(sourceType) && typeof(IConvertible).IsAssignableFrom(targetType)) return ConversionCost.Typical; return ConversionCost.Invalid; }
/// <summary> /// Creates a new instance of <see cref="ConversionService"/> /// </summary> /// <param name="converters">The converters to register</param> public ConversionService(IEnumerable<IConverter> converters) { if (converters == null) { converters = new IConverter[0]; } _converters = converters.ToArray(); }
/// <summary> /// Creates a new instance of the axis class /// </summary> /// <param name="converter">The converter to use</param> public Axis(IConverter converter) { _valid = true; _path = new Path(converter); _converter = converter; SetPath(_path); }
/// <inheritdoc /> public ConversionCost GetConversionCost(Type sourceType, Type targetType, IConverter elementConverter) { if (typeof(string).IsAssignableFrom(sourceType) && typeof(Enum).IsAssignableFrom(targetType)) return ConversionCost.Best; return ConversionCost.Invalid; }
public Form1() { this.fileSystemAgent = new FileSystemAgent(); this.physicsEquationsProvider = new PhysicsEquationsProvider(); this.converter = new Converter(); this.configuration = new Configuration(); InitializeComponent(); }
public AXAPolicyRiskController(IUnityContainer container, ApplicationModel applicationModel, IRiskService riskService, ISearchServiceHandler searchservicehandler, IUwNameSearchHandler uwNameSearchHandler, IMetadataClientService metadataService, AXARiskModel policyWizardModel, UwPayloadManager payloadManager, UwRetrievalManager retrievalManager, AppModel appModel, IUwViewResolver viewresolver, IEventAggregator eventAggregator, IShellRulesHelper rulesHelper, IConverter<Xiap.Metadata.Data.Enums.StaticValues.ClaimLinkLevel, PolicyAttachmentGroupingLevel> claimLinkLevelPolicyAttachmentLevelConverterParam) : base(applicationModel, riskService, searchservicehandler, uwNameSearchHandler, metadataService, policyWizardModel, payloadManager, retrievalManager, appModel, viewresolver, eventAggregator, rulesHelper, container, claimLinkLevelPolicyAttachmentLevelConverterParam) { this.riskModel = policyWizardModel; this.riskModel.OnUpdateFromGeniusClick += new EventHandler<CommandEventArgs<HeaderDto>>(this.RiskModel_OnUpdateFromGeniusClick); this.riskModel.OnPolicySummaryClick += new EventHandler<CommandEventArgs<HeaderDto>>(this.RiskModel_OnPolicySummaryClick); this._payloadManager = payloadManager; }
public TripController(ITripsRepository LibraryRepository, IConverter convertidorModelos, ITravelerRepository LibraryTravelerRepository) { TripsRepository = LibraryRepository; CustomMapper = convertidorModelos; travelerRepository = LibraryTravelerRepository; }
public PDFService(IConverter converter) { _converter = converter; }
public DoctorController(IDoctorService service, IConverter <Doctor, DoctorDTO> converter) { _service = service; _converter = converter; }
internal static IAccount ToDomain(this AccountModel accountModel, MapperCache mapperCache, IConverter accountingModelConverter) { NullGuard.NotNull(accountModel, nameof(accountModel)) .NotNull(mapperCache, nameof(mapperCache)) .NotNull(accountingModelConverter, nameof(accountingModelConverter)); lock (mapperCache.SyncRoot) { IAccounting accounting = accountingModelConverter.Convert <AccountingModel, IAccounting>(accountModel.Accounting); return(accountModel.ToDomain(accounting, mapperCache, accountingModelConverter)); } }
public PdfController(IConverter pdfConverter) { _pdfConverter = pdfConverter; }
public FileHandler(ILogger logger, IConverter converter) { this.logger = logger; this.converter = converter; }
public AsyncOneTimeBinding(TSource source, Func <TSource, TSourceProperty> sourceGetter, TTarget target, Func <TTarget, TTargetProperty> targetGetter, Action <TTarget, TTargetProperty> targetSetter, IConverter <TSourceProperty, Task <TTargetProperty> > asyncConverter, TTargetProperty loadingValue) : base(source, sourceGetter, null, target, targetGetter, targetSetter, null) { this.asyncConverter = asyncConverter; this.loadingValue = loadingValue; this.Update(); // Affect initial source value to target on binding }
public ContactGroupModelHandler(RepositoryContext dbContext, IConverter modelConverter) : base(dbContext, modelConverter) { }
/// <summary> /// Initializes a new instance of the <see cref="ConverterProcessor"/> class. /// </summary> /// <param name="converter">The converter.</param> /// <remarks></remarks> public ConverterProcessor(IConverter converter) { _converter = converter; }
static void Main(string[] args) { // Get infos from assembly assembly = Assembly.GetExecutingAssembly(); prgName = assembly.GetName().Name; // locales management string locale = ConfigurationManager.AppSettings["locale"]; if (string.IsNullOrWhiteSpace(locale)) { catalog = new Catalog(prgName, "./locale"); } else { catalog = new Catalog(prgName, "./locale", new CultureInfo(locale)); } // status vars string outputfile = String.Empty; string mode = ""; nobanner = false; // GNU Getopt options LongOpt[] longopts = new LongOpt[6]; longopts[0] = new LongOpt("help", Argument.No, null, 'h'); longopts[1] = new LongOpt("nobanner", Argument.No, null, 1000); longopts[2] = new LongOpt("output_file", Argument.Required, new StringBuilder(), 'o'); longopts[3] = new LongOpt("text", Argument.No, null, 1001); longopts[4] = new LongOpt("markers", Argument.No, null, 1002); longopts[5] = new LongOpt("flyto", Argument.No, null, 1003); Getopt options = new Getopt(prgName, args, "ho:", longopts); int c; while ((c = options.getopt()) != -1) { switch (c) { case 'h': PrintHelp(); Environment.Exit(0); break; case ':': Console.Error.WriteLine(catalog.GetString("Doh! You need an argument for option '{0}'", (char)options.getopt())); Environment.Exit(1); break; case '?': Console.Error.WriteLine(catalog.GetString("The option '{0}' is not valid", options.Argv[options.Optind - 1])); Environment.Exit(1); break; case 'o': outputfile = options.Optarg; break; case 1000: nobanner = true; break; case 1001: mode = ""; break; case 1002: mode = "MKR"; break; case 1003: mode = "FLYTO"; break; } } // checks if inputfile is specified if (options.Argv.Length <= options.Optind) { Console.Error.WriteLine(catalog.GetString("No input file specified.")); Environment.Exit(2); } PrintBanner(); // Converter init MSTSConverterFactory factory = new MSTSConverterFactory(); IConverter conv = factory.GetConverter(mode); string ret = conv.FileHeader(); // scan for files for (int i = options.Optind; i < options.Argv.Length; i++) { string inputfile = options.Argv[i]; if (File.Exists(inputfile)) { conv.SetKml(inputfile); ret += conv.PlacemarkBody(); ret += conv.PathBody(); ret += conv.PolyBody(); } else { Console.Error.WriteLine(catalog.GetString("File '{0}' not found: ignoring.", inputfile)); } } conv.FileOut(ret, outputfile); }
public SimplexWarp(IConverter converter) : base(converter) { }
public AggregatorCell(IApiClient apiClient, string[] paymentTypes, IConverter converter) { ApiClient = apiClient; PaymentTypes = paymentTypes; Converter = converter; }
public StatusCodeResultVariable(IOutVariable statusCode, IConverter <IActionResult> converter = null) : base(converter) { StatusCode = statusCode; }
public bool HasSameTypes(IConverter other) => (this.Source == other.Source && this.Target == other.Target);
public ConvertController(IConverter converter) { _converter = converter; }
public BuilderConfigurationSourceTargetExpressionEntry(LambdaExpression sourceExpression, LambdaExpression targetExpression, IConverter converter, MapType mapType) : base(mapType, sourceExpression.Parameters[0].Type, targetExpression.Parameters[0].Type, sourceExpression.Parameters.Count > 1) { SourceExpression = sourceExpression; TargetExpression = targetExpression; Converter = converter; }
public ConvertConfiguration AddConverter(IConverter converter) { _converters.Insert(0, converter); return(this); }
public EmphasizedTokenConverter(IConverter converter) : base(converter, "em") { }
private static Delegate CreateMappingAction(LambdaExpression source, LambdaExpression target, IConverter converter) { var hasDependency = source.Parameters.Count > 1; var pSource = Expression.Parameter(source.Parameters[0].Type, "source"); var pDependencies = hasDependency ? Expression.Parameter(source.Parameters[1].Type, "dependencies") : null; var body = source.Body; body = Replace(body, source.Parameters[0], pSource); if (hasDependency) { body = Replace(body, source.Parameters[1], pDependencies); } if (converter != null) { var converterConstant = Expression.Constant(converter); var converterType = typeof(IConverter <,>).MakeGenericType(body.Type, target.Body.Type); body = Expression.Call(converterConstant, converterType.GetMethod("Convert"), body); } var pTarget = Expression.Parameter(target.Parameters[0].Type, "target"); var targetProperty = target.Body; targetProperty = Replace(targetProperty, target.Parameters[0], pTarget); var setter = Expression.Assign(targetProperty, body); var lamda = hasDependency ? Expression.Lambda(setter, pSource, pTarget, pDependencies) : Expression.Lambda(setter, pSource, pTarget); return(lamda.Compile()); }
public PdfFromHtmlConverter(IConverter converter) { _converter = converter; }
public JsonHandling(IConverter converter) { _converter = converter; }
public AnimationConverter(IConverter converter) { this.converter = converter; }
internal static IAccount ToDomain(this AccountModel accountModel, IAccounting accounting, MapperCache mapperCache, IConverter accountingModelConverter) { NullGuard.NotNull(accountModel, nameof(accountModel)) .NotNull(accounting, nameof(accounting)) .NotNull(mapperCache, nameof(mapperCache)) .NotNull(accountingModelConverter, nameof(accountingModelConverter)); lock (mapperCache.SyncRoot) { IAccount account = accountModel.Resolve(mapperCache.AccountDictionary); if (account != null) { return(account); } IAccountGroup accountGroup = accountingModelConverter.Convert <AccountGroupModel, IAccountGroup>(accountModel.AccountGroup); account = new Account(accounting, accountModel.AccountNumber, accountModel.BasicAccount.AccountName, accountGroup) { Description = accountModel.BasicAccount.Description, Note = accountModel.BasicAccount.Note }; accountModel.CopyAuditInformationTo(account); account.SetDeletable(accountModel.Deletable); mapperCache.AccountDictionary.Add(accountModel.AccountIdentifier, account); accounting.AccountCollection.Add(account); if (accountModel.CreditInfos != null) { account.CreditInfoCollection.Populate(account, accountModel.CreditInfos .Where(creditInfoModel => creditInfoModel.Convertible() && (creditInfoModel.YearMonth.Year < accountModel.StatusDateForInfos.Year || creditInfoModel.YearMonth.Year == accountModel.StatusDateForInfos.Year && creditInfoModel.YearMonth.Month <= accountModel.StatusDateForInfos.Month)) .Select(creditInfoModel => creditInfoModel.ToDomain(account)) .ToArray(), accountModel.StatusDate, accountModel.StatusDateForInfos); } if (accountModel.PostingLines != null) { account.PostingLineCollection.Add(accountModel.PostingLines .Where(postingLineModel => postingLineModel.Convertible() && postingLineModel.PostingDate >= accountModel.GetFromDateForPostingLines() && postingLineModel.PostingDate < accountModel.GetToDateForPostingLines(1)) .Select(postingLineModel => postingLineModel.ToDomain(accounting, account, mapperCache, accountingModelConverter)) .Where(postingLine => account.PostingLineCollection.Contains(postingLine) == false) .ToArray()); } return(account); } }
public static Binder <TSource, UISegmentedControl> Titles <TSource, TPropertyType>(this Binder <TSource, UISegmentedControl> binder, Expression <Func <TSource, TPropertyType> > property, IConverter <TPropertyType, string[]> converter = null) where TSource : class { return(binder.Property(property, b => { var list = new string[b.NumberOfSegments]; for (int i = 0; i < b.NumberOfSegments; i++) { list[i] = b.TitleAt(i); } return list; }, (b, v) => { if (v == null) { b.RemoveAllSegments(); } else if (b.NumberOfSegments != v.Length) { b.RemoveAllSegments(); for (int i = 0; i < v.Length; i++) { b.InsertSegment(v[i], i, false); } } else { for (int i = 0; i < v.Length; i++) { b.SetTitle(v[i], i); } } }, converter)); }
public UsersController(IZwajRepository repo, IMapper mapper, IOptions <StripeSettings> stripeSettings, IConverter converter) { _converter = converter; _stripeSettings = stripeSettings; _mapper = mapper; _repo = repo; }
public SearchListResponseToItemSet(IConverter <SearchResult, Item> converter) { _converter = converter; }
public MazeToCharConverter(IConverter <IMaze, IModelBase[, ]> modelToArrComverter) { _modelToArrComverter = modelToArrComverter; }
public StringCalculatorFacts() { addOperator = new AddOperator(); converter = new Converter(); testee = new StringCalculator(addOperator, converter); }
protected AlgorithmContainer(Func <IConfiguaration, IAlgorithm> creator, IConverter converter) { Creator = creator; Converter = converter; }
public PostConverter(ILoggerRepository loggerRepository, UserManager <ApplicationUser> userManager, IConverter <Comment, CommentDto> converter) { _loggerRepository = loggerRepository; _userManager = userManager; _converter = converter; }
/// <summary> /// Searches for a corresponding Builder for the desired function /// </summary> /// <returns>If no builder is found, a "concat" builder is returned by default</returns> private IBuilder GetAdequateBuilder(IConverter converter) { foreach (var builder in this.SpecializedBuilders.Where(builder => builder.CanHandle(converter))) return builder; return new ConcatBuilder(); }