internal void RefreshModel(TEntityAction entityAction) { if (entityAction.NotNull()) { var gadgets = new Collection <TActionComponent> (); TActionConverter.Collection(TCategory.Material, gadgets, entityAction); if (gadgets.Any()) { foreach (var component in gadgets) { var selection = TSelectionInfo.Create(component.Models.GadgetMaterialModel.GadgetName, component.Models.GadgetMaterialModel.Id, component.Models.GadgetMaterialModel.Enabled); selection.SetImage(component.Models.GadgetMaterialModel.GetImage()); entityAction.SupportAction.SelectionCollection.Add(selection); } ComponentModelProperty.ValidateModel(true); ComponentModelProperty.ExtensionModel.SelectModel(TCategory.Target, entityAction); // update Selection Property (Material list) AlertsModel.Select(isOpen: false); // default } else { ComponentModelProperty.ValidateModel(false); // show alerts AlertsModel.Select(TAlertsModel.TKind.Warning); AlertsModel.Select(Properties.Resource.RES_EMPTY, Properties.Resource.RES_LIST_EMPTY); AlertsModel.Select(isOpen: true); } } }
public static void Request (TActionComponent component, TEntityAction entityAction) { if (component.NotNull ()) { if (component.IsCategory (TCategory.Target)) { if (entityAction.NotNull ()) { entityAction.Id = component.Models.GadgetTargetModel.Id; entityAction.CategoryType.Select (TCategory.Target); entityAction.ModelAction.ComponentInfoModel.Name = component.Models.GadgetTargetModel.GadgetInfo; entityAction.ModelAction.ComponentStatusModel.Busy = component.Models.GadgetTargetModel.Busy; entityAction.ModelAction.ComponentInfoModel.Id = component.Models.GadgetTargetModel.Id; entityAction.ModelAction.ExtensionNodeModel.ChildId = component.Models.GadgetTargetModel.Id; entityAction.ModelAction.ExtensionNodeModel.ChildCategory = TCategoryType.ToValue (TCategory.Target); entityAction.ModelAction.ExtensionNodeModel.ParentId = component.Models.GadgetTargetModel.MaterialId; entityAction.ModelAction.ExtensionNodeModel.ParentCategory = TCategoryType.ToValue (TCategory.Material); entityAction.ModelAction.ExtensionTextModel.Id = component.Models.GadgetTargetModel.Id; entityAction.ModelAction.ExtensionTextModel.Text = component.Models.GadgetTargetModel.GadgetName; entityAction.ModelAction.ExtensionTextModel.Description = component.Models.GadgetTargetModel.Description; entityAction.ModelAction.ExtensionTextModel.Reference = component.Models.GadgetTargetModel.Reference; entityAction.ModelAction.ExtensionTextModel.Value = component.Models.GadgetTargetModel.Value; entityAction.ModelAction.ExtensionTextModel.ExternalLink = component.Models.GadgetTargetModel.ExternalLink; entityAction.ModelAction.ComponentInfoModel.Enabled = component.Models.GadgetTargetModel.Enabled; } } } }
public TOperationSupport (TModelContext context, TEntityAction action) : this () { /* DATA IN - action.Id - action.CollectionAction.CategoryRelationCollection DATA OUT - action.ModelAction (model) - action.CollectionAction.ModeCollection {id, model} (for each node) */ if (action.NotNull ()) { Id = action.Id; if (context.NotNull ()) { var descriptors = context.ComponentDescriptor.AsQueryable () .Where (p => p.Id.Equals (Id)) .ToList () ; // found (request Category) if (descriptors.Any ()) { CategoryValue = descriptors [0].Category; } } } }
public static TComponentModelItem Create (TEntityAction action) { var modelItem = CreateDefault; if (action.NotNull ()) { var model = Create (action.ModelAction); modelItem.CopyFrom (model); modelItem.Select (action.CategoryType.Category); switch (modelItem.Category) { case Server.Models.Infrastructure.TCategory.Material: { } break; case Server.Models.Infrastructure.TCategory.Target: { //modelItem.GadgetTargetModel.UpdateModel (modelItem, action); } break; case Server.Models.Infrastructure.TCategory.Test: { //modelItem.GadgetTestModel.UpdateModel (action); } break; } } return (modelItem); }
internal void RequestModel(TEntityAction action) { if (action.NotNull()) { action.SelectCategoryType(TCategoryType.Create(TCategory.Target)); action.CollectionAction.ExtensionNodeCollection.Clear(); ComponentModelProperty.RequestModel(action); if (action.SupportAction.SelectionInfo.Tag is Guid materialId) { action.ModelAction.ComponentStatusModel.UseNodeModel = true; action.ModelAction.ComponentStatusModel.NodeReverse = true; // Here gadget Material must be Parent action.ModelAction.ExtensionNodeModel.ChildId = ComponentModelProperty.Id; action.ModelAction.ExtensionNodeModel.ChildCategory = TCategoryType.ToValue(TCategory.Target); action.ModelAction.ExtensionNodeModel.ParentId = materialId; action.ModelAction.ExtensionNodeModel.ParentCategory = TCategoryType.ToValue(TCategory.Material); // update collection action.CollectionAction.ExtensionNodeCollection.Add(action.ModelAction.ExtensionNodeModel); } } }
void ResponseDataDispatcher (TEntityAction entityAction) { if (entityAction.NotNull ()) { // request if (entityAction.IdCollection.Any ()) { // to parent // Dummy - Select - Many var action = TEntityAction.Create ( TCategory.Dummy, TOperation.Select, TExtension.Many ); foreach (var item in entityAction.IdCollection) { action.IdCollection.Add (item); } action.Param2 = entityAction; // preserve var message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.List, TypeInfo); message.Support.Argument.Types.Select (action); DelegateCommand.PublishInternalMessage.Execute (message); } else { var gadgets = new Collection<TActionComponent> (); TActionConverter.Collection (TCategory.Test, gadgets, entityAction); Model.Select (gadgets); } } TDispatcher.Invoke (RefreshAllDispatcher); }
public static void Select (TCategory category, TActionComponent component, TEntityAction entityAction) { if (component.NotNull () && entityAction.NotNull ()) { switch (category) { case TCategory.Material: TGadgetMaterialConverter.Select (component, entityAction); break; case TCategory.Target: TGadgetTargetConverter.Select (component, entityAction); break; case TCategory.Test: TGadgetTestConverter.Select (component, entityAction); break; case TCategory.Registration: TGadgetRegistrationConverter.Select (component, entityAction); break; case TCategory.Result: TGadgetResultConverter.Select (component, entityAction); break; case TCategory.Report: TGadgetReportConverter.Select (component, entityAction); break; } } }
public static void Collection (TCategory category, Collection<TActionComponent> gadgets, TEntityAction entityAction) { if (gadgets.NotNull () && entityAction.NotNull ()) { switch (category) { case TCategory.Material: TGadgetMaterialConverter.Collection (gadgets, entityAction); break; case TCategory.Target: TGadgetTargetConverter.Collection (gadgets, entityAction); break; case TCategory.Test: TGadgetTestConverter.Collection (gadgets, entityAction); break; case TCategory.Registration: TGadgetRegistrationConverter.Collection (gadgets, entityAction); break; case TCategory.Result: TGadgetResultConverter.Collection (gadgets, entityAction); break; case TCategory.Report: TGadgetReportConverter.Collection (gadgets, entityAction); break; } } }
public static void SelectMany (Collection<TActionComponent> gadgets, TEntityAction entityAction) { //entityAction.CollectionAction.EntityCollection if (entityAction.NotNull ()) { if (entityAction.CategoryType.IsCategory (TCategory.Result)) { if (gadgets.NotNull ()) { if (gadgets.Any ()) { foreach (var component in gadgets) { // TODO:?? } } else { foreach (var item in entityAction.CollectionAction.EntityCollection) { var someEntity = item.Value; var component = TActionComponent.Create (someEntity.CategoryType.Category); TActionConverter.Select (someEntity.CategoryType.Category, component, someEntity); gadgets.Add (component); } } } } } }
public static void Collection (Collection<TActionComponent> gadgets, TEntityAction entityAction) { if (gadgets.NotNull ()) { gadgets.Clear (); if (entityAction.NotNull ()) { if (entityAction.CategoryType.IsCategory (TCategory.Target)) { var gadgetCollection = new Collection<GadgetTarget> (); foreach (var item in entityAction.CollectionAction.ModelCollection) { var modelAction = item.Value; var gadget = GadgetTarget.CreateDefault; gadget.Id = modelAction.ComponentInfoModel.Id; gadget.MaterialId = modelAction.ExtensionNodeModel.ParentId; gadget.GadgetName = modelAction.ExtensionTextModel.Text; gadget.Description = modelAction.ExtensionTextModel.Description; gadget.Reference = modelAction.ExtensionTextModel.Reference; gadget.Value = modelAction.ExtensionTextModel.Value; gadget.ExternalLink = modelAction.ExtensionTextModel.ExternalLink; gadget.Enabled = modelAction.ComponentInfoModel.Enabled; gadget.GadgetInfo = modelAction.ComponentInfoModel.Name; gadget.Busy = modelAction.ComponentStatusModel.Busy; // // Has only one child node (GadgetMaterial) foreach (var node in entityAction.CollectionAction.ExtensionNodeCollection) { // gadget Target must be child here if (gadget.Contains (node.ChildId)) { modelAction.ExtensionNodeModel.ChildId = node.ChildId; modelAction.ExtensionNodeModel.ChildCategory = node.ChildCategory; modelAction.ExtensionNodeModel.ParentId = node.ParentId; modelAction.ExtensionNodeModel.ParentCategory = node.ParentCategory; gadget.MaterialId = gadget.MaterialId.IsEmpty () ? node.ParentId : gadget.MaterialId; // must be child break; } } gadgetCollection.Add (gadget); } // sort var list = gadgetCollection .OrderBy (p => p.GadgetInfo) .ToList () ; foreach (var model in list) { var component = TActionComponent.Create (TCategory.Target); component.Models.GadgetTargetModel.CopyFrom (model); gadgets.Add (component); } } } } }
public void SelectContent (TEntityAction action) { if (action.NotNull ()) { foreach (var item in m_Styles) { SelectContent (item.Value, action); } } }
public void Request (TEntityAction action) { if (action.NotNull ()) { if (HasSelection) { action.SupportAction.SelectionInfo.Select (Selection.ValueString, Selection.Tag, Selection.Enabled); action.SupportAction.SelectionInfo.SetImage (Selection.GetImage ()); } } }
public void SelectModel (TEntityAction action) { if (action.NotNull ()) { m_InfoModel.CopyFrom (action.ModelAction.ComponentInfoModel); //EnabledProperty = m_InfoModel.Enabled; //NameProperty = m_InfoModel.Name; } }
public static void Collection (Collection<TActionComponent> gadgets, TEntityAction entityAction) { if (gadgets.NotNull ()) { gadgets.Clear (); if (entityAction.NotNull ()) { if (entityAction.CategoryType.IsCategory (TCategory.Result)) { var gadgetCollection = new Collection<GadgetResult> (); foreach (var item in entityAction.CollectionAction.ModelCollection) { var modelAction = item.Value; var gadget = GadgetResult.CreateDefault; gadget.Id = modelAction.ComponentInfoModel.Id; gadget.GadgetName = modelAction.ExtensionTextModel.Text; gadget.Description = modelAction.ExtensionTextModel.Description; gadget.ExternalLink = modelAction.ExtensionTextModel.ExternalLink; gadget.SetDate (modelAction.ExtensionTextModel.Date); gadget.Enabled = modelAction.ComponentInfoModel.Enabled; gadget.GadgetInfo = modelAction.ComponentInfoModel.Name; gadget.Busy = modelAction.ComponentStatusModel.Busy; gadget.Locked = modelAction.ComponentStatusModel.Locked; if (modelAction.ExtensionContentModel.Id.Equals (gadget.Id)) { string [] contentClientString = Regex.Split (modelAction.ExtensionContentModel.Contents, ";"); // Jason serializer foreach (var jasonClientString in contentClientString) { if (string.IsNullOrEmpty (jasonClientString).IsFalse ()) { var jason = new TJasonSerializer<TContentClient> (new TContentClient ()); jason.ToClient (jasonClientString); jason.Client.Request (gadget); } } } gadgetCollection.Add (gadget); } // sort var list = gadgetCollection .OrderBy (p => p.GadgetInfo) .ToList () ; foreach (var model in list) { var component = TActionComponent.Create (TCategory.Result); component.Models.GadgetResultModel.CopyFrom (model); gadgets.Add (component); } } } } }
public static void ModifyStatus (TCategory category, TActionComponent component, TEntityAction entityAction) { if (component.NotNull () && entityAction.NotNull ()) { switch (category) { case TCategory.Result: TGadgetResultConverter.ModifyStatus (component, entityAction); break; } } }
internal void Request(TEntityAction action) { if (action.NotNull()) { foreach (var info in SupportInfoCollection) { info.Request(action); } } }
public void SelectModel (Server.Models.Infrastructure.TCategory category, TEntityAction action) { if (action.NotNull ()) { switch (category) { case Server.Models.Infrastructure.TCategory.Target: SelectionProperty.Select (action); break; } } }
public void PopulateNode (TEntityAction action) { if (action.NotNull ()) { NodeModelCollection.Clear (); foreach (var node in action.CollectionAction.ExtensionNodeCollection) { if (Id.Equals (node.ParentId)) { NodeModelCollection.Add (node); } } } }
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 Request (TActionComponent component, TEntityAction entityAction) { if (component.NotNull ()) { if (component.IsCategory (TCategory.Result)) { var gadget = component.Models.GadgetResultModel; if (entityAction.NotNull ()) { entityAction.Id = gadget.Id; entityAction.CategoryType.Select (TCategory.Result); entityAction.ModelAction.ComponentInfoModel.Id = gadget.Id; entityAction.ModelAction.ComponentInfoModel.Name = gadget.GadgetInfo; entityAction.ModelAction.ComponentInfoModel.Enabled = gadget.Enabled; entityAction.ModelAction.ComponentStatusModel.Id = gadget.Id; entityAction.ModelAction.ComponentStatusModel.Busy = gadget.Busy; entityAction.ModelAction.ComponentStatusModel.Locked = gadget.Locked; entityAction.ModelAction.ExtensionTextModel.Id = gadget.Id; entityAction.ModelAction.ExtensionTextModel.Text = gadget.GadgetName; entityAction.ModelAction.ExtensionTextModel.Date = gadget.Date; entityAction.ModelAction.ExtensionTextModel.Description = gadget.Description; // Jason serializer var clientList = new Collection<TContentClient> (); var contentRegistration = GadgetRegistration.CreateDefault; gadget.RequestContent (contentRegistration); clientList.Add (new TContentClient (contentRegistration)); var contents = new Collection<GadgetTest> (); gadget.RequestContent (contents); foreach (var item in contents) { clientList.Add (new TContentClient (item)); } StringBuilder contentString = new StringBuilder (); foreach (var item in clientList) { var jason = new TJasonSerializer<TContentClient> (item); jason.ToJsonString (); var str = jason.JasonString + ";"; contentString.Append (str); } entityAction.ModelAction.ExtensionContentModel.Id = gadget.Id; entityAction.ModelAction.ExtensionContentModel.Category = TCategoryType.ToValue (TCategory.Result); entityAction.ModelAction.ExtensionContentModel.Contents = contentString.ToString (); } } } }
public void RequestModel (TEntityAction action) { if (action.NotNull ()) { ComponentModel.RequestModel (action); ExtensionModel.RequestModel (action); action.Id = Id; action.ModelAction.ComponentInfoModel.Id = Id; action.ModelAction.ComponentStatusModel.Id = Id; action.ModelAction.ComponentStatusModel.Busy = IsBusy; } }
public static void SelectMany (TCategory category, Collection<TActionComponent> gadgets, TEntityAction entityAction) { if (gadgets.NotNull () && entityAction.NotNull ()) { switch (category) { case TCategory.Test: TGadgetTestConverter.SelectMany (gadgets, entityAction); break; case TCategory.Result: TGadgetResultConverter.SelectMany (gadgets, entityAction); break; } } }
public void RequestModel (TEntityAction action) { if (action.NotNull ()) { Request (); action.ModelAction.ExtensionLayoutModel.CopyFrom (m_LayoutModel); action.ModelAction.ExtensionImageModel.CopyFrom (m_ImageModel); action.ModelAction.ExtensionTextModel.CopyFrom (m_TextModel); //action.ModelAction.ExtensionDocumentModel.CopyFrom (m_DocumentModel); action.ModelAction.ExtensionGeometryModel.CopyFrom (m_GeometryModel); SelectionProperty.Request (action); } }
internal static void RequestNode (TModelContext context, TEntityAction action) { /* DATA IN - action.Id {used as ParentId} DATA OUT - action.CollectionAction.ExtensionNodeCollection - action.CollectionAction.ModelCollection {id, modelAction} // node model */ if (context.NotNull () && action.NotNull ()) { var nodesCollection = context.ExtensionNode.AsQueryable () .Where (p => p.ParentId.Equals (action.Id)) .ToList () ; var nodeReverse = action.ModelAction.ComponentStatusModel.NodeReverse; if (nodeReverse) { nodesCollection = context.ExtensionNode.AsQueryable () .Where (p => p.ChildId.Equals (action.Id)) .ToList () ; } try { // node (child) foreach (var node in nodesCollection) { action.CollectionAction.ExtensionNodeCollection.Add (node); var id = nodeReverse ? node.ParentId : node.ChildId; var categoryValue = nodeReverse ? node.ParentCategory : node.ChildCategory; var modelAction = TModelAction.CreateDefault; if (RequestComponent (id, context, action, modelAction)) { if (RequestExtension (categoryValue, id, context, action, modelAction)) { action.CollectionAction.ModelCollection.Add (id, modelAction); // add node model } } } } catch (Exception exception) { THelper.FormatException ("RequestNode - TOperationSupport", exception, action); } } }
public void SelectModel (TEntityAction action) { if (action.NotNull ()) { var name = action.SupportAction.SelectionInfo.Name; var tag = action.SupportAction.SelectionInfo.Tag; var image = action.SupportAction.SelectionInfo.GetImage (); var enabled = action.SupportAction.SelectionInfo.Enabled; if (enabled) { var selection = TSelectionItem.Create (name, tag, image, enabled); Select (selection); } } }
public static void Collection(Collection <TActionComponent> gadgets, TEntityAction entityAction) { if (gadgets.NotNull()) { gadgets.Clear(); if (entityAction.NotNull()) { if (entityAction.CategoryType.IsCategory(TCategory.Material)) { var gadgetCollection = new Collection <GadgetMaterial> (); foreach (var item in entityAction.CollectionAction.ModelCollection) { var modelAction = item.Value; var gadget = GadgetMaterial.CreateDefault; gadget.Id = modelAction.ComponentInfoModel.Id; gadget.GadgetName = modelAction.ExtensionTextModel.Text; gadget.Description = modelAction.ExtensionTextModel.Description; gadget.ExternalLink = modelAction.ExtensionTextModel.ExternalLink; gadget.SetImage(modelAction.ExtensionImageModel.Image); gadget.Enabled = modelAction.ComponentInfoModel.Enabled; gadget.GadgetInfo = modelAction.ComponentInfoModel.Name; gadget.Busy = modelAction.ComponentStatusModel.Busy; gadget.Material = modelAction.ExtensionTextModel.Text; gadgetCollection.Add(gadget); } // sort var list = gadgetCollection .OrderBy(p => p.GadgetInfo) .ToList() ; foreach (var model in list) { var component = TActionComponent.Create(TCategory.Material); component.Models.GadgetMaterialModel.CopyFrom(model); gadgets.Add(component); } } } } }
void RequestModelDispatcher (TEntityAction action) { if (action.NotNull ()) { var component = TActionComponent.Create (TCategory.Result); Model.Request (component); TActionConverter.Request (TCategory.Result, component, action); action.Param1 = component; // to Sibling var message = new TFactorySiblingMessageInternal (TInternalMessageAction.Response, TChild.List, TypeInfo); message.Support.Argument.Types.Select (action); DelegateCommand.PublishInternalMessage.Execute (message); } }
void ResponseSelectManyDispatcher (TEntityAction entityAction) { if (entityAction.NotNull ()) { if (entityAction.Param2 is TEntityAction action) { foreach (var item in entityAction.CollectionAction.EntityCollection) { action.CollectionAction.EntityCollection.Add (item.Key, item.Value); } var gadgets = new Collection<TActionComponent> (); TActionConverter.Collection (TCategory.Test, gadgets, action); Model.Select (gadgets); } } TDispatcher.Invoke (RefreshAllDispatcher); }
public static void ModifyStatus (TActionComponent component, TEntityAction entityAction) { if (component.NotNull ()) { if (entityAction.NotNull ()) { if (component.IsCategory (TCategory.Result)) { var gadget = component.Models.GadgetResultModel; entityAction.Id = gadget.Id; entityAction.CategoryType.Select (TCategory.Result); entityAction.ModelAction.ComponentStatusModel.Id = gadget.Id; entityAction.ModelAction.ComponentStatusModel.Busy = gadget.Busy; entityAction.ModelAction.ComponentStatusModel.Locked = gadget.Locked; } } } }
public void RequestNode (TEntityAction action) { if (action.NotNull ()) { foreach (var node in action.CollectionAction.ExtensionNodeCollection) { NodeModelCollection.Add (node); if (action.CollectionAction.ModelCollection.ContainsKey (node.ChildId)) { var childNodeModel = action.CollectionAction.ModelCollection [node.ChildId]; // node model var childNodeComponentModel = Create (childNodeModel); // child node var childNodeComponentModelItem = Create (childNodeComponentModel); childNodeComponentModelItem.Select (Server.Models.Infrastructure.TCategoryType.FromValue (node.ChildCategory)); ChildCollection.Add (childNodeComponentModelItem); } } } }