コード例 #1
0
ファイル: Category.cs プロジェクト: drme/disks-db
 public Category(string name, string description, long id, IDBLayer idb, Category parent)
     : base(idb, id)
 {
     this.name = name.Trim();
     this.description = description.Trim();
     this.parent = parent;
 }
コード例 #2
0
ファイル: Box.cs プロジェクト: drme/disks-db
 public Box(String name, String comment, long id, Image back, Image inlay, BoxType type, Image front, IDBLayer idb, Category parent)
     : base(idb, id)
 {
     this.parent = parent;
     this.name = name;
     this.desc = comment;
     this.type = type;
     this.front = front;
     this.back = back;
     this.inlay = inlay;
 }
コード例 #3
0
ファイル: SearchResultRow.cs プロジェクト: drme/disks-db
 public SearchResultRow(string fileName, int fileSize, int fileType, DateTime fileDate, Disk disk, Box box, Category category, string diskName, string boxName, string categoryName)
     : base(fileName)
 {
     this.fileName = fileName;
     this.fileSize = fileSize;
     this.fileType = fileType;
     this.fileDate = fileDate;
     this.disk = disk;
     this.box = box;
     this.category = category;
     this.diskName = diskName;
     this.boxName = boxName;
     this.categoryName = categoryName;
 }
コード例 #4
0
ファイル: MsAccessDBLayer.cs プロジェクト: drme/disks-db
 public void UpdateCDBox(Box box, String newName, String newDescription, Image newBack, Image newFront, Image newInlay, BoxType newType, Category newParent)
 {
     DBUtils.UpdateSQL(this.DBConString, "UPDATE [CDBoxes] SET [Description] = ?, [Name] = ?, [BackImage] = ?, [InlayImage] = ?, [Type] = ?,  [FrontImage] = ?, [Category]	= ?, [LastUpdate] = NOW() WHERE [id] = ?", new object[] {newDescription, newName, newBack.Id, newInlay.Id, newType.Id, newFront.Id, newParent.Id, box.Id});
 }
コード例 #5
0
ファイル: MsAccessDBLayer.cs プロジェクト: drme/disks-db
 public void UpdateCategory(Category category, String newName, String newDescription, Category newParent)
 {
     DBUtils.UpdateSQL(this.DBConString, "UPDATE Categories SET Name = ?, Description = ?, Parent = ?, LastUpdate = NOW WHERE id = ?", new object[] {newName, newDescription, newParent.Id, category.Id});
 }
コード例 #6
0
ファイル: MsAccessDBLayer.cs プロジェクト: drme/disks-db
        public Category GetRootCategory()
        {
            using (OleDbDataReader myReader = DBUtils.ExecSQL(this.DBConString, "SELECT Name, id, Description FROM Categories WHERE Parent IS NULL", null))
            {
                Category cat = null;

                if (true == myReader.Read())
                {
                    cat = new Category((string)myReader["Name"], (string)myReader["Description"], (int)myReader["id"], this, null);
                }

                return cat;
            }
        }
コード例 #7
0
ファイル: MsAccessDBLayer.cs プロジェクト: drme/disks-db
        public List<Box> GetChildCDBoxes(Category parentCat)
        {
            using (OleDbDataReader myReader = DBUtils.ExecSQL(this.DBConString, "SELECT [id], [Description], [Name], [BackImage], [InlayImage], [Type], [FrontImage] FROM [CDBoxes] WHERE [Category] = ? ORDER BY [Name]", new object[] { parentCat.Id }))
            {
                List<Box> lst = new List<Box>();

                while (true == myReader.Read())
                {
                    Box box = new Box((string)(myReader["Name"]), (string)(myReader["Description"]),
                                      (int)(myReader["id"]),
                                      db.BackImages.GetImage((int)myReader["BackImage"]),
                                      db.InlayImages.GetImage((int)myReader["InlayImage"]),
                                      GetCDBoxType((int)myReader["Type"]),
                                      db.FrontImages.GetImage((int)myReader["FrontImage"]),
                                      this, parentCat);
                    lst.Add(box);
                }

                return lst;
            }
        }
コード例 #8
0
ファイル: MsAccessDBLayer.cs プロジェクト: drme/disks-db
        public List<Category> GetChildCategories(Category parentCat)
        {
            using (OleDbDataReader myReader = DBUtils.ExecSQL(this.DBConString, "SELECT Name, id, Description FROM Categories WHERE Parent = ? ORDER BY Name", new Object[] { parentCat.Id }))
            {
                List<Category> lst = new List<Category>();

                while (true == myReader.Read())
                {
                    Category cat = new Category((String)myReader["Name"], (myReader["Description"] is DBNull) ? "" : (string)myReader["Description"], (int)myReader["id"], this, parentCat);

                    lst.Add(cat);
                }

                myReader.Close();

                return lst;
            }
        }
コード例 #9
0
ファイル: MsAccessDBLayer.cs プロジェクト: drme/disks-db
        public void DeleteCategory(Category category)
        {
            foreach (Category c in category.ChildCategories)
            {
                DeleteCategory(c);
            }

            DBUtils.DeleteSQL(this.DBConString, "DELETE FROM Categories WHERE id = ?", new object[] {category.Id});
        }
コード例 #10
0
ファイル: MsAccessDBLayer.cs プロジェクト: drme/disks-db
        public Box AddCDBox(String name, String description, BoxType type, Image frontImage, Image backImage, Image inlayImage, Category cat)
        {
            int id = DBUtils.InsertSQL(this.DBConString, "INSERT INTO [CDBoxes] ([Description], [Name], [BackImage], [InlayImage], [Type], [FrontImage], [Category]) VALUES(?, ?, ?, ?, ?, ?, ?)", new object[] {description, name, backImage.Id, inlayImage.Id, type.Id, frontImage.Id, cat.Id});

            return new Box(name, description, id, backImage, inlayImage, type, frontImage, this, cat);
        }
コード例 #11
0
ファイル: MsAccessDBLayer.cs プロジェクト: drme/disks-db
        public Category AddCategory(String name, String description, Category parent)
        {
            int id = DBUtils.InsertSQL(this.DBConString, "INSERT INTO Categories (Name, Parent, Description) VALUES(?, ?, ?)", new object[] {name, parent.Id, description});

            return new Category(name, description, id, this, parent);
        }
コード例 #12
0
ファイル: Category.cs プロジェクト: drme/disks-db
        bool IsValidMove(Category newParent)
        {
            if (null == newParent)
            {
                return true;
            }

            if (newParent == this)
            {
                return false;
            }
            else
            {
                return IsValidMove(newParent.Parent);
            }
        }