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

📄 dscustomers.cs

📁 在。NET中
💻 CS
📖 第 1 页 / 共 2 页
字号:
            public event CustomersRowChangeEventHandler CustomersRowDeleted;
            
            public event CustomersRowChangeEventHandler CustomersRowDeleting;
            
            public void AddCustomersRow(CustomersRow row) {
                this.Rows.Add(row);
            }
            
            public CustomersRow AddCustomersRow(string CustID, string CompName, string ContName, string ContTitle) {
                CustomersRow rowCustomersRow = ((CustomersRow)(this.NewRow()));
                rowCustomersRow.ItemArray = new object[] {
                        CustID,
                        CompName,
                        ContName,
                        ContTitle};
                this.Rows.Add(rowCustomersRow);
                return rowCustomersRow;
            }
            
            public CustomersRow FindByCustID(string CustID) {
                return ((CustomersRow)(this.Rows.Find(new object[] {
                            CustID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                CustomersDataTable cln = ((CustomersDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new CustomersDataTable();
            }
            
            internal void InitVars() {
                this.columnCustID = this.Columns["CustID"];
                this.columnCompName = this.Columns["CompName"];
                this.columnContName = this.Columns["ContName"];
                this.columnContTitle = this.Columns["ContTitle"];
            }
            
            private void InitClass() {
                this.columnCustID = new DataColumn("CustID", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCustID);
                this.columnCompName = new DataColumn("CompName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCompName);
                this.columnContName = new DataColumn("ContName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnContName);
                this.columnContTitle = new DataColumn("ContTitle", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnContTitle);
                this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
                                this.columnCustID}, true));
                this.columnCustID.AllowDBNull = false;
                this.columnCustID.Unique = true;
                this.columnCompName.AllowDBNull = false;
            }
            
            public CustomersRow NewCustomersRow() {
                return ((CustomersRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new CustomersRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(CustomersRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.CustomersRowChanged != null)) {
                    this.CustomersRowChanged(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.CustomersRowChanging != null)) {
                    this.CustomersRowChanging(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.CustomersRowDeleted != null)) {
                    this.CustomersRowDeleted(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.CustomersRowDeleting != null)) {
                    this.CustomersRowDeleting(this, new CustomersRowChangeEvent(((CustomersRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveCustomersRow(CustomersRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class CustomersRow : DataRow {
            
            private CustomersDataTable tableCustomers;
            
            internal CustomersRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableCustomers = ((CustomersDataTable)(this.Table));
            }
            
            public string CustID {
                get {
                    return ((string)(this[this.tableCustomers.CustIDColumn]));
                }
                set {
                    this[this.tableCustomers.CustIDColumn] = value;
                }
            }
            
            public string CompName {
                get {
                    return ((string)(this[this.tableCustomers.CompNameColumn]));
                }
                set {
                    this[this.tableCustomers.CompNameColumn] = value;
                }
            }
            
            public string ContName {
                get {
                    try {
                        return ((string)(this[this.tableCustomers.ContNameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableCustomers.ContNameColumn] = value;
                }
            }
            
            public string ContTitle {
                get {
                    try {
                        return ((string)(this[this.tableCustomers.ContTitleColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableCustomers.ContTitleColumn] = value;
                }
            }
            
            public bool IsContNameNull() {
                return this.IsNull(this.tableCustomers.ContNameColumn);
            }
            
            public void SetContNameNull() {
                this[this.tableCustomers.ContNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsContTitleNull() {
                return this.IsNull(this.tableCustomers.ContTitleColumn);
            }
            
            public void SetContTitleNull() {
                this[this.tableCustomers.ContTitleColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class CustomersRowChangeEvent : EventArgs {
            
            private CustomersRow eventRow;
            
            private DataRowAction eventAction;
            
            public CustomersRowChangeEvent(CustomersRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public CustomersRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}

⌨️ 快捷键说明

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