当前位置: 首页 > news >正文

做网站公司怎么开拓更多业务百度一下百度官网

做网站公司怎么开拓更多业务,百度一下百度官网,网页传奇发布网,焦溪翠冠梨做的网站对于大数据量的用户显示,B/S程序几乎清一色的使用分页的方式呈现,一般的,这种方式下用户会查看前几页的数据,当仍然没有找到他所需要的数据时,他会选择重新查询。 在C/S下的程序中,使用分页方式&#xff0c…
对于大数据量的用户显示,B/S程序几乎清一色的使用分页的方式呈现,一般的,这种方式下用户会查看前几页的数据,当仍然没有找到他所需要的数据时,他会选择重新查询。

在C/S下的程序中,使用分页方式,受到了一些挑战:

一方面,老的滚动条给用户留下了较好的体验,在任何界面下都照搬分页的方式显示,会给客户很不好的印象;

其次,C/S下的应用大多面向商业客户,这些程序涉及到成千上万的数据应用,事实上,大多数的数据量并不大,加上良好的事先条件(例如最近一周的订单),数据量往往不大,但因为分页的缘故,用户哪怕在300条记录的情况下,也要翻动五六下才能看见他的数据;

另外,由于分页的缘故,必然影响浏览时的SQL语句,以适应分页的需求,给程序的编写带来极大的复杂,而且最重要的是分页将本来就繁重的SQL变的更加缓慢,在ERP应用中,权限的条件已经很复杂了,如果再加上分页(我们使用的是双TOP加倒序的方式),SQL执行缓慢无比,比单纯的SQL慢的不是一个级别。

那么如何较好的解决这些问题呢?

首先,从源头开始抓,即默认给用户尽可能少数据量的查询,例如,在产品设计中,使用“我的订单”,或者是“最近一周需要处理的订单”,对于基础档案类的数据,可以尽量在浏览的左边安排一个分类树,以便仅显示此分类的数据。

其次,建立虚拟数据的方式,以便使用表格的方式展现大数据,他的原理是:

建立一个类,实现了IList接口;

表格控件的绑定一般使用IList接口,其中Count和this[int index]是必须实现的方法,Count我们可以通过获取所有Id的列表,得知总数,而实际的数据通过下面的预测性缓存技术获取;

第一次获取查询的所有ID列表,然后根据表格的请求,预测性的获取对应的数据。下面是部分演示代码: 

ContractedBlock.gifExpandedBlockStart.gif获取指定编号的数据
None.gif     private Dictionary<object, T> cacheData; //已经获取到的数据
None.gif

None.gif        
private int lastIndex = -1//最后一次访问的索引
None.gif

None.gif        
private const int ONE_PAGE_SIZE = 200//每次读取数据的页面大小
None.gif

None.gif 
None.gif
ExpandedBlockStart.gifContractedBlock.gif        
private T GetDataFromIndex(int index) dot.gif{
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif            
if ((index <0|| (index>ids.Count -1))dot.gif{
InBlock.gif
InBlock.gif                
throw new IndexOutOfRangeException();
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif 
InBlock.gif
InBlock.gif            
//获取Id的值
InBlock.gif

InBlock.gif            
object id = ids[index];
InBlock.gif
InBlock.gif 
InBlock.gif
InBlock.gif            
//检查Id是否存在缓存中
InBlock.gif

InBlock.gif            T result;
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif            
if (cacheData.TryGetValue(id,out result)) dot.gif{
InBlock.gif
InBlock.gif                
return result;
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif 
InBlock.gif
InBlock.gif            
//一定会加入当前需要检索的对象
InBlock.gif

InBlock.gif            List
<object> searchIds = new List<object>(); //需要寻找的Id列表
InBlock.gif

InBlock.gif            searchIds.Add(id);
InBlock.gif
InBlock.gif 
InBlock.gif
InBlock.gif            
//没有这个数据,根据上次访问的索引确定预测的方向
InBlock.gif

InBlock.gif            
int direction = 1 ; //=1 表示向前方向,=-1 表示向后方向
InBlock.gif

ExpandedSubBlockStart.gifContractedSubBlock.gif            
if (lastIndex <0dot.gif{
InBlock.gif
InBlock.gif                direction 
= 1;
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif            
else dot.gif{
InBlock.gif
InBlock.gif                direction 
= ((index >= lastIndex) ? 1 : -1 );
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            lastIndex 
= index;
InBlock.gif
InBlock.gif 
InBlock.gif
InBlock.gif            
//根据方向,将获取其以上的条或者其下面的条
InBlock.gif

InBlock.gif            
int newIndex = index + direction;
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif            
while ((newIndex >=0&& (newIndex < ids.Count) && (searchIds.Count <=ONE_PAGE_SIZE)) dot.gif{
InBlock.gif
InBlock.gif                id 
= ids[newIndex];
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif                
if (!cacheData.ContainsKey(id)) dot.gif{
InBlock.gif
InBlock.gif                    searchIds.Add(id);
InBlock.gif
ExpandedSubBlockEnd.gif                }

InBlock.gif
InBlock.gif                newIndex 
= newIndex + direction;
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif 
InBlock.gif
InBlock.gif            
//对获取到的数据进行读取
InBlock.gif

InBlock.gif            T[] data 
= GetData(searchIds);
InBlock.gif
InBlock.gif            
InBlock.gif
InBlock.gif            
//将获取到的数据放入缓存中
InBlock.gif

ExpandedSubBlockStart.gifContractedSubBlock.gif            
foreach (T item in data) dot.gif{
InBlock.gif
InBlock.gif                cacheData.Add(GetDataKey(item), item);
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif 
InBlock.gif
InBlock.gif            
//返回
InBlock.gif

InBlock.gif            
return cacheData[ids[index]];
InBlock.gif
ExpandedBlockEnd.gif        }

None.gif
None.gif 
None.gif
None.gif        
protected abstract T[] GetData(List<object> ids);
None.gif
None.gif 
None.gif
None.gif        
protected abstract object GetDataKey(T data);


通过这种方法,我在SQLServer下的测试,服务器的复杂非常的小,在10万笔记录下,基本上在1秒左右看见数据,滚动数据时基本上没有延迟。


当然,当前的实现还有需要改善的地方:

-          浏览时,实现读取的Id已经被删除,当滚动此数据后,要使次行空白或自动消失;

-          可以考虑首页并不获取所有Id,而是Top 100数据,当用户滚动数据时,才加载所有Id列表,这种设计主要是考虑翻页的概率很低,读取所有Id有些浪费,其次,对于数据量小于100的数据,实际执行了2次SQL,没有必要;

-          对于超过10万的记录,获取所有的Id也是很漫长的时间,可以考虑两种策略:1、异步分批下载所有Id,2、告诉用户数据太多了,程序只能处理10万,哈哈。

-          用户很无聊,拖动滚动条看遍所有数据,缓存的数据不断增加,应该考虑缓存的最大值,将旧的缓存删除;

-          在用户对连续的数据进行频繁的读取时,考虑自动增加每次的读取总数。

 

此方案给用户的体验是很好的,但可不是完美无缺的,他无法适应以下情况:

-          查询的结果是复杂的分组汇总查询,没有可以参考的Id列表,这样情况无法处理;

-          必须关闭表格控件的排序、分组和过滤功能,因为这些功能将促使表格访问所有的数据。

 

 下面包含了完整的代码仅供参考,但是你可能下载后无法运行,因为他使用了我们公司自己的ORM,你可以修改成自己的数据结构和读取方式。

ContractedBlock.gifExpandedBlockStart.gif参考代码
ExpandedBlockStart.gifContractedBlock.gif    public abstract class VList<T> : ICollection<T>,IList<T> ,IBindingListdot.gif{
InBlock.gif        
private List<object> ids;
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public VList(List<object> idsSource) dot.gif{
InBlock.gif            ids 
= idsSource;
InBlock.gif            cacheData 
= new Dictionary<object, T>();
ExpandedSubBlockEnd.gif        }

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
ICollection 成员#region ICollection<T> 成员
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void Add(T item) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void Clear() dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool Contains(T item) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void CopyTo(T[] array, int arrayIndex) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public int Count dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn ids.Count; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool IsReadOnly dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn true; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool Remove(T item) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
IEnumerable 成员#region IEnumerable<T> 成员
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public IEnumerator<T> GetEnumerator() dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
for (int i = 0; i < ids.Count; i++dot.gif{
InBlock.gif                yield 
return this[i];
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
IEnumerable 成员#region IEnumerable 成员
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() 
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
for (int i = 0; i < ids.Count; i++dot.gif{
InBlock.gif                yield 
return this[i];
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
IList 成员#region IList<T> 成员
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public int IndexOf(T item) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void Insert(int index, T item) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void RemoveAt(int index) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public T this[int index] dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gif{
InBlock.gif                
return GetDataFromIndex(index);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{
InBlock.gif                
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
InBlock.gif        
private Dictionary<object, T> cacheData; //已经获取到的数据的Id
InBlock.gif
        private int lastIndex = -1//最后一次访问的索引
InBlock.gif
        private const int ONE_PAGE_SIZE = 200//每次读取数据的页面大小
InBlock.gif

ExpandedSubBlockStart.gifContractedSubBlock.gif        
private T GetDataFromIndex(int index) dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
if ((index <0|| (index>ids.Count -1))dot.gif{
InBlock.gif                
throw new IndexOutOfRangeException();
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
//获取Id的值
InBlock.gif
            object id = ids[index];
InBlock.gif
InBlock.gif            
//检查Id是否存在缓存中
InBlock.gif
            T result;
ExpandedSubBlockStart.gifContractedSubBlock.gif            
if (cacheData.TryGetValue(id,out result)) dot.gif{
InBlock.gif                
return result;
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
//一定会加入当前需要检索的对象
InBlock.gif
            List<object> searchIds = new List<object>(); //需要寻找的Id列表
InBlock.gif
            searchIds.Add(id);
InBlock.gif
InBlock.gif            
//没有这个数据,根据上次访问的索引确定预测的方向
InBlock.gif
            int direction = 1 ; //=1 表示向前方向,=-1 表示向后方向
ExpandedSubBlockStart.gifContractedSubBlock.gif
            if (lastIndex <0dot.gif{
InBlock.gif                direction 
= 1;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockStart.gifContractedSubBlock.gif            
else dot.gif{
InBlock.gif                direction 
= ((index >= lastIndex) ? 1 : -1 );
ExpandedSubBlockEnd.gif            }

InBlock.gif            lastIndex 
= index;
InBlock.gif
InBlock.gif            
//根据方向,将获取其以上的100条或者其下面的100条
InBlock.gif
            int newIndex = index + direction;
ExpandedSubBlockStart.gifContractedSubBlock.gif            
while ((newIndex >=0&& (newIndex < ids.Count) && (searchIds.Count <=ONE_PAGE_SIZE)) dot.gif{
InBlock.gif                id 
= ids[newIndex];
ExpandedSubBlockStart.gifContractedSubBlock.gif                
if (!cacheData.ContainsKey(id)) dot.gif{
InBlock.gif                    searchIds.Add(id);
ExpandedSubBlockEnd.gif                }

InBlock.gif                newIndex 
= newIndex + direction;
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
//对获取到的数据进行读取
InBlock.gif
            T[] data = GetData(searchIds);
InBlock.gif            
InBlock.gif            
//将获取到的数据放入缓存中
ExpandedSubBlockStart.gifContractedSubBlock.gif
            foreach (T item in data) dot.gif{
InBlock.gif                cacheData.Add(GetDataKey(item), item);
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
//返回
InBlock.gif
            return cacheData[ids[index]];
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
protected abstract T[] GetData(List<object> ids);
InBlock.gif
InBlock.gif        
protected abstract object GetDataKey(T data);
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
IBindingList 成员#region IBindingList 成员
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void AddIndex(PropertyDescriptor property) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public object AddNew() dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool AllowEdit dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn false; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool AllowNew dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn false; ; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool AllowRemove dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn false; ; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void ApplySort(PropertyDescriptor property, ListSortDirection direction) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public int Find(PropertyDescriptor property, object key) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool IsSorted dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn false ; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public event ListChangedEventHandler ListChanged;
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void RemoveIndex(PropertyDescriptor property) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void RemoveSort() dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public ListSortDirection SortDirection dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn ListSortDirection.Ascending; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public PropertyDescriptor SortProperty dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn null; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool SupportsChangeNotification dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn false; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool SupportsSearching dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn false ; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool SupportsSorting dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn false; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
IList 成员#region IList 成员
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public int Add(object value) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool Contains(object value) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public int IndexOf(object value) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void Insert(int index, object value) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool IsFixedSize dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gif{return true; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void Remove(object value) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
object System.Collections.IList.this[int index] dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gif{
InBlock.gif                
return GetDataFromIndex(index);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gif{
InBlock.gif                
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
ICollection 成员#region ICollection 成员
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public void CopyTo(Array array, int index) dot.gif{
InBlock.gif            
throw new Exception("The method or operation is not implemented.");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public bool IsSynchronized dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn false; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public object SyncRoot dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn this; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

ExpandedBlockEnd.gif    }

None.gif
ExpandedBlockStart.gifContractedBlock.gif    
public sealed class AccountList : VList<Account> dot.gif{
InBlock.gif        
private IDocumentService service;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public AccountList() : base(GetIds()) dot.gif{
InBlock.gif            Dcms.Common.Torridity.DataSource.SQLServer.SqlServerDriver driver 
= new Dcms.Common.Torridity.DataSource.SQLServer.SqlServerDriver();
InBlock.gif            driver.ConnectionString 
= Settings.Default.Crm070413ConnectionString;
InBlock.gif            service 
= OrmEntry.CreateDocumentService(OrmEntry.GetDataEntityType(typeof(Account)), driver);
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
private static List<object> GetIds() dot.gif{
InBlock.gif            List
<object> ids = new List<object>();
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif            
using (SqlConnection con = new SqlConnection(Settings.Default.Crm070413ConnectionString)) dot.gif{
InBlock.gif                con.Open();
ExpandedSubBlockStart.gifContractedSubBlock.gif                
using (SqlCommand cmd = new SqlCommand("Select AccountId FROM Account Order By Code", con)) dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleResult)) dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
while (reader.Read()) dot.gif{
InBlock.gif                            ids.Add(reader.GetString(
0));
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        reader.Close();
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

InBlock.gif                con.Close();
ExpandedSubBlockEnd.gif            }

InBlock.gif            
return ids;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
protected override Account[] GetData(List<object> ids) dot.gif{
InBlock.gif            
object[] result = service.Read(ids.ToArray(), false);
InBlock.gif            Account[] r2 
= new Account[result.Length];
InBlock.gif            Array.Copy(result, r2, result.Length);
InBlock.gif
InBlock.gif            Console.WriteLine(
"Read Data");
InBlock.gif
InBlock.gif            
return r2;
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
protected override object GetDataKey(Account data) dot.gif{
InBlock.gif            
return data.AccountId;
ExpandedSubBlockEnd.gif        }

ExpandedBlockEnd.gif    }

和表格控件绑定的代码:
ExpandedBlockStart.gifContractedBlock.gif        private void button2_Click(object sender, EventArgs e) dot.gif{
InBlock.gif            list 
= new AccountList();
InBlock.gif            gridControl1.DataSource 
= list;
ExpandedBlockEnd.gif        }

转载于:https://www.cnblogs.com/tansm/archive/2007/04/27/729513.html

http://www.lbrq.cn/news/2395441.html

相关文章:

  • 网站建设活动定制网站制作公司
  • 公众号注册入口官网重庆网络seo
  • 网站后台管理怎么做官网百度
  • 广东网站制作报价百度竞价官网
  • 品牌建设提升seo按照搜索引擎的什么对网站
  • 哪里有建站代理加盟百度问一问付费咨询
  • 郑州网站网站建设精准营销通俗来说是什么
  • 深圳专业网站建设公怎样建网站赚钱
  • 自己电脑怎么做网站官网建站多少钱
  • 哪个网站可以做初一政治试卷西安官网seo
  • 学做软件的网站有哪些内容营销型网站建设报价
  • pc端网站今日国内重大新闻事件
  • vs网站模态框怎么做百度关键词排名优化
  • behance app下载seo关键词优化软件官网
  • 什么网站做家电测评关键词查网址
  • 珠海电脑自己建网站福州百度seo代理
  • 自己做的网站能联网吗企业品牌类网站有哪些
  • 自建网站工具广告优化师是做什么的
  • 网站做sem优化国外市场网站推广公司
  • 湘潭做网站买转发链接
  • wordpress 有缓存吗seo网站关键词排名软件
  • 可以做cps合作的棋牌网站6排超最新积分榜
  • 潍坊做网站教程产品品牌推广策划方案
  • 网站远程图片市场营销推广策划方案
  • 东莞网站建设制作百度推广优化是什么?
  • 做金融的看哪些网站网站营销网
  • 微网站自己怎么做的吗百度seo查询收录查询
  • 济宁专业做网站重庆seo网络推广优化
  • 营销型企业网站推广的方法有哪些志鸿优化设计答案
  • 网站怎么做快照五个常用的搜索引擎
  • 基于朴素贝叶斯的姓名性别预测系统
  • PCB 混合介质叠层:材料特性匹配与性能提升的技术解析
  • 基于单片机智能插座设计/智能开关
  • 使用 Gunicorn 部署 Django 项目
  • js中的微任务和宏任务的理解
  • JavaScript笔记