public static void Select (TActionComponent component, TEntityAction entityAction) { if (entityAction.NotNull ()) { if (entityAction.CategoryType.IsCategory (TCategory.Target)) { if (component.NotNull ()) { component.Select (TCategory.Target); component.Models.GadgetTargetModel.Id = entityAction.ModelAction.ComponentInfoModel.Id; component.Models.GadgetTargetModel.MaterialId = entityAction.ModelAction.ExtensionNodeModel.ParentId; component.Models.GadgetTargetModel.GadgetName = entityAction.ModelAction.ExtensionTextModel.Text; component.Models.GadgetTargetModel.Description = entityAction.ModelAction.ExtensionTextModel.Description; component.Models.GadgetTargetModel.Reference = entityAction.ModelAction.ExtensionTextModel.Reference; component.Models.GadgetTargetModel.Value = entityAction.ModelAction.ExtensionTextModel.Value; component.Models.GadgetTargetModel.ExternalLink = entityAction.ModelAction.ExtensionTextModel.ExternalLink; component.Models.GadgetTargetModel.Enabled = entityAction.ModelAction.ComponentInfoModel.Enabled; component.Models.GadgetTargetModel.GadgetInfo = entityAction.ModelAction.ComponentInfoModel.Name; component.Models.GadgetTargetModel.Busy = entityAction.ModelAction.ComponentStatusModel.Busy; // // Has only one child node (GadgetMaterial) foreach (var node in entityAction.CollectionAction.ExtensionNodeCollection) { // gadget Target must be child here if (component.Models.GadgetTargetModel.Contains (node.ChildId)) { entityAction.ModelAction.ExtensionNodeModel.ChildId = node.ChildId; entityAction.ModelAction.ExtensionNodeModel.ChildCategory = node.ChildCategory; entityAction.ModelAction.ExtensionNodeModel.ParentId = node.ParentId; entityAction.ModelAction.ExtensionNodeModel.ParentCategory = node.ParentCategory; component.Models.GadgetTargetModel.MaterialId = component.Models.GadgetTargetModel.MaterialId.IsEmpty () ? node.ParentId : component.Models.GadgetTargetModel.MaterialId; // must be child break; } } // update Material var materialId = component.Models.GadgetTargetModel.MaterialId; if (entityAction.CollectionAction.ModelCollection.ContainsKey (materialId)) { var action = TEntityAction.Create (TCategory.Material); action.ModelAction.CopyFrom (entityAction.CollectionAction.ModelCollection [materialId]); var componentMaterial = TActionComponent.Create (TCategory.Material); TActionConverter.Select (TCategory.Material, componentMaterial, action); var gadgetMaterial = componentMaterial.Models.GadgetMaterialModel; component.Models.GadgetMaterialModel.CopyFrom (gadgetMaterial); component.Models.GadgetTargetModel.Material = gadgetMaterial.Material; } } } } }
public static void Select (TActionComponent component, TEntityAction entityAction) { if (entityAction.NotNull ()) { if (entityAction.CategoryType.IsCategory (TCategory.Registration)) { if (component.NotNull ()) { component.Select (TCategory.Registration); var gadget = component.Models.GadgetRegistrationModel; gadget.Id = entityAction.ModelAction.ComponentInfoModel.Id; gadget.GadgetName = entityAction.ModelAction.ExtensionTextModel.Text; gadget.SetDate (entityAction.ModelAction.ExtensionTextModel.Date); gadget.Description = entityAction.ModelAction.ExtensionTextModel.Description; gadget.ExternalLink = entityAction.ModelAction.ExtensionTextModel.ExternalLink; gadget.SetImage (entityAction.ModelAction.ExtensionImageModel.Image); gadget.Enabled = entityAction.ModelAction.ComponentInfoModel.Enabled; gadget.GadgetInfo = entityAction.ModelAction.ComponentInfoModel.Name; gadget.Busy = entityAction.ModelAction.ComponentStatusModel.Busy; } } } }
public static void Select(TActionComponent component, TEntityAction entityAction) { if (entityAction.NotNull()) { if (entityAction.CategoryType.IsCategory(TCategory.Material)) { if (component.NotNull()) { component.Select(TCategory.Material); component.Models.GadgetMaterialModel.Id = entityAction.ModelAction.ComponentInfoModel.Id; component.Models.GadgetMaterialModel.GadgetName = entityAction.ModelAction.ExtensionTextModel.Text; component.Models.GadgetMaterialModel.Description = entityAction.ModelAction.ExtensionTextModel.Description; component.Models.GadgetMaterialModel.ExternalLink = entityAction.ModelAction.ExtensionTextModel.ExternalLink; component.Models.GadgetMaterialModel.SetImage(entityAction.ModelAction.ExtensionImageModel.Image); component.Models.GadgetMaterialModel.Enabled = entityAction.ModelAction.ComponentInfoModel.Enabled; component.Models.GadgetMaterialModel.GadgetInfo = entityAction.ModelAction.ComponentInfoModel.Name; component.Models.GadgetMaterialModel.Busy = entityAction.ModelAction.ComponentStatusModel.Busy; component.Models.GadgetMaterialModel.Material = entityAction.ModelAction.ExtensionTextModel.Text; } } } }
public static void Select (TActionComponent component, TEntityAction entityAction) { if (entityAction.NotNull ()) { if (entityAction.CategoryType.IsCategory (TCategory.Test)) { if (component.NotNull ()) { component.Select (TCategory.Test); component.Models.GadgetTestModel.Id = entityAction.ModelAction.ComponentInfoModel.Id; component.Models.GadgetTestModel.GadgetName = entityAction.ModelAction.ExtensionTextModel.Text; component.Models.GadgetTestModel.Description = entityAction.ModelAction.ExtensionTextModel.Description; component.Models.GadgetTestModel.ExternalLink = entityAction.ModelAction.ExtensionTextModel.ExternalLink; component.Models.GadgetTestModel.Material = entityAction.ModelAction.ExtensionTextModel.Extension; component.Models.GadgetTestModel.Enabled = entityAction.ModelAction.ComponentInfoModel.Enabled; component.Models.GadgetTestModel.GadgetInfo = entityAction.ModelAction.ComponentInfoModel.Name; component.Models.GadgetTestModel.Busy = entityAction.ModelAction.ComponentStatusModel.Busy; // update if (component.Models.GadgetTestModel.ValidateId) { // content list foreach (var item in entityAction.ComponentOperation.ParentIdCollection) { foreach (var relation in item.Value) { component.Models.GadgetTestModel.AddContentId (relation.ChildId); } } var idCollection = new Collection<Guid> (); component.Models.GadgetTestModel.RequestContentId (idCollection); foreach (var id in idCollection) { if (entityAction.CollectionAction.EntityCollection.ContainsKey (id)) { var gadgetEntityAction = entityAction.CollectionAction.EntityCollection [id]; // target if (gadgetEntityAction.CategoryType.IsCategory (TCategory.Target)) { var componentTarget = TActionComponent.Create (TCategory.Target); TActionConverter.Select (TCategory.Target, componentTarget, gadgetEntityAction); component.Models.GadgetTestModel.AddContent (componentTarget.Models.GadgetTargetModel); // same material always if (component.Models.GadgetMaterialModel.ValidateId.IsFalse ()) { component.Models.GadgetMaterialModel.CopyFrom (componentTarget.Models.GadgetMaterialModel); } } // test if (gadgetEntityAction.CategoryType.IsCategory (TCategory.Test)) { var componentTest = TActionComponent.Create (TCategory.Test); TActionConverter.Select (TCategory.Test, componentTest, gadgetEntityAction); component.Models.GadgetTestModel.AddContent (componentTest.Models.GadgetTestModel); // update Material if (component.Models.GadgetMaterialModel.ValidateId.IsFalse ()) { component.Models.GadgetMaterialModel.CopyFrom (componentTest.Models.GadgetMaterialModel); } } // update image component.Models.GadgetTestModel.Select (component.Models.GadgetMaterialModel); } } } } } } }