/// <summary>
/// 自定义谓词
/// </summary>
public class VPredication : IEnumerable<KeyValuePair<string, object>>
{
Dictionary<string, object> dicv = null;
SpacePredication spacePredication = null;
/// <summary>
/// 区间谓词
/// </summary>
public SpacePredication SpacePredication { get { return this.spacePredication; } }

/// <summary>
/// 自定义区间 构造函数
/// </summary>
public VPredication()
{
spacePredication = new SpacePredication();
dicv = new Dictionary<string, object>();
}

/// <summary>
/// 验证键是否存在值
/// </summary>
/// <param name="index">键</param>
/// <returns>bool</returns>
public bool ContainsKey(string index)
{
return this.dicv.ContainsKey(index);
}

/// <summary>
/// 索引器
/// </summary>
/// <param name="index">索引值</param>
/// <returns>值</returns>
public object this[string index]
{
get
{
if (dicv.ContainsKey(index))
return dicv[index];
else
return null;
}
}


/// <summary>
/// 增加新项
/// </summary>
/// <param name="key">列枚举[只能接受非FLAG得单个枚举]</param>
/// <param name="extremumPair"></param>
public void AddItem(string key, object value)
{
this.dicv.Add(key, value);
}
/// <summary>
/// 移除制定 列枚举 的项
/// </summary>
/// <param name="key">列枚举[只能接受非FLAG得单个枚举]</param>
public void RemoveItem(string key)
{
this.dicv.Remove(key);
}

#region IEnumerable<KeyValuePair<string,object>> 成员

public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
return this.dicv.GetEnumerator();
}

#endregion

#region IEnumerable 成员

System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.dicv.GetEnumerator();
}

#endregion
}
/// <summary>
/// 区间谓词
/// </summary>
public class SpacePredication : IEnumerable<KeyValuePair<string, ExtremumPair>>
{
Dictionary<string, ExtremumPair> dic = null;
/// <summary>
/// 区间谓词 构造函数
/// </summary>
public SpacePredication()
{
dic = new Dictionary<string, ExtremumPair>();

}

/// <summary>
/// 索引器
/// </summary>
/// <param name="index">索引值</param>
/// <returns>区间极值值对</returns>
public ExtremumPair this[string index]
{
get { return dic[index]; }
}

/// <summary>
/// 验证键是否存在值
/// </summary>
/// <param name="index">键</param>
/// <returns>bool</returns>
public bool ContainsKey(string index)
{
return this.dic.ContainsKey(index);
}



/// <summary>
/// 增加新项
/// </summary>
/// <param name="_enum">列枚举[只能接受非FLAG得单个枚举]</param>
/// <param name="extremumPair"></param>
public void AddItem(string key, ExtremumPair extremumPair)
{
this.dic.Add(key, extremumPair);
}
/// <summary>
/// 移除制定 列枚举 的项
/// </summary>
/// <param name="key">列枚举[只能接受非FLAG得单个枚举]</param>
public void RemoveItem(string key)
{
this.dic.Remove(key);
}

#region IEnumerable<KeyValuePair<string,ExtremumPair>> 成员

public IEnumerator<KeyValuePair<string, ExtremumPair>> GetEnumerator()
{
return this.dic.GetEnumerator();
}

#endregion

#region IEnumerable 成员

System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.dic.GetEnumerator();
}

#endregion
}

/// <summary>
/// 区间极值值对
/// </summary>
public class ExtremumPair
{
object leftValue, rightValue;
/// <summary>
/// 左极值
/// </summary>
public object LeftValue { get { return leftValue; } }
/// <summary>
/// 右极值
/// </summary>
public object RightValue { get { return rightValue; } }
/// <summary>
/// 区间极值值对 构造函数
/// </summary>
/// <param name="leftValue">左极值</param>
/// <param name="rightValue">右极值</param>
public ExtremumPair(object leftValue, object rightValue)
{
this.leftValue = leftValue;
this.rightValue = rightValue;
}
}

/// <summary>
/// 通用分页参数
/// </summary>
public class PagingParam
{
int pageSize = 10;
int pageIndex = 1;
int pageTotal = -1;
/// <summary>
/// 页面大小
/// </summary>
public int PageSize { get { return pageSize; } }
/// <summary>
/// 页码
/// </summary>
public int PageIndex { get { return pageIndex; } }

public int PageTotal { get { return pageTotal; } }
/// 构造函数
/// </summary>
public PagingParam()
{
}
/// <summary>
/// 通用分页参数结构 构造函数
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">页面大小</param>
public PagingParam(int pageIndex, int pageSize)
{
this.pageIndex = pageIndex;
this.pageSize = pageSize;
this.pageTotal = PageSize;
}

public PagingParam(int pageIndex, int pageSize, int pageTotal)
{
this.pageIndex = pageIndex;
this.pageSize = pageSize;
this.pageTotal = pageTotal;
}

}

作者:仓储大叔,张占岭,
荣誉:微软MVP