salespersonsummary.cs

来自「基于sqlserver2k,reporting service的扩展(auth,」· CS 代码 · 共 545 行 · 第 1/2 页

CS
545
字号
                return new EmployeeDataTable();
            }
            
            internal void InitVars() {
                this.columnEmployeeID = this.Columns["EmployeeID"];
                this.columnEmployeeName = this.Columns["EmployeeName"];
                this.columnTitle = this.Columns["Title"];
                this.columnHireDate = this.Columns["HireDate"];
                this.columnSales = this.Columns["Sales"];
                this.columnNoOrders = this.Columns["NoOrders"];
                this.columnYear = this.Columns["Year"];
                this.columnMonth = this.Columns["Month"];
            }
            
            private void InitClass() {
                this.columnEmployeeID = new DataColumn("EmployeeID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnEmployeeID);
                this.columnEmployeeName = new DataColumn("EmployeeName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnEmployeeName);
                this.columnTitle = new DataColumn("Title", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnTitle);
                this.columnHireDate = new DataColumn("HireDate", typeof(System.DateTime), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnHireDate);
                this.columnSales = new DataColumn("Sales", typeof(System.Decimal), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnSales);
                this.columnNoOrders = new DataColumn("NoOrders", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnNoOrders);
                this.columnYear = new DataColumn("Year", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnYear);
                this.columnMonth = new DataColumn("Month", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnMonth);
                this.columnEmployeeID.AutoIncrement = true;
                this.columnEmployeeID.AllowDBNull = false;
                this.columnEmployeeID.ReadOnly = true;
                this.columnEmployeeName.AllowDBNull = false;
                this.columnSales.ReadOnly = true;
                this.columnNoOrders.ReadOnly = true;
            }
            
            public EmployeeRow NewEmployeeRow() {
                return ((EmployeeRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new EmployeeRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(EmployeeRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.EmployeeRowChanged != null)) {
                    this.EmployeeRowChanged(this, new EmployeeRowChangeEvent(((EmployeeRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.EmployeeRowChanging != null)) {
                    this.EmployeeRowChanging(this, new EmployeeRowChangeEvent(((EmployeeRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.EmployeeRowDeleted != null)) {
                    this.EmployeeRowDeleted(this, new EmployeeRowChangeEvent(((EmployeeRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.EmployeeRowDeleting != null)) {
                    this.EmployeeRowDeleting(this, new EmployeeRowChangeEvent(((EmployeeRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveEmployeeRow(EmployeeRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class EmployeeRow : DataRow {
            
            private EmployeeDataTable tableEmployee;
            
            internal EmployeeRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableEmployee = ((EmployeeDataTable)(this.Table));
            }
            
            public int EmployeeID {
                get {
                    return ((int)(this[this.tableEmployee.EmployeeIDColumn]));
                }
                set {
                    this[this.tableEmployee.EmployeeIDColumn] = value;
                }
            }
            
            public string EmployeeName {
                get {
                    return ((string)(this[this.tableEmployee.EmployeeNameColumn]));
                }
                set {
                    this[this.tableEmployee.EmployeeNameColumn] = value;
                }
            }
            
            public string Title {
                get {
                    try {
                        return ((string)(this[this.tableEmployee.TitleColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableEmployee.TitleColumn] = value;
                }
            }
            
            public System.DateTime HireDate {
                get {
                    try {
                        return ((System.DateTime)(this[this.tableEmployee.HireDateColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableEmployee.HireDateColumn] = value;
                }
            }
            
            public System.Decimal Sales {
                get {
                    try {
                        return ((System.Decimal)(this[this.tableEmployee.SalesColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableEmployee.SalesColumn] = value;
                }
            }
            
            public int NoOrders {
                get {
                    try {
                        return ((int)(this[this.tableEmployee.NoOrdersColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableEmployee.NoOrdersColumn] = value;
                }
            }
            
            public int Year {
                get {
                    try {
                        return ((int)(this[this.tableEmployee.YearColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableEmployee.YearColumn] = value;
                }
            }
            
            public int Month {
                get {
                    try {
                        return ((int)(this[this.tableEmployee.MonthColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableEmployee.MonthColumn] = value;
                }
            }
            
            public bool IsTitleNull() {
                return this.IsNull(this.tableEmployee.TitleColumn);
            }
            
            public void SetTitleNull() {
                this[this.tableEmployee.TitleColumn] = System.Convert.DBNull;
            }
            
            public bool IsHireDateNull() {
                return this.IsNull(this.tableEmployee.HireDateColumn);
            }
            
            public void SetHireDateNull() {
                this[this.tableEmployee.HireDateColumn] = System.Convert.DBNull;
            }
            
            public bool IsSalesNull() {
                return this.IsNull(this.tableEmployee.SalesColumn);
            }
            
            public void SetSalesNull() {
                this[this.tableEmployee.SalesColumn] = System.Convert.DBNull;
            }
            
            public bool IsNoOrdersNull() {
                return this.IsNull(this.tableEmployee.NoOrdersColumn);
            }
            
            public void SetNoOrdersNull() {
                this[this.tableEmployee.NoOrdersColumn] = System.Convert.DBNull;
            }
            
            public bool IsYearNull() {
                return this.IsNull(this.tableEmployee.YearColumn);
            }
            
            public void SetYearNull() {
                this[this.tableEmployee.YearColumn] = System.Convert.DBNull;
            }
            
            public bool IsMonthNull() {
                return this.IsNull(this.tableEmployee.MonthColumn);
            }
            
            public void SetMonthNull() {
                this[this.tableEmployee.MonthColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class EmployeeRowChangeEvent : EventArgs {
            
            private EmployeeRow eventRow;
            
            private DataRowAction eventAction;
            
            public EmployeeRowChangeEvent(EmployeeRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public EmployeeRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}

⌨️ 快捷键说明

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