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

📄 dsmaster.cs

📁 东软内部材料(六)ado .net相关
💻 CS
📖 第 1 页 / 共 3 页
字号:
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.CustomerListRowDeleted != null)) {
                    this.CustomerListRowDeleted(this, new CustomerListRowChangeEvent(((CustomerListRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.CustomerListRowDeleting != null)) {
                    this.CustomerListRowDeleting(this, new CustomerListRowChangeEvent(((CustomerListRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveCustomerListRow(CustomerListRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class CustomerListRow : DataRow {
            
            private CustomerListDataTable tableCustomerList;
            
            internal CustomerListRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableCustomerList = ((CustomerListDataTable)(this.Table));
            }
            
            public string CustomerID {
                get {
                    return ((string)(this[this.tableCustomerList.CustomerIDColumn]));
                }
                set {
                    this[this.tableCustomerList.CustomerIDColumn] = value;
                }
            }
            
            public string CompanyName {
                get {
                    return ((string)(this[this.tableCustomerList.CompanyNameColumn]));
                }
                set {
                    this[this.tableCustomerList.CompanyNameColumn] = value;
                }
            }
            
            public string City {
                get {
                    try {
                        return ((string)(this[this.tableCustomerList.CityColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableCustomerList.CityColumn] = value;
                }
            }
            
            public string Country {
                get {
                    try {
                        return ((string)(this[this.tableCustomerList.CountryColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableCustomerList.CountryColumn] = value;
                }
            }
            
            public string PostalCode {
                get {
                    try {
                        return ((string)(this[this.tableCustomerList.PostalCodeColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableCustomerList.PostalCodeColumn] = value;
                }
            }
            
            public string Region {
                get {
                    try {
                        return ((string)(this[this.tableCustomerList.RegionColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableCustomerList.RegionColumn] = value;
                }
            }
            
            public bool IsCityNull() {
                return this.IsNull(this.tableCustomerList.CityColumn);
            }
            
            public void SetCityNull() {
                this[this.tableCustomerList.CityColumn] = System.Convert.DBNull;
            }
            
            public bool IsCountryNull() {
                return this.IsNull(this.tableCustomerList.CountryColumn);
            }
            
            public void SetCountryNull() {
                this[this.tableCustomerList.CountryColumn] = System.Convert.DBNull;
            }
            
            public bool IsPostalCodeNull() {
                return this.IsNull(this.tableCustomerList.PostalCodeColumn);
            }
            
            public void SetPostalCodeNull() {
                this[this.tableCustomerList.PostalCodeColumn] = System.Convert.DBNull;
            }
            
            public bool IsRegionNull() {
                return this.IsNull(this.tableCustomerList.RegionColumn);
            }
            
            public void SetRegionNull() {
                this[this.tableCustomerList.RegionColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class CustomerListRowChangeEvent : EventArgs {
            
            private CustomerListRow eventRow;
            
            private DataRowAction eventAction;
            
            public CustomerListRowChangeEvent(CustomerListRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public CustomerListRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class EmployeeListDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnEmployeeID;
            
            private DataColumn columnFirstName;
            
            private DataColumn columnLastName;
            
            private DataColumn columnFullName;
            
            internal EmployeeListDataTable() : 
                    base("EmployeeList") {
                this.InitClass();
            }
            
            internal EmployeeListDataTable(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 EmployeeIDColumn {
                get {
                    return this.columnEmployeeID;
                }
            }
            
            internal DataColumn FirstNameColumn {
                get {
                    return this.columnFirstName;
                }
            }
            
            internal DataColumn LastNameColumn {
                get {
                    return this.columnLastName;
                }
            }
            
            internal DataColumn FullNameColumn {
                get {
                    return this.columnFullName;
                }
            }
            
            public EmployeeListRow this[int index] {
                get {
                    return ((EmployeeListRow)(this.Rows[index]));
                }
            }
            
            public event EmployeeListRowChangeEventHandler EmployeeListRowChanged;
            
            public event EmployeeListRowChangeEventHandler EmployeeListRowChanging;
            
            public event EmployeeListRowChangeEventHandler EmployeeListRowDeleted;
            
            public event EmployeeListRowChangeEventHandler EmployeeListRowDeleting;
            
            public void AddEmployeeListRow(EmployeeListRow row) {
                this.Rows.Add(row);
            }
            
            public EmployeeListRow AddEmployeeListRow(string FirstName, string LastName, string FullName) {
                EmployeeListRow rowEmployeeListRow = ((EmployeeListRow)(this.NewRow()));
                rowEmployeeListRow.ItemArray = new object[] {
                        null,
                        FirstName,
                        LastName,
                        FullName};
                this.Rows.Add(rowEmployeeListRow);
                return rowEmployeeListRow;
            }
            
            public EmployeeListRow FindByEmployeeID(int EmployeeID) {
                return ((EmployeeListRow)(this.Rows.Find(new object[] {
                            EmployeeID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                EmployeeListDataTable cln = ((EmployeeListDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new EmployeeListDataTable();
            }
            
            internal void InitVars() {
                this.columnEmployeeID = this.Columns["EmployeeID"];
                this.columnFirstName = this.Columns["FirstName"];
                this.columnLastName = this.Columns["LastName"];
                this.columnFullName = this.Columns["FullName"];
            }
            
            private void InitClass() {
                this.columnEmployeeID = new DataColumn("EmployeeID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnEmployeeID);
                this.columnFirstName = new DataColumn("FirstName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnFirstName);
                this.columnLastName = new DataColumn("LastName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnLastName);
                this.columnFullName = new DataColumn("FullName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnFullName);
                this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
                                this.columnEmployeeID}, true));
                this.columnEmployeeID.AutoIncrement = true;
                this.columnEmployeeID.AllowDBNull = false;
                this.columnEmployeeID.ReadOnly = true;
                this.columnEmployeeID.Unique = true;
                this.columnFirstName.AllowDBNull = false;
                this.columnLastName.AllowDBNull = false;
                this.columnFullName.Expression = "[FirstName] + \' \' + [LastName]";
                this.columnFullName.ReadOnly = true;
            }
            
            public EmployeeListRow NewEmployeeListRow() {
                return ((EmployeeListRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new EmployeeListRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(EmployeeListRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.EmployeeListRowChanged != null)) {
                    this.EmployeeListRowChanged(this, new EmployeeListRowChangeEvent(((EmployeeListRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.EmployeeListRowChanging != null)) {
                    this.EmployeeListRowChanging(this, new EmployeeListRowChangeEvent(((EmployeeListRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.EmployeeListRowDeleted != null)) {
                    this.EmployeeListRowDeleted(this, new EmployeeListRowChangeEvent(((EmployeeListRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.EmployeeListRowDeleting != null)) {
                    this.EmployeeListRowDeleting(this, new EmployeeListRowChangeEvent(((EmployeeListRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveEmployeeListRow(EmployeeListRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class EmployeeListRow : DataRow {
            
            private EmployeeListDataTable tableEmployeeList;
            
            internal EmployeeListRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableEmployeeList = ((EmployeeListDataTable)(this.Table));
            }
            
            public int EmployeeID {
                get {
                    return ((int)(this[this.tableEmployeeList.EmployeeIDColumn]));
                }
                set {
                    this[this.tableEmployeeList.EmployeeIDColumn] = value;
                }
            }
            
            public string FirstName {
                get {
                    return ((string)(this[this.tableEmployeeList.FirstNameColumn]));
                }
                set {
                    this[this.tableEmployeeList.FirstNameColumn] = value;
                }
            }
            
            public string LastName {

⌨️ 快捷键说明

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