Esempio n. 1
0
 // transfer serialized data contract to business wcf contract
 // links:
 //  docLink: http://sql2x.org/documentationLink/6140089a-d7c9-4e92-b385-f6fd91026820
 // parameters:
 //  dalCategoryTree: from durian ansi sql select statement
 //  dataContract: business wcf contract
 public void DataToContract(CategoryTreeData dalCategoryTree, CategoryTreeContract dataContract)
 {
     dataContract.ProductCategoryId       = dalCategoryTree.ProductCategoryId;
     dataContract.ProductCategoryParentId = dalCategoryTree.ProductCategoryParentId;
     dataContract.ProductCategoryCode     = dalCategoryTree.ProductCategoryCode;
     dataContract.ProductCategoryName     = dalCategoryTree.ProductCategoryName;
 }
Esempio n. 2
0
        private void AssignChildren(CategoryTreeData data, HashSet <KategoriaModel> categories)
        {
            if (categories == null)
            {
                return;
            }
            var childrenRaw = categories.Where(cat => cat.IdKRodzic == data.Category.IdK).ToList();

            foreach (var model in childrenRaw)
            {
                categories.Remove(model);
            }

            var children = childrenRaw.Select(cat => new CategoryTreeData()
            {
                Category          = cat,
                Parent            = data,
                Children          = new ObservableCollection <TreeData>(),
                OnSelectionChange = TreeSelectionChange
            });

            children.ToList().ForEach(dataa =>
            {
                AssignChildren(dataa, categories);
                data.Children.Add(dataa);
            });
        }