📄 adorecordlist.cs
字号:
/** Copyright (c) 2006, All-In-One Creations, Ltd.* All rights reserved.* * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:* * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.* * Neither the name of All-In-One Creations, Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AREDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLEFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIALDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ORSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.**/using System;using System.Data;using EmergeTk.Model;using System.Collections.Generic;namespace EmergeTk.Model{ public class AdoRecordList : IRecordList, IRecordList<AbstractRecord> { private DataTable source; public AdoRecordList(DataTable source) { this.source = source; } #region IRecordList Members public int Count { get { return source.Rows.Count; } } public int CompareTo(object obj) { throw new System.NotImplementedException("not implemented."); } public System.Collections.Generic.List<SortInfo> Sorts { get { throw new Exception("The method or operation is not implemented."); } set { throw new Exception("The method or operation is not implemented."); } } public System.Collections.Generic.List<FilterInfo> Filters { get { throw new Exception("The method or operation is not implemented."); } set { throw new Exception("The method or operation is not implemented."); } } public AbstractRecord this[int index] { get { AdoRecord r = new AdoRecord(source.Rows[index]); return r; } set { throw new Exception("The method or operation is not implemented."); } } public bool Live { get { throw new Exception("The method or operation is not implemented."); } set { throw new Exception("The method or operation is not implemented."); } } public Type RecordType { get { return typeof(IRecord); } set { throw new Exception("The method or operation is not implemented."); } } public void Add(AbstractRecord value) { throw new Exception("The method or operation is not implemented."); } public void AddFilter(FilterInfo filterInfo) { throw new Exception("The method or operation is not implemented."); } public void Clear() { throw new Exception("The method or operation is not implemented."); } public bool Contains(AbstractRecord value) { throw new Exception("The method or operation is not implemented."); } public void Delete() { throw new Exception("The method or operation is not implemented."); } public void Filter() { throw new Exception("The method or operation is not implemented."); } public System.Collections.Generic.IEnumerator<AbstractRecord> GetEnumerator() { for (int i = 0; i < source.Rows.Count; i++) { yield return this[i]; } } public int IndexOf(AbstractRecord value) { throw new Exception("The method or operation is not implemented."); } public void Insert(int index, AbstractRecord value) { throw new Exception("The method or operation is not implemented."); } public bool IsReadOnly { get { throw new Exception("The method or operation is not implemented."); } } public AbstractRecord NewRow<T>() where T : AbstractRecord, new() { throw new Exception("The method or operation is not implemented."); } public AbstractRecord NewRow() { throw new Exception("The method or operation is not implemented."); } public void Remove(AbstractRecord value) { throw new Exception("The method or operation is not implemented."); } public void RemoveAt(int index) { throw new Exception("The method or operation is not implemented."); } public void Save() { throw new Exception("The method or operation is not implemented."); } public void Sort() { throw new Exception("The method or operation is not implemented."); } public string[] ToIdArray() { throw new Exception("The method or operation is not implemented."); } public string toJSON(EmergeTk.JSON.Type transportType, System.Collections.Generic.List<EmergeTk.DataGridColumn> columns, int pageIndex, int pageSize) { List<string> records = new List<string>(); for( int i = pageIndex * pageSize; (i < pageIndex * pageSize + pageSize )&& i < this.Count; i++ ) { System.Console.WriteLine("adding row"); records.Add(this[i].toJSON(transportType, columns )); } return JSON.ArrayToJSON( records ); } public string[] ToStringArray() { throw new Exception("The method or operation is not implemented."); } public string[] ToStringArray(string property) { throw new Exception("The method or operation is not implemented."); } public event RecordHandler OnRecordAdded; public event RecordHandler OnRecordChanged; public event RecordHandler OnRecordRemoved; #endregion public void DeleteAt(int i) { throw new Exception("The method or operation is not implemented."); } public void Delete(EmergeTk.Model.AbstractRecord r) { throw new Exception("The method or operation is not implemented."); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -