Exemple #1
0
        private void LoadDocumentCategoriesTree()
        {
            DocumentCategoriesTree.Categories.Clear();
            try
            {
                string connectionString = _ConnectionString;
                string addSqlString = DocumentCategorieSqlString;
                using (SQLiteConnection connection = new SQLiteConnection(connectionString))
                {
                    connection.Open();
                    using (SQLiteCommand command = connection.CreateCommand())
                    {
                        command.CommandText = addSqlString;

                        try
                        {
                            SQLiteDataReader reader = command.ExecuteReader();
                            while (reader.Read())
                            {
                                DocumentCategorie categorie = new DocumentCategorie();
                                categorie.Guid = reader["Guid"].ToString();
                                categorie.Index = int.Parse(reader["Index"].ToString());
                                categorie.Name = reader["Name"].ToString();
                                categorie.ParentGuid = reader["ParentGuid"].ToString();
                                categorie.Text = reader["Text"].ToString();
                                categorie.RootGuid = reader["RootGuid"].ToString();

                                DocumentCategoriesTree.Add(categorie);
                            }
                        }
                        catch (SQLiteException ex) { MessageBox.Show(ex.Message); }
                    }
                }
            }
            catch (SQLiteException ex) { MessageBox.Show(ex.Message); }
        }
Exemple #2
0
 public void Add(DocumentCategorie documentcategorie)
 {
     foreach (DocumentCategorie categorie in DocumentCategorieList)
     {
         if (categorie.ParentGuid == documentcategorie.Guid)
         {
             categorie.Parent = documentcategorie;
             documentcategorie.AddSon(categorie);
         }
         if (documentcategorie.ParentGuid == categorie.Guid)
         {
             documentcategorie.Parent = categorie;
             categorie.AddSon(documentcategorie);
         }
     }
     DocumentCategorieList.Add(documentcategorie);
 }
Exemple #3
0
 private void AddTreeNode(DocumentCategorie ca, TreeNode parentnode)
 {
     TreeNode node = new TreeNode();
     node.Text = ca.Text;
     node.Tag = ca;
     parentnode.Nodes.Add(node);
     foreach (Document_DocumentCategories dcategorie in DocumentAndCategorieList)
     {
         if (dcategorie.CategorieGuid == ca.Guid && dcategorie.Document != null)
         {
             TreeNode infonode = new TreeNode();
             infonode.Text =dcategorie.Document.Title;
             infonode.Tag = dcategorie.Document;
             infonode.ImageIndex = 2;
             infonode.SelectedImageIndex = 2;
             node.Nodes.Add(infonode);
         }
     }
     foreach (DocumentCategorie cason in ca.Sons)
     {
         AddTreeNode(cason, node);
     }
 }
Exemple #4
0
 /// <summary>
 /// 添加子
 /// </summary>
 /// <param name="son"></param>
 public void AddSon(DocumentCategorie son)
 {
     _CSons.Add(son);
 }