Example #1
0
        public object Convert(object @in)
        {
            var casted    = (IEnumerable <IModel2>)@in;
            var converted = CollectionConverter.Convert <IModel2, Model2>(casted);

            return(converted);
        }
Example #2
0
 public IList <int> GetWaiterList()
 {
     lock (this.waiterIDList)
     {
         return(CollectionConverter.CopyAllToList <int>(this.waiterIDList));
     }
 }
Example #3
0
 public IList <TGroupKey> GetGroupsCopy()
 {
     lock (this.locker)
     {
         return(CollectionConverter.CopyAllToList <TGroupKey>(this.groupDictionary.Keys));
     }
 }
 public IList <T2> GetAllT2ListCopy()
 {
     using (this.smartRWLocker.Lock(AccessMode.Read))
     {
         return((IList <T2>)CollectionConverter.CopyAllToList <T2>(this.reversedDictionary.Keys));
     }
 }
Example #5
0
 public List <TObject> GetAll()
 {
     lock (this.Locker)
     {
         return(CollectionConverter.CopyAllToList <TObject>(this.objectDictionary.Values));
     }
 }
Example #6
0
 public IList <Tkey> GetAllKeyListCopy()
 {
     lock (this.locker)
     {
         return(CollectionConverter.CopyAllToList <Tkey>(this.ditionary.Keys));
     }
 }
 public IList <T1> GetAllT1ListCopy()
 {
     using (this.smartRWLocker.Lock(AccessMode.Read))
     {
         return(CollectionConverter.CopyAllToList <T1>(this.dictionary.Keys));
     }
 }
 private void Find()
 {
     Streets = new ObservableCollection <object>(CollectionConverter <v_street> .ConvertToObjectList(_executor.GetStreets(
                                                                                                         (SelectedIdCountry != null ? (int)SelectedIdCountry : -1),
                                                                                                         (SelectedIdCity != null ? (int)SelectedIdCity : -1),
                                                                                                         StreetName)));
 }
 public IList <T2> GetAllT2ListCopy()
 {
     lock (this.locker)
     {
         return(CollectionConverter.CopyAllToList <T2>(this.reversedDictionary.Keys));
     }
 }
Example #10
0
    private void AddNode(CollectionConverter <Node> nodes, TreeNode parent = null)
    {
        foreach (Node nodeToUpdateOrAdd in nodes)
        {
            TreeNode nodeFound;
            if (Treeview_NodesAndServers.TreeNodes.ContainsKey(nodeToUpdateOrAdd.NodeID))
            {
                nodeFound      = Treeview_NodesAndServers.TreeNodes[nodeToUpdateOrAdd.NodeID];
                nodeFound.Text = nodeToUpdateOrAdd.NodeName;
            }
            else
            {
                nodeFound = parent == null?Treeview_NodesAndServers.Nodes.Add(nodeToUpdateOrAdd.NodeID, nodeToUpdateOrAdd.NodeName, 0, 0) : parent.Nodes.Add(nodeToUpdateOrAdd.NodeID, nodeToUpdateOrAdd.NodeName, 0, 0);
            }
            if (_firstLoad && Settings.Values.SaveCheckedNodes && nodeToUpdateOrAdd.Checked)
            {
                nodeFound.Checked = true;
            }
            if (_firstLoad && Settings.Values.SaveExpandedNodes && nodeToUpdateOrAdd.Expanded)
            {
                nodeFound.Expand();
            }

            AddNode(nodeToUpdateOrAdd.NodeList, nodeFound);
            AddServers(nodeToUpdateOrAdd.ServerList, nodeFound);
        }
    }
Example #11
0
        public virtual void Initialize()
        {
            TVal         rootVal = this.agileNodePicker.PickupRoot();
            IList <TVal> members = CollectionConverter.CopyAllToList <TVal>(this.agileNodePicker.RetrieveAll().Values);

            base.Initialize(rootVal, members);
        }
Example #12
0
 public IList <TObject> GetAll()
 {
     this.lastReadTime = DateTime.Now;
     return(CollectionConverter.ConvertAll <CachePackage <TKey, TObject>, TObject>(this.dictionary.Values, delegate(CachePackage <TKey, TObject> package) {
         return package.Target;
     }));
 }
Example #13
0
        private void ResetFilters()
        {
            SelectedIdContract = null;

            MinValueDepositPayed              = _eF.GetMinDepositPayed();
            MinValueContractTotalPrice        = _eF.GetMinContractTotalPrice();
            MinValueContractTotalPriceInclVAT = _eF.GetMinContractTotalPriceInclVAT();
            MinValueDateOfConclusionContract  = _eF.GetMinDateOfConclusionContract();
            MaxValueDepositPayed              = _eF.GetMaxDepositPayed();
            MaxValueContractTotalPrice        = _eF.GetMaxContractTotalPrice();
            MaxValueContractTotalPriceInclVAT = _eF.GetMaxContractTotalPriceInclVAT();
            MaxValueDateOfConclusionContract  = _eF.GetMaxDateOfConclusionContract();

            BeginValueDepositPayed              = MinValueDepositPayed;
            BeginValueContractTotalPrice        = MinValueContractTotalPrice;
            BeginValueContractTotalPriceInclVAT = MinValueContractTotalPriceInclVAT;
            BeginValueDateOfConclusionContract  = MinValueDateOfConclusionContract;
            EndValueDepositPayed              = MaxValueDepositPayed;
            EndValueContractTotalPrice        = MaxValueContractTotalPrice;
            EndValueContractTotalPriceInclVAT = MaxValueContractTotalPriceInclVAT;
            EndValueDateOfConclusionContract  = MaxValueDateOfConclusionContract;

            ProductionProcess = CollectionConverter <String> .ConvertToObservableCollection(_eF.GetProductionProcess());

            ListSelectedProductionProcess.Clear();

            Searching();
        }
Example #14
0
 public IList <TObject> GetAllObjectsCopy()
 {
     lock (this.locker)
     {
         return((IList <TObject>)CollectionConverter.CopyAllToList <TObject>(this.objectDictionary.Values));
     }
 }
 private void Find()
 {
     Organizations = new ObservableCollection <object>(CollectionConverter <v_organization> .ConvertToObjectList(_executor.GetOrganizations(
                                                                                                                     (SelectedIdIndustry != null ? (int)SelectedIdIndustry : -1),
                                                                                                                     (SelectedIdSubIndustry != null ? (int)SelectedIdSubIndustry : -1),
                                                                                                                     OrganizationName)));
 }
Example #16
0
 public List <TPKey> GetKeyList()
 {
     lock (this.Locker)
     {
         return(CollectionConverter.CopyAllToList <TPKey>(this.objectDictionary.Keys));
     }
 }
Example #17
0
        public object Convert(object @in)
        {
            IEnumerable <Model2>  casted    = (Model2[])@in;
            IEnumerable <IModel2> converted = CollectionConverter.Convert <Model2, IModel2>(casted);

            return(converted);
        }
Example #18
0
 public IList <T> GetListCopy()
 {
     lock (this.locker)
     {
         return(CollectionConverter.CopyAllToList <T>(this.innerList));
     }
 }
Example #19
0
        /// <summary>
        /// Additional processing required for client deserialization, responsible for parsing the <see cref="Document.Included" /> property. When a relationship
        /// value is parsed, it goes through the included list to set its attributes and relationships.
        /// </summary>
        /// <param name="resource">
        /// The resource that was constructed from the document's body.
        /// </param>
        /// <param name="field">
        /// The metadata for the exposed field.
        /// </param>
        /// <param name="data">
        /// Relationship data for <paramref name="resource" />. Is null when <paramref name="field" /> is not a <see cref="RelationshipAttribute" />.
        /// </param>
        protected override void AfterProcessField(IIdentifiable resource, ResourceFieldAttribute field, RelationshipEntry data = null)
        {
            ArgumentGuard.NotNull(resource, nameof(resource));
            ArgumentGuard.NotNull(field, nameof(field));

            // Client deserializers do not need additional processing for attributes.
            if (field is AttrAttribute)
            {
                return;
            }

            // if the included property is empty or absent, there is no additional data to be parsed.
            if (Document.Included.IsNullOrEmpty())
            {
                return;
            }

            if (data != null)
            {
                if (field is HasOneAttribute hasOneAttr)
                {
                    // add attributes and relationships of a parsed HasOne relationship
                    ResourceIdentifierObject rio = data.SingleData;
                    hasOneAttr.SetValue(resource, rio == null ? null : ParseIncludedRelationship(rio));
                }
                else if (field is HasManyAttribute hasManyAttr)
                {
                    // add attributes and relationships of a parsed HasMany relationship
                    IEnumerable <IIdentifiable> items = data.ManyData.Select(ParseIncludedRelationship);
                    IEnumerable values = CollectionConverter.CopyToTypedCollection(items, hasManyAttr.Property.PropertyType);
                    hasManyAttr.SetValue(resource, values);
                }
            }
        }
Example #20
0
        private void ResetFilters()
        {
            SelectedIdUser = null;
            FilterText     = "";
            RoleName       = "";

            MinValueDateOfLastChangePassword = _eF.GetMinDateOfLastChangePassword();
            MinValueDateOfRegistration       = _eF.GetMinDateOfRegistration();
            MinValueWasOnline = _eF.GetMinWasOnline();
            MaxValueDateOfLastChangePassword = _eF.GetMaxDateOfLastChangePassword();
            MaxValueDateOfRegistration       = _eF.GetMaxDateOfRegistration();
            MaxValueWasOnline = _eF.GetMaxWasOnline();

            BeginValueDateOfLastChangePassword = MinValueDateOfLastChangePassword;
            BeginValueDateOfRegistration       = MinValueDateOfRegistration;
            BeginValueWasOnline = MinValueWasOnline;

            EndValueDateOfLastChangePassword = MaxValueDateOfLastChangePassword;
            EndValueDateOfRegistration       = MaxValueDateOfRegistration;
            EndValueWasOnline = MaxValueWasOnline;

            Roles = CollectionConverter <Role> .ConvertToObservableCollection(_eF.GetRoles());

            Searching();
        }
Example #21
0
        public IConverter <ItemDTO, Item> Create(string discriminator)
        {
            var infusionSlotFlagCollectionConverter = new InfusionSlotFlagCollectionConverter(new InfusionSlotFlagConverter());
            var infusionSlotCollectionConverter     = new CollectionConverter <InfusionSlotDTO, InfusionSlot>(new InfusionSlotConverter(infusionSlotFlagCollectionConverter));
            var combatAttributeCollectionConverter  = new CollectionConverter <AttributeDTO, CombatAttribute>(new CombatAttributeConverter(new CombatAttributeConverterFactory()));
            var infixUpgradeConverter = new InfixUpgradeConverter(combatAttributeCollectionConverter, new CombatBuffConverter());

            switch (discriminator)
            {
            case "Armor":
                return(new ArmorConverter(new ArmorConverterFactory(), new WeightClassConverter(), infusionSlotCollectionConverter, infixUpgradeConverter));

            case "Back":
                return(new BackpackConverter(infusionSlotCollectionConverter, infixUpgradeConverter));

            case "Bag":
                return(new BagConverter());

            case "Consumable":
                return(new ConsumableConverter(new ConsumableConverterFactory(new UnlockerConverterFactory())));

            case "Container":
                return(new ContainerConverter(new ContainerConverterFactory()));

            case "CraftingMaterial":
                return(new CraftingMaterialConverter());

            case "Gathering":
                return(new GatheringToolConverter(new GatheringToolConverterFactory()));

            case "Gizmo":
                return(new GizmoConverter(new GizmoConverterFactory()));

            case "MiniPet":
                return(new MiniatureConverter());

            case "Tool":
                return(new ToolConverter(new ToolConverterFactory()));

            case "Trait":
                return(new TraitGuideConverter());

            case "Trinket":
                return(new TrinketConverter(new TrinketConverterFactory(), infusionSlotCollectionConverter, infixUpgradeConverter));

            case "Trophy":
                return(new TrophyConverter());

            case "UpgradeComponent":
                return(new UpgradeComponentConverter(new UpgradeComponentConverterFactory(), new UpgradeComponentFlagCollectionConverter(new UpgradeComponentFlagConverter()), infusionSlotFlagCollectionConverter, infixUpgradeConverter));

            case "Weapon":
                return(new WeaponConverter(new WeaponConverterFactory(), new DamageTypeConverter(), infusionSlotCollectionConverter, infixUpgradeConverter));

            default:
                Debug.Assert(false, "Unknown type discriminator: " + discriminator);
                return(new UnknownItemConverter());
            }
        }
Example #22
0
 private void Searching()
 {
     Contracts = CollectionConverter <v_contract> .ConvertToObservableCollection(_eF.GetContracts(ListSelectedProductionProcess.ToList(),
                                                                                                  new Range <DateTime>(BeginValueDateOfConclusionContract, EndValueDateOfConclusionContract),
                                                                                                  new Range <int>(BeginValueDepositPayed, EndValueDepositPayed),
                                                                                                  new Range <int>(BeginValueContractTotalPrice, EndValueContractTotalPrice),
                                                                                                  new Range <int>(BeginValueContractTotalPriceInclVAT, EndValueContractTotalPriceInclVAT)));
 }
Example #23
0
 private void Searching()
 {
     Users = CollectionConverter <v_user> .ConvertToObservableCollection(_eF.GetUsers(FilterText,
                                                                                      RoleName,
                                                                                      new Range <DateTime>(BeginValueDateOfRegistration.Date, EndValueDateOfRegistration.AddHours(23).AddMinutes(59).AddSeconds(59)),
                                                                                      new Range <DateTime>(BeginValueDateOfLastChangePassword.Date, EndValueDateOfLastChangePassword.AddHours(23).AddMinutes(59).AddSeconds(59)),
                                                                                      new Range <DateTime>(BeginValueWasOnline.Date, EndValueWasOnline.Date.AddHours(23).AddMinutes(59).AddSeconds(59))));
 }
Example #24
0
 public IFacadeUpdateResult <CollectionData> SaveCollection(CollectionDto instance)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CMSDataStoreKey))
     {
         CollectionFacade facade = new CollectionFacade(uow);
         IFacadeUpdateResult <CollectionData> result = facade.SaveCollection(CollectionConverter.ConvertToData(instance));
         return(result);
     }
 }
Example #25
0
 private void Find()
 {
     MyRequests = new ObservableCollection <object>(CollectionConverter <v_request> .ConvertToObjectList(_executor.GetMyRequests(_config.IdUser,
                                                                                                                                 (SelectedIdProfessionCategory != null ? (int)SelectedIdProfessionCategory : -1),
                                                                                                                                 (SelectedIdProfession != null ? (int)SelectedIdProfession : -1),
                                                                                                                                 (SelectedIdRequestStatus != null ? (int)SelectedIdRequestStatus : -1),
                                                                                                                                 ProfessionName,
                                                                                                                                 new Model.Logic.Range <DateTime>(BeginValueDateOfRegistration, EndValueDateOfRegistration))));
 }
 private void Find()
 {
     Requests = new ObservableCollection <object>(CollectionConverter <v_request> .ConvertToObjectList(_executor.GetRequests(
                                                                                                           (SelectedIdRequestStatus != null ? (int)SelectedIdRequestStatus : -1),
                                                                                                           ProfessionName,
                                                                                                           new Model.Logic.Range <DateTime>(BeginValueDateOfRegistration, EndValueDateOfRegistration),
                                                                                                           BeginValueDateOfConsideration,
                                                                                                           EndValueDateOfConsideration)));
 }
        /// <summary>
        /// Extends ConvertTo so that methods that return a specific type object given a Type parameter can be
        /// used as generic method and casting is not required.
        /// <example>
        /// collectionconverter.ConvertTo&lt;int&gt;(context, culture, value);
        /// </example>
        /// </summary>
        public static T ConvertTo <T>(this CollectionConverter collectionconverter, ITypeDescriptorContext context, System.Globalization.CultureInfo culture, Object value)
        {
            if (collectionconverter == null)
            {
                throw new ArgumentNullException("collectionconverter");
            }

            return((T)collectionconverter.ConvertTo(context, culture, value, typeof(T)));
        }
        /// <summary>
        /// Extends ConvertTo so that methods that return a specific type object given a Type parameter can be
        /// used as generic method and casting is not required.
        /// <example>
        /// typeconverter.ConvertTo&lt;int&gt;(value);
        /// </example>
        /// </summary>
        public static T ConvertTo <T>(this CollectionConverter typeconverter, Object value)
        {
            if (typeconverter == null)
            {
                throw new ArgumentNullException("typeconverter");
            }

            return((T)typeconverter.ConvertTo(value, typeof(T)));
        }
 /// <summary>Creates an instance for the default language.</summary>
 /// <returns>A repository.</returns>
 public IRecipeRepository ForDefaultCulture()
 {
     var recipeCollectionConverter = new RecipeCollectionConverter();
     var recipeConverterFactory = new RecipeConverterFactory();
     var craftingDisciplineCollectionConverter = new CraftingDisciplineCollectionConverter(new CraftingDisciplineConverter());
     var recipeFlagCollectionConverter = new RecipeFlagCollectionConverter(new RecipeFlagConverter());
     var quantityCollectionConverter = new CollectionConverter<IngredientDTO, ItemQuantity>(new ItemQuantityConverter());
     var recipeConverter = new RecipeConverter(recipeConverterFactory, craftingDisciplineCollectionConverter, recipeFlagCollectionConverter, quantityCollectionConverter);
     return new RecipeRepository(this.serviceClient, recipeCollectionConverter, recipeConverter);
 }
Example #30
0
 private void Find()
 {
     Contracts = new ObservableCollection <object>(CollectionConverter <v_contract> .ConvertToObjectList(_executor.GetContractsForEmployer(
                                                                                                             _config.IdUser,
                                                                                                             ApplicantFullName,
                                                                                                             new Model.Logic.Range <DateTime>(BeginValueDateOfConclusion, EndValueDateOfConclusion),
                                                                                                             BeginValueBreakDate,
                                                                                                             EndValueBreakDate,
                                                                                                             BeginValueSalary,
                                                                                                             EndValueSalary)));
 }
        /// <summary>
        /// GetEnumValueByTag 根据描述Tag获取对应的枚举值
        /// </summary>
        public static object GetEnumValueByTag(Type enumType, object tag)
        {
            IList <EnumDescription> list = EnumDescription.DoGetFieldTexts(enumType);

            if (list == null)
            {
                return(null);
            }

            return(CollectionConverter.ConvertFirstSpecification <EnumDescription, object>(list, delegate(EnumDescription des) { return des.enumValue; }, delegate(EnumDescription des) { return des.tag.ToString() == tag.ToString(); }));
        }
 /// <summary>Creates an instance for the default language.</summary>
 /// <param name="continentId">The continent identifier.</param>
 /// <returns>A repository.</returns>
 public IFloorRepository ForDefaultCulture(int continentId)
 {
     var pointOfInterestConverterFactory = new PointOfInterestConverterFactory();
     var vector2DConverter = new Vector2DConverter();
     var rectangleConverter = new RectangleConverter(vector2DConverter);
     var pointOfInterestConverter = new PointOfInterestConverter(pointOfInterestConverterFactory, vector2DConverter);
     var pointOfInterestCollectionConverter = new CollectionConverter<PointOfInterestDTO, PointOfInterest>(pointOfInterestConverter);
     var renownTaskConverter = new RenownTaskConverter(vector2DConverter);
     var renownTaskCollectionConverter = new CollectionConverter<RenownTaskDTO, RenownTask>(renownTaskConverter);
     var skillChallengeConverter = new SkillChallengeConverter(vector2DConverter);
     var skillChallengeCollectionConverter = new CollectionConverter<SkillChallengeDTO, SkillChallenge>(skillChallengeConverter);
     var outputConverter = new SectorConverter(vector2DConverter);
     var sectorCollectionConverter = new CollectionConverter<SectorDTO, Sector>(outputConverter);
     var subregionConverter = new SubregionConverter(rectangleConverter, pointOfInterestCollectionConverter, renownTaskCollectionConverter, skillChallengeCollectionConverter, sectorCollectionConverter);
     var keyValuePairConverter = new SubregionKeyValuePairConverter(subregionConverter);
     var subregionKeyValuePairConverter = new DictionaryConverter<string, SubregionDTO, int, Subregion>(keyValuePairConverter);
     var regionConverter = new RegionConverter(vector2DConverter, subregionKeyValuePairConverter);
     var regionKeyValuePairConverter = new RegionKeyValuePairConverter(regionConverter);
     var regionCollectionConverter = new DictionaryConverter<string, RegionDTO, int, Region>(regionKeyValuePairConverter);
     var size2DConverter = new Size2DConverter();
     var floorConverter = new FloorConverter(size2DConverter, rectangleConverter, regionCollectionConverter);
     return new FloorRepository(continentId, this.serviceClient, floorConverter);
 }