//public bool GadgetCanRemove () //{ // var res = true; // if (HasRelation) { // switch (Category) { // case Server.Models.Infrastructure.TCategory.Test: { // res = GadgetTestModel.CanRemove; // } // break; // } // } // return (res); //} #endregion #region Static public static TComponentModelItem Create (TComponentModel model) { var modelItem = CreateDefault; if (model.NotNull ()) { modelItem.CopyFrom (model); } return (modelItem); }
public void Select (TEntityAction action) { // DATA IN: // action.CollectionAction.ModelCollection // action.CollectionAction.ExtensionNodeCollection m_ComponentModelDrop.Clear (); if (action.NotNull ()) { ComponentModelCollection.Clear (); ItemsCollection.Clear (); foreach (var modelAction in action.CollectionAction.ModelCollection) { var componentModel = TComponentModel.Create (modelAction.Value); var componentModelItem = TComponentModelItem.Create (componentModel); componentModelItem.Select (action.CategoryType.Category); ComponentModelCollection.Add (componentModelItem); } // sort collection by Name var sortedList = ComponentModelCollection .OrderBy (p => p.Name) .ToList () ; ComponentModelCollection.Clear (); foreach (var item in sortedList) { ComponentModelCollection.Add (item); } foreach (var item in ComponentModelCollection) { item.PopulateNode (action); } } }
public void CopyFromBase (TComponentModel alias) { if (alias.NotNull ()) { CopyFrom (alias); } }