⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsphoto.cs

📁 这个是网上相册系统的一个架构设计说明
💻 CS
📖 第 1 页 / 共 3 页
字号:
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new CategoryDataTable();
            }
            
            internal void InitVars() {
                this.columnCategoryID = this.Columns["CategoryID"];
                this.columnCategoryName = this.Columns["CategoryName"];
                this.columnOwner = this.Columns["Owner"];
            }
            
            private void InitClass() {
                this.columnCategoryID = new DataColumn("CategoryID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCategoryID);
                this.columnCategoryName = new DataColumn("CategoryName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCategoryName);
                this.columnOwner = new DataColumn("Owner", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnOwner);
                this.Constraints.Add(new UniqueConstraint("DSPhotoKey1", new DataColumn[] {
                                this.columnCategoryID}, true));
                this.columnCategoryID.AutoIncrement = true;
                this.columnCategoryID.AllowDBNull = false;
                this.columnCategoryID.ReadOnly = true;
                this.columnCategoryID.Unique = true;
                this.columnCategoryName.AllowDBNull = false;
                this.columnOwner.AllowDBNull = false;
            }
            
            public CategoryRow NewCategoryRow() {
                return ((CategoryRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new CategoryRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(CategoryRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.CategoryRowChanged != null)) {
                    this.CategoryRowChanged(this, new CategoryRowChangeEvent(((CategoryRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.CategoryRowChanging != null)) {
                    this.CategoryRowChanging(this, new CategoryRowChangeEvent(((CategoryRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.CategoryRowDeleted != null)) {
                    this.CategoryRowDeleted(this, new CategoryRowChangeEvent(((CategoryRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.CategoryRowDeleting != null)) {
                    this.CategoryRowDeleting(this, new CategoryRowChangeEvent(((CategoryRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveCategoryRow(CategoryRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class CategoryRow : DataRow {
            
            private CategoryDataTable tableCategory;
            
            internal CategoryRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableCategory = ((CategoryDataTable)(this.Table));
            }
            
            public int CategoryID {
                get {
                    return ((int)(this[this.tableCategory.CategoryIDColumn]));
                }
                set {
                    this[this.tableCategory.CategoryIDColumn] = value;
                }
            }
            
            public string CategoryName {
                get {
                    return ((string)(this[this.tableCategory.CategoryNameColumn]));
                }
                set {
                    this[this.tableCategory.CategoryNameColumn] = value;
                }
            }
            
            public int Owner {
                get {
                    return ((int)(this[this.tableCategory.OwnerColumn]));
                }
                set {
                    this[this.tableCategory.OwnerColumn] = value;
                }
            }
            
            public PhotoRow[] GetPhotoRows() {
                return ((PhotoRow[])(this.GetChildRows(this.Table.ChildRelations["CategoryPhoto"])));
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class CategoryRowChangeEvent : EventArgs {
            
            private CategoryRow eventRow;
            
            private DataRowAction eventAction;
            
            public CategoryRowChangeEvent(CategoryRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public CategoryRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class PhotoDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnPhotoID;
            
            private DataColumn columnPhotoName;
            
            private DataColumn columnPublisher;
            
            private DataColumn columnDescription;
            
            private DataColumn columnCategoryID;
            
            private DataColumn columnKeyword1;
            
            private DataColumn columnKeyword2;
            
            private DataColumn columnKeyword3;
            
            internal PhotoDataTable() : 
                    base("Photo") {
                this.InitClass();
            }
            
            internal PhotoDataTable(DataTable table) : 
                    base(table.TableName) {
                if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
                    this.CaseSensitive = table.CaseSensitive;
                }
                if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
                    this.Locale = table.Locale;
                }
                if ((table.Namespace != table.DataSet.Namespace)) {
                    this.Namespace = table.Namespace;
                }
                this.Prefix = table.Prefix;
                this.MinimumCapacity = table.MinimumCapacity;
                this.DisplayExpression = table.DisplayExpression;
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            internal DataColumn PhotoIDColumn {
                get {
                    return this.columnPhotoID;
                }
            }
            
            internal DataColumn PhotoNameColumn {
                get {
                    return this.columnPhotoName;
                }
            }
            
            internal DataColumn PublisherColumn {
                get {
                    return this.columnPublisher;
                }
            }
            
            internal DataColumn DescriptionColumn {
                get {
                    return this.columnDescription;
                }
            }
            
            internal DataColumn CategoryIDColumn {
                get {
                    return this.columnCategoryID;
                }
            }
            
            internal DataColumn Keyword1Column {
                get {
                    return this.columnKeyword1;
                }
            }
            
            internal DataColumn Keyword2Column {
                get {
                    return this.columnKeyword2;
                }
            }
            
            internal DataColumn Keyword3Column {
                get {
                    return this.columnKeyword3;
                }
            }
            
            public PhotoRow this[int index] {
                get {
                    return ((PhotoRow)(this.Rows[index]));
                }
            }
            
            public event PhotoRowChangeEventHandler PhotoRowChanged;
            
            public event PhotoRowChangeEventHandler PhotoRowChanging;
            
            public event PhotoRowChangeEventHandler PhotoRowDeleted;
            
            public event PhotoRowChangeEventHandler PhotoRowDeleting;
            
            public void AddPhotoRow(PhotoRow row) {
                this.Rows.Add(row);
            }
            
            public PhotoRow AddPhotoRow(string PhotoName, int Publisher, string Description, CategoryRow parentCategoryRowByCategoryPhoto, string Keyword1, string Keyword2, string Keyword3) {
                PhotoRow rowPhotoRow = ((PhotoRow)(this.NewRow()));
                rowPhotoRow.ItemArray = new object[] {
                        null,
                        PhotoName,
                        Publisher,
                        Description,
                        parentCategoryRowByCategoryPhoto[0],
                        Keyword1,
                        Keyword2,
                        Keyword3};
                this.Rows.Add(rowPhotoRow);
                return rowPhotoRow;
            }
            
            public PhotoRow FindByPhotoID(int PhotoID) {
                return ((PhotoRow)(this.Rows.Find(new object[] {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -