articleslist1.cs

来自「数字图书馆网站」· CS 代码 · 共 771 行 · 第 1/2 页

CS
771
字号
            
            internal ArticlesRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableArticles = ((ArticlesDataTable)(this.Table));
            }
            
            public int ArticleID {
                get {
                    return ((int)(this[this.tableArticles.ArticleIDColumn]));
                }
                set {
                    this[this.tableArticles.ArticleIDColumn] = value;
                }
            }
            
            public string FileName {
                get {
                    return ((string)(this[this.tableArticles.FileNameColumn]));
                }
                set {
                    this[this.tableArticles.FileNameColumn] = value;
                }
            }
            
            public string Abstract {
                get {
                    try {
                        return ((string)(this[this.tableArticles.AbstractColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableArticles.AbstractColumn] = value;
                }
            }
            
            public string Rating {
                get {
                    try {
                        return ((string)(this[this.tableArticles.RatingColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableArticles.RatingColumn] = value;
                }
            }
            
            public string Status {
                get {
                    try {
                        return ((string)(this[this.tableArticles.StatusColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableArticles.StatusColumn] = value;
                }
            }
            
            public string PostedBy {
                get {
                    try {
                        return ((string)(this[this.tableArticles.PostedByColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableArticles.PostedByColumn] = value;
                }
            }
            
            public string Category {
                get {
                    try {
                        return ((string)(this[this.tableArticles.CategoryColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableArticles.CategoryColumn] = value;
                }
            }
            
            public System.Decimal Price {
                get {
                    try {
                        return ((System.Decimal)(this[this.tableArticles.PriceColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableArticles.PriceColumn] = value;
                }
            }
            
            public bool IsAbstractNull() {
                return this.IsNull(this.tableArticles.AbstractColumn);
            }
            
            public void SetAbstractNull() {
                this[this.tableArticles.AbstractColumn] = System.Convert.DBNull;
            }
            
            public bool IsRatingNull() {
                return this.IsNull(this.tableArticles.RatingColumn);
            }
            
            public void SetRatingNull() {
                this[this.tableArticles.RatingColumn] = System.Convert.DBNull;
            }
            
            public bool IsStatusNull() {
                return this.IsNull(this.tableArticles.StatusColumn);
            }
            
            public void SetStatusNull() {
                this[this.tableArticles.StatusColumn] = System.Convert.DBNull;
            }
            
            public bool IsPostedByNull() {
                return this.IsNull(this.tableArticles.PostedByColumn);
            }
            
            public void SetPostedByNull() {
                this[this.tableArticles.PostedByColumn] = System.Convert.DBNull;
            }
            
            public bool IsCategoryNull() {
                return this.IsNull(this.tableArticles.CategoryColumn);
            }
            
            public void SetCategoryNull() {
                this[this.tableArticles.CategoryColumn] = System.Convert.DBNull;
            }
            
            public bool IsPriceNull() {
                return this.IsNull(this.tableArticles.PriceColumn);
            }
            
            public void SetPriceNull() {
                this[this.tableArticles.PriceColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class ArticlesRowChangeEvent : EventArgs {
            
            private ArticlesRow eventRow;
            
            private DataRowAction eventAction;
            
            public ArticlesRowChangeEvent(ArticlesRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public ArticlesRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class CategoryDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnCategory;
            
            private DataColumn columnCategoryID;
            
            internal CategoryDataTable() : 
                    base("Category") {
                this.InitClass();
            }
            
            internal CategoryDataTable(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 CategoryColumn {
                get {
                    return this.columnCategory;
                }
            }
            
            internal DataColumn CategoryIDColumn {
                get {
                    return this.columnCategoryID;
                }
            }
            
            public CategoryRow this[int index] {
                get {
                    return ((CategoryRow)(this.Rows[index]));
                }
            }
            
            public event CategoryRowChangeEventHandler CategoryRowChanged;
            
            public event CategoryRowChangeEventHandler CategoryRowChanging;
            
            public event CategoryRowChangeEventHandler CategoryRowDeleted;
            
            public event CategoryRowChangeEventHandler CategoryRowDeleting;
            
            public void AddCategoryRow(CategoryRow row) {
                this.Rows.Add(row);
            }
            
            public CategoryRow AddCategoryRow(string Category, int CategoryID) {
                CategoryRow rowCategoryRow = ((CategoryRow)(this.NewRow()));
                rowCategoryRow.ItemArray = new object[] {
                        Category,
                        CategoryID};
                this.Rows.Add(rowCategoryRow);
                return rowCategoryRow;
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                CategoryDataTable cln = ((CategoryDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new CategoryDataTable();
            }
            
            internal void InitVars() {
                this.columnCategory = this.Columns["Category"];
                this.columnCategoryID = this.Columns["CategoryID"];
            }
            
            private void InitClass() {
                this.columnCategory = new DataColumn("Category", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCategory);
                this.columnCategoryID = new DataColumn("CategoryID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCategoryID);
                this.columnCategory.AllowDBNull = false;
                this.columnCategoryID.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 string Category {
                get {
                    return ((string)(this[this.tableCategory.CategoryColumn]));
                }
                set {
                    this[this.tableCategory.CategoryColumn] = value;
                }
            }
            
            public int CategoryID {
                get {
                    return ((int)(this[this.tableCategory.CategoryIDColumn]));
                }
                set {
                    this[this.tableCategory.CategoryIDColumn] = value;
                }
            }
        }
        
        [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;
                }
            }
        }
    }
}

⌨️ 快捷键说明

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