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

📄 emp1.cs

📁 一个用oracle的odt开发数据库应用程序的例子
💻 CS
📖 第 1 页 / 共 2 页
字号:
                this.columnEMPNO = this.Columns["EMPNO"];
                this.columnENAME = this.Columns["ENAME"];
                this.columnJOB = this.Columns["JOB"];
                this.columnMGR = this.Columns["MGR"];
                this.columnHIREDATE = this.Columns["HIREDATE"];
                this.columnSAL = this.Columns["SAL"];
                this.columnCOMM = this.Columns["COMM"];
                this.columnDEPTNO = this.Columns["DEPTNO"];
            }
            
            private void InitClass() {
                this.columnEMPNO = new DataColumn("EMPNO", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnEMPNO);
                this.columnENAME = new DataColumn("ENAME", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnENAME);
                this.columnJOB = new DataColumn("JOB", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnJOB);
                this.columnMGR = new DataColumn("MGR", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnMGR);
                this.columnHIREDATE = new DataColumn("HIREDATE", typeof(System.DateTime), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnHIREDATE);
                this.columnSAL = new DataColumn("SAL", typeof(System.Single), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnSAL);
                this.columnCOMM = new DataColumn("COMM", typeof(System.Single), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCOMM);
                this.columnDEPTNO = new DataColumn("DEPTNO", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDEPTNO);
                this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
                                this.columnEMPNO}, true));
                this.columnEMPNO.AllowDBNull = false;
                this.columnEMPNO.Unique = true;
                this.columnEMPNO.DefaultValue = 0;
                this.columnENAME.MaxLength = 10;
                this.columnJOB.MaxLength = 9;
            }
            
            public EmpRow NewEmpRow() {
                return ((EmpRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new EmpRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(EmpRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.EmpRowChanged != null)) {
                    this.EmpRowChanged(this, new EmpRowChangeEvent(((EmpRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.EmpRowChanging != null)) {
                    this.EmpRowChanging(this, new EmpRowChangeEvent(((EmpRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.EmpRowDeleted != null)) {
                    this.EmpRowDeleted(this, new EmpRowChangeEvent(((EmpRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.EmpRowDeleting != null)) {
                    this.EmpRowDeleting(this, new EmpRowChangeEvent(((EmpRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveEmpRow(EmpRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class EmpRow : DataRow {
            
            private EmpDataTable tableEmp;
            
            internal EmpRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableEmp = ((EmpDataTable)(this.Table));
            }
            
            public short EMPNO {
                get {
                    return ((short)(this[this.tableEmp.EMPNOColumn]));
                }
                set {
                    this[this.tableEmp.EMPNOColumn] = value;
                }
            }
            
            public string ENAME {
                get {
                    try {
                        return ((string)(this[this.tableEmp.ENAMEColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableEmp.ENAMEColumn] = value;
                }
            }
            
            public string JOB {
                get {
                    try {
                        return ((string)(this[this.tableEmp.JOBColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableEmp.JOBColumn] = value;
                }
            }
            
            public short MGR {
                get {
                    try {
                        return ((short)(this[this.tableEmp.MGRColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableEmp.MGRColumn] = value;
                }
            }
            
            public System.DateTime HIREDATE {
                get {
                    try {
                        return ((System.DateTime)(this[this.tableEmp.HIREDATEColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableEmp.HIREDATEColumn] = value;
                }
            }
            
            public System.Single SAL {
                get {
                    try {
                        return ((System.Single)(this[this.tableEmp.SALColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableEmp.SALColumn] = value;
                }
            }
            
            public System.Single COMM {
                get {
                    try {
                        return ((System.Single)(this[this.tableEmp.COMMColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableEmp.COMMColumn] = value;
                }
            }
            
            public short DEPTNO {
                get {
                    try {
                        return ((short)(this[this.tableEmp.DEPTNOColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableEmp.DEPTNOColumn] = value;
                }
            }
            
            public bool IsENAMENull() {
                return this.IsNull(this.tableEmp.ENAMEColumn);
            }
            
            public void SetENAMENull() {
                this[this.tableEmp.ENAMEColumn] = System.Convert.DBNull;
            }
            
            public bool IsJOBNull() {
                return this.IsNull(this.tableEmp.JOBColumn);
            }
            
            public void SetJOBNull() {
                this[this.tableEmp.JOBColumn] = System.Convert.DBNull;
            }
            
            public bool IsMGRNull() {
                return this.IsNull(this.tableEmp.MGRColumn);
            }
            
            public void SetMGRNull() {
                this[this.tableEmp.MGRColumn] = System.Convert.DBNull;
            }
            
            public bool IsHIREDATENull() {
                return this.IsNull(this.tableEmp.HIREDATEColumn);
            }
            
            public void SetHIREDATENull() {
                this[this.tableEmp.HIREDATEColumn] = System.Convert.DBNull;
            }
            
            public bool IsSALNull() {
                return this.IsNull(this.tableEmp.SALColumn);
            }
            
            public void SetSALNull() {
                this[this.tableEmp.SALColumn] = System.Convert.DBNull;
            }
            
            public bool IsCOMMNull() {
                return this.IsNull(this.tableEmp.COMMColumn);
            }
            
            public void SetCOMMNull() {
                this[this.tableEmp.COMMColumn] = System.Convert.DBNull;
            }
            
            public bool IsDEPTNONull() {
                return this.IsNull(this.tableEmp.DEPTNOColumn);
            }
            
            public void SetDEPTNONull() {
                this[this.tableEmp.DEPTNOColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class EmpRowChangeEvent : EventArgs {
            
            private EmpRow eventRow;
            
            private DataRowAction eventAction;
            
            public EmpRowChangeEvent(EmpRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public EmpRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}

⌨️ 快捷键说明

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