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

📄 dsphoto.cs

📁 这个是网上相册系统的一个架构设计说明
💻 CS
📖 第 1 页 / 共 3 页
字号:
                            PhotoID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                PhotoDataTable cln = ((PhotoDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new PhotoDataTable();
            }
            
            internal void InitVars() {
                this.columnPhotoID = this.Columns["PhotoID"];
                this.columnPhotoName = this.Columns["PhotoName"];
                this.columnPublisher = this.Columns["Publisher"];
                this.columnDescription = this.Columns["Description"];
                this.columnCategoryID = this.Columns["CategoryID"];
                this.columnKeyword1 = this.Columns["Keyword1"];
                this.columnKeyword2 = this.Columns["Keyword2"];
                this.columnKeyword3 = this.Columns["Keyword3"];
            }
            
            private void InitClass() {
                this.columnPhotoID = new DataColumn("PhotoID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnPhotoID);
                this.columnPhotoName = new DataColumn("PhotoName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnPhotoName);
                this.columnPublisher = new DataColumn("Publisher", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnPublisher);
                this.columnDescription = new DataColumn("Description", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDescription);
                this.columnCategoryID = new DataColumn("CategoryID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCategoryID);
                this.columnKeyword1 = new DataColumn("Keyword1", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnKeyword1);
                this.columnKeyword2 = new DataColumn("Keyword2", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnKeyword2);
                this.columnKeyword3 = new DataColumn("Keyword3", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnKeyword3);
                this.Constraints.Add(new UniqueConstraint("DSPhotoKey2", new DataColumn[] {
                                this.columnPhotoID}, true));
                this.columnPhotoID.AutoIncrement = true;
                this.columnPhotoID.AllowDBNull = false;
                this.columnPhotoID.ReadOnly = true;
                this.columnPhotoID.Unique = true;
                this.columnPhotoName.AllowDBNull = false;
                this.columnPublisher.AllowDBNull = false;
                this.columnCategoryID.AllowDBNull = false;
            }
            
            public PhotoRow NewPhotoRow() {
                return ((PhotoRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new PhotoRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(PhotoRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.PhotoRowChanged != null)) {
                    this.PhotoRowChanged(this, new PhotoRowChangeEvent(((PhotoRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.PhotoRowChanging != null)) {
                    this.PhotoRowChanging(this, new PhotoRowChangeEvent(((PhotoRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.PhotoRowDeleted != null)) {
                    this.PhotoRowDeleted(this, new PhotoRowChangeEvent(((PhotoRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.PhotoRowDeleting != null)) {
                    this.PhotoRowDeleting(this, new PhotoRowChangeEvent(((PhotoRow)(e.Row)), e.Action));
                }
            }
            
            public void RemovePhotoRow(PhotoRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class PhotoRow : DataRow {
            
            private PhotoDataTable tablePhoto;
            
            internal PhotoRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablePhoto = ((PhotoDataTable)(this.Table));
            }
            
            public int PhotoID {
                get {
                    return ((int)(this[this.tablePhoto.PhotoIDColumn]));
                }
                set {
                    this[this.tablePhoto.PhotoIDColumn] = value;
                }
            }
            
            public string PhotoName {
                get {
                    return ((string)(this[this.tablePhoto.PhotoNameColumn]));
                }
                set {
                    this[this.tablePhoto.PhotoNameColumn] = value;
                }
            }
            
            public int Publisher {
                get {
                    return ((int)(this[this.tablePhoto.PublisherColumn]));
                }
                set {
                    this[this.tablePhoto.PublisherColumn] = value;
                }
            }
            
            public string Description {
                get {
                    try {
                        return ((string)(this[this.tablePhoto.DescriptionColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablePhoto.DescriptionColumn] = value;
                }
            }
            
            public int CategoryID {
                get {
                    return ((int)(this[this.tablePhoto.CategoryIDColumn]));
                }
                set {
                    this[this.tablePhoto.CategoryIDColumn] = value;
                }
            }
            
            public string Keyword1 {
                get {
                    try {
                        return ((string)(this[this.tablePhoto.Keyword1Column]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablePhoto.Keyword1Column] = value;
                }
            }
            
            public string Keyword2 {
                get {
                    try {
                        return ((string)(this[this.tablePhoto.Keyword2Column]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablePhoto.Keyword2Column] = value;
                }
            }
            
            public string Keyword3 {
                get {
                    try {
                        return ((string)(this[this.tablePhoto.Keyword3Column]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablePhoto.Keyword3Column] = value;
                }
            }
            
            public CategoryRow CategoryRow {
                get {
                    return ((CategoryRow)(this.GetParentRow(this.Table.ParentRelations["CategoryPhoto"])));
                }
                set {
                    this.SetParentRow(value, this.Table.ParentRelations["CategoryPhoto"]);
                }
            }
            
            public bool IsDescriptionNull() {
                return this.IsNull(this.tablePhoto.DescriptionColumn);
            }
            
            public void SetDescriptionNull() {
                this[this.tablePhoto.DescriptionColumn] = System.Convert.DBNull;
            }
            
            public bool IsKeyword1Null() {
                return this.IsNull(this.tablePhoto.Keyword1Column);
            }
            
            public void SetKeyword1Null() {
                this[this.tablePhoto.Keyword1Column] = System.Convert.DBNull;
            }
            
            public bool IsKeyword2Null() {
                return this.IsNull(this.tablePhoto.Keyword2Column);
            }
            
            public void SetKeyword2Null() {
                this[this.tablePhoto.Keyword2Column] = System.Convert.DBNull;
            }
            
            public bool IsKeyword3Null() {
                return this.IsNull(this.tablePhoto.Keyword3Column);
            }
            
            public void SetKeyword3Null() {
                this[this.tablePhoto.Keyword3Column] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class PhotoRowChangeEvent : EventArgs {
            
            private PhotoRow eventRow;
            
            private DataRowAction eventAction;
            
            public PhotoRowChangeEvent(PhotoRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public PhotoRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}

⌨️ 快捷键说明

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