예제 #1
0
        internal void SelectResult(Collection <TActionComponent> gadgets, Dictionary <Guid, Collection <Guid> > idcontents)
        {
            gadgets.ThrowNull();
            idcontents.ThrowNull();

            GadgetResultDictionary.Clear();
            idcontents.Clear();

            foreach (var component in gadgets)
            {
                var gadget = component.Models.GadgetResultModel;

                GadgetResultDictionary.Add(gadget.Id, gadget);
            }

            foreach (var item in GadgetResultDictionary)
            {
                var gadget = item.Value;

                var idList = new Collection <Guid> ();
                gadget.RequestContent(idList);

                if (gadget.HasRegistration)
                {
                    idList.Add(gadget.RegistrationId);
                }

                idcontents.Add(gadget.Id, idList);
            }
        }
예제 #2
0
        internal void SelectMany(Guid id, Dictionary <Guid, Collection <TActionComponent> > gadgetDictionary)
        {
            if (id.NotEmpty() && gadgetDictionary.NotNull())
            {
                GadgetMaterialDictionary.Clear();

                if (GadgetResultDictionary.ContainsKey(id))
                {
                    var gadgetResult = GadgetResultDictionary [id];

                    var gadgetRegistrationList = new Collection <GadgetRegistration> ();
                    var gadgetTestList         = new Collection <GadgetTest> ();

                    foreach (var item in gadgetDictionary)
                    {
                        var gadgetId   = item.Key;
                        var components = item.Value;

                        foreach (var component in components)
                        {
                            if (component.IsCategory(TCategory.Registration))
                            {
                                gadgetRegistrationList.Add(component.Models.GadgetRegistrationModel);
                            }

                            if (component.IsCategory(TCategory.Test))
                            {
                                if (GadgetMaterialDictionary.ContainsKey(component.Models.GadgetMaterialModel.Id).IsFalse())
                                {
                                    GadgetMaterialDictionary.Add(component.Models.GadgetMaterialModel.Id, component.Models.GadgetMaterialModel);
                                }

                                component.Models.GadgetTestModel.Select(component.Models.GadgetMaterialModel); // update Material

                                gadgetTestList.Add(component.Models.GadgetTestModel);
                            }
                        }
                    }

                    foreach (var gadgetRegistration in gadgetRegistrationList)
                    {
                        gadgetResult.UpdateContent(gadgetRegistration);
                    }

                    gadgetResult.UpdateContent(gadgetTestList);
                }

                RegistrationChanged(RegistrationCurrent);
            }
        }