private void CategoryItem_Selected(object sender, RoutedEventArgs e)
        {
            TreeViewItem this_TreeViewItem  = e.Source as TreeViewItem;
            TypeDigest   categoryTypeDigest = (TypeDigest)this_TreeViewItem.Tag;

            DictionaryTree.Items.Clear();
            foreach (TypeDigest dictionaryTypeDigest in _typeRepository.GetTypeDigestsByCategory(categoryTypeDigest.Id))
            {
                if (dictionaryTypeDigest.ParentId == null)
                {
                    DictionaryTree.Items.Add(CreateTypeDigestTreeViewItem(dictionaryTypeDigest.Code, dictionaryTypeDigest));
                }
            }
        }
        private void DictionaryTree_Expanded(object sender, RoutedEventArgs e)
        {
            TreeViewItem this_TreeViewItem = e.Source as TreeViewItem;
            TypeDigest   typeDigest        = (TypeDigest)this_TreeViewItem.Tag;

            if (this_TreeViewItem.Items.Count > 0 && this_TreeViewItem.Items[0] is TreeViewItem && ((TreeViewItem)this_TreeViewItem.Items[0]).Tag is LoadingTreeViewItem)
            {
                this_TreeViewItem.Items.Clear();
                foreach (TypeDigest childTypeDigest in _typeRepository.GetTypeDigestsByParent(typeDigest.Id))
                {
                    this_TreeViewItem.Items.Add(CreateTypeDigestTreeViewItem(childTypeDigest.Code, childTypeDigest));
                }
            }
        }
        private void CategoryTypeDigestInsertMenuItem_Click(object sender, RoutedEventArgs e)
        {
            TreeViewItem selectedItem = CategoryTree.SelectedItem as TreeViewItem;
            TypeDigest   categoryType = selectedItem.Tag as TypeDigest;

            TypeDigestViewModel viewModel = new TypeDigestViewModel(new TypeDigest()
            {
                TypeCategoryId = categoryType.Id,
                Edit           = DateTime.Now,
                Open           = DateTime.Now,
                Close          = new DateTime(2100, 1, 1)
            });

            TypeDigestInsertWindow typeDigestInsertWindow = new TypeDigestInsertWindow();

            typeDigestInsertWindow.ViewModel = viewModel;
            typeDigestInsertWindow.Show();
        }
        private void AddTypeButton_Click(object sender, RoutedEventArgs e)
        {
            TreeViewItem selectedItem       = CategoryTree.SelectedItem as TreeViewItem;
            TypeDigest   typeCategoryDigest = (TypeDigest)selectedItem.Tag;

            TypeDigestViewModel viewModel = new TypeDigestViewModel(new TypeDigest()
            {
                TypeCategoryId = typeCategoryDigest.Id,
                Edit           = DateTime.Now,
                Open           = DateTime.Now,
                Close          = new DateTime(2100, 1, 1)
            });

            TypeDigestInsertWindow typeDigestInsertWindow = new TypeDigestInsertWindow();

            typeDigestInsertWindow.ViewModel = viewModel;
            typeDigestInsertWindow.Show();
        }
Ejemplo n.º 5
0
        private void InitializeRootCatalog(PersonalDataContext ctx)
        {
            TypeTableRootCategory = new TypeTable()
            {
                Table         = "drTypeCategory",
                Name          = "TypeCategory",
                Note          = "Категории",
                PK            = "idTypeCategory",
                TableObjectId = null
            };
            ctx.TypeTables.Add(TypeTableRootCategory);
            ctx.SaveChanges();

            TypeRootCategory = new TypeDigest()
            {
                Code      = "TypeCategory",
                BCode     = "TypeCategory",
                Name      = "Типы справочников (Категории)",
                TypeTable = TypeTableRootCategory,
                Note      = null,
                Edit      = _defaultOpen,
                Open      = _defaultOpen,
                Close     = _defaultClose,
                Order     = 0
            };
            ctx.TypeDigests.Add(TypeRootCategory);
            ctx.SaveChanges();;

            TypeCategoryRootCategory = new TypeCategory()
            {
                Id        = TypeRootCategory.Id,
                TypeTable = TypeTableRootCategory
            };
            ctx.TypeCategories.Add(TypeCategoryRootCategory);
            ctx.SaveChanges();

            TypeRootCategory.Category = TypeCategoryRootCategory;

            ctx.SaveChanges();
        }
Ejemplo n.º 6
0
        public void DeleteTypeDigest(TypeDigest type)
        {
            ResetTypeCache(type);
            if (type.TypeCategoryId == GetRootCategoryTypeDigest().Match(() => - 1, t => t.Id))
            {
                Connect(
                    ctx => {
                    ctx.TypeDigests
                    .Where(c => c.TypeCategoryId == type.Id)
                    .ToList()
                    .ForEach(c => ctx.Entry(c).State = System.Data.Entity.EntityState.Deleted);
                    ctx.SaveChanges();

                    TypeCategory currentCategory = ctx.TypeCategories.Where(c => c.Id == type.Id).FirstOrDefault();
                    ctx.TypeCategories.Attach(currentCategory);
                    ctx.TypeCategories.Remove(currentCategory);
                    ctx.SaveChanges();

                    ctx.TypeDigests.Attach(type);
                    ctx.TypeDigests.Remove(type);
                    ctx.SaveChanges();

                    return(Unit());
                }
                    );
            }
            else
            {
                Connect(
                    ctx => {
                    ctx.TypeDigests.Attach(type);
                    ctx.TypeDigests.Remove(type);
                    ctx.SaveChanges();

                    return(Unit());
                }
                    );
            }
        }
Ejemplo n.º 7
0
        private void InitializeTypeOperationNode(PersonalDataContext ctx)
        {
            TypeOperationNodeCategory = new TypeDigest()
            {
                ParentType = TypeRootCategory,
                Category   = TypeCategoryRootCategory,

                Code      = "OperationNodeTypeCategory",
                BCode     = "OperationNodeTypeCategory",
                Name      = "Категория для хранения видов операций",
                TypeTable = TypeTableRootCategory,
                Note      = null,
                Edit      = _defaultOpen,
                Open      = _defaultOpen,
                Close     = _defaultClose,
                Order     = 1
            };
            ctx.TypeDigests.Add(TypeOperationNodeCategory);
            ctx.SaveChanges();

            TypeCategoryOperationNode = new TypeCategory()
            {
                Id        = TypeOperationNodeCategory.Id,
                TypeTable = null
            };
            ctx.TypeCategories.Add(TypeCategoryOperationNode);
            ctx.SaveChanges();


            TypeOperationNodeUnaryCategory = new TypeDigest()
            {
                ParentType = TypeOperationNodeCategory,
                Category   = TypeCategoryRootCategory,

                Code      = "OperationNodeUnaryTypeCategory",
                BCode     = "OperationNodeUnaryTypeCategory",
                Name      = "Категория для хранения унарных операций",
                TypeTable = TypeTableRootCategory,
                Note      = null,
                Edit      = _defaultOpen,
                Open      = _defaultOpen,
                Close     = _defaultClose,
                Order     = 1
            };
            ctx.TypeDigests.Add(TypeOperationNodeUnaryCategory);
            ctx.SaveChanges();

            TypeCategoryOperationNodeUnary = new TypeCategory()
            {
                Id        = TypeOperationNodeUnaryCategory.Id,
                TypeTable = null
            };
            ctx.TypeCategories.Add(TypeCategoryOperationNodeUnary);
            ctx.SaveChanges();


            TypeOperationNodeBinaryCategory = new TypeDigest()
            {
                ParentType = TypeOperationNodeCategory,
                Category   = TypeCategoryRootCategory,

                Code      = "OperationNodeBinaryTypeCategory",
                BCode     = "OperationNodeBinaryTypeCategory",
                Name      = "Категория для хранения бинарных операций",
                TypeTable = TypeTableRootCategory,
                Note      = null,
                Edit      = _defaultOpen,
                Open      = _defaultOpen,
                Close     = _defaultClose,
                Order     = 1
            };
            ctx.TypeDigests.Add(TypeOperationNodeBinaryCategory);
            ctx.SaveChanges();

            TypeCategoryOperationNodeBinary = new TypeCategory()
            {
                Id        = TypeOperationNodeBinaryCategory.Id,
                TypeTable = null
            };
            ctx.TypeCategories.Add(TypeCategoryOperationNodeBinary);
            ctx.SaveChanges();


            TypeOperationNodeTernaryCategory = new TypeDigest()
            {
                ParentType = TypeOperationNodeCategory,
                Category   = TypeCategoryRootCategory,

                Code      = "OperationNodeTernaryTypeCategory",
                BCode     = "OperationNodeTernaryTypeCategory",
                Name      = "Категория для хранения тернарных операций",
                TypeTable = TypeTableRootCategory,
                Note      = null,
                Edit      = _defaultOpen,
                Open      = _defaultOpen,
                Close     = _defaultClose,
                Order     = 1
            };
            ctx.TypeDigests.Add(TypeOperationNodeTernaryCategory);
            ctx.SaveChanges();

            TypeCategoryOperationNodeTernary = new TypeCategory()
            {
                Id        = TypeOperationNodeTernaryCategory.Id,
                TypeTable = null
            };
            ctx.TypeCategories.Add(TypeCategoryOperationNodeTernary);
            ctx.SaveChanges();


            TypeExpressionNodeOperatorPlus = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryOperationNodeBinary,
                Code       = "OperatorPlusNode",
                BCode      = "Plus",
                Name       = "Оператор плюс",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 1
            };
            TypeExpressionNodeOperatorMinus = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryOperationNodeBinary,
                Code       = "OperatorMinusNode",
                BCode      = "Minus",
                Name       = "Оператор минус",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 2
            };
            TypeExpressionNodeOperatorMultiply = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryOperationNodeBinary,
                Code       = "OperatorMultiplyNode",
                BCode      = "Multiply",
                Name       = "Оператор умножить",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 3
            };
            TypeExpressionNodeOperatorDivide = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryOperationNodeBinary,
                Code       = "OperatorDivideNode",
                BCode      = "Divide",
                Name       = "Оператор разделить",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 4
            };
            TypeExpressionNodeOperatorAssign = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryOperationNodeBinary,
                Code       = "OperatorAssignNode",
                BCode      = "Assign",
                Name       = "Оператор присвоения",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 5
            };
            TypeExpressionNodeOperatorIf = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryOperationNodeTernary,
                Code       = "OperatorIfNode",
                BCode      = "If",
                Name       = "Оператор если",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 6
            };
            TypeExpressionNodeOperatorEqual = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryOperationNodeBinary,
                Code       = "OperatorEqualNode",
                BCode      = "Equal",
                Name       = "Оператор сравнения",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 7
            };
            ctx.TypeDigests.AddRange(new[] { TypeExpressionNodeOperatorPlus, TypeExpressionNodeOperatorMinus, TypeExpressionNodeOperatorMultiply, TypeExpressionNodeOperatorDivide, TypeExpressionNodeOperatorAssign, TypeExpressionNodeOperatorIf, TypeExpressionNodeOperatorEqual });
            ctx.SaveChanges();
        }
Ejemplo n.º 8
0
        private void InitializeTypeConstReference(PersonalDataContext ctx)
        {
            TypeConstReferenceCategory = new TypeDigest()
            {
                ParentType = TypeRootCategory,
                Category   = TypeCategoryRootCategory,

                Code      = "ConstReferenceCategory",
                BCode     = "ConstReferenceCategory",
                Name      = "Категория типов указателей на константы",
                TypeTable = TypeTableRootCategory,
                Note      = null,
                Edit      = _defaultOpen,
                Open      = _defaultOpen,
                Close     = _defaultClose,
                Order     = 3
            };
            ctx.TypeDigests.Add(TypeConstReferenceCategory);
            ctx.SaveChanges();

            TypeCategoryConstReference = new TypeCategory()
            {
                Id        = TypeConstReferenceCategory.Id,
                TypeTable = null
            };
            ctx.TypeCategories.Add(TypeCategoryConstReference);
            ctx.SaveChanges();

            TypeConstNullReference = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryConstReference,
                Code       = "NullConstReference",
                BCode      = "NullConstReference",
                Name       = "Указатель на константу-null",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 1
            };
            TypeConstStringReference = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryConstReference,
                Code       = "StringConstReference",
                BCode      = "StringConstReference",
                Name       = "Указатель на константу-строку",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 2
            };
            TypeConstIntReference = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryConstReference,
                Code       = "IntConstReference",
                BCode      = "IntConstReference",
                Name       = "Указатель на константу-целое число",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 3
            };
            TypeConstFloatReference = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryConstReference,
                Code       = "FloatConstReference",
                BCode      = "FloatConstReference",
                Name       = "Указатель на константу-число с плавающей точкой",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 4
            };
            TypeConstBoolReference = new TypeDigest()
            {
                ParentType = null,
                Category   = TypeCategoryConstReference,
                Code       = "BoolConstReference",
                BCode      = "BoolConstReference",
                Name       = "Указатель на константу-логическое значение",
                TypeTable  = null,
                Note       = null,
                Edit       = _defaultOpen,
                Open       = _defaultOpen,
                Close      = _defaultClose,
                Order      = 5
            };
            ctx.TypeDigests.AddRange(new[] { TypeConstNullReference, TypeConstStringReference, TypeConstIntReference, TypeConstFloatReference, TypeConstBoolReference });
            ctx.SaveChanges();
        }
 private void DictionaryItem_Selected(object sender, RoutedEventArgs e)
 {
     TreeViewItem this_TreeViewItem = e.Source as TreeViewItem;
     TypeDigest   typeDigest        = (TypeDigest)this_TreeViewItem.Tag;
 }