Beispiel #1
0
        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);
                }
            }
        }
Beispiel #2
0
    static bool RequestComponent (Guid id, TModelContext context, TEntityAction action, TModelAction modelAction)
    {
      /*
      DATA OUT
      - action.ModelAction (model)
      */

      bool res = false;

      try {
        // info
        var infoList = context.ComponentInfo.AsQueryable()
          .Where (p => p.Id.Equals (id))
          .ToList ()
        ;

        // info found
        if (infoList.Count.Equals (1)) {
          var model = infoList [0];
          modelAction.ComponentInfoModel.CopyFrom (model);

          // update category
          if (action.CategoryType.IsCategory (TCategory.None)) {
            var descList = context.ComponentDescriptor.AsQueryable()
              .Where (p => p.Id.Equals (action.Id))
              .ToList ()
            ;

            // found
            if (descList.Count.Equals (1)) {
              var desc = descList [0];
              action.SelectCategoryType (TCategoryType.Create (TCategoryType.FromValue (desc.Category)));
            }
          }
        }

        // status
        var statusList = context.ComponentStatus.AsQueryable()
          .Where (p => p.Id.Equals (id))
          .ToList ()
        ;

        // status found
        if (statusList.Count.Equals (1)) {
          var model = statusList [0];
          modelAction.ComponentStatusModel.CopyFrom (model);
        }

        res = true;
      }

      catch (Exception exception) {
        THelper.FormatException ("RequestComponent - TOperationSupport", exception, action);
      }

      return (res);
    }