using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CZTS.COMM
{
//
/// 实体基类
///
[Serializable]
public abstract class EntityBaseBak
{
//private string _OrderBy = "";
/////
///// 排序
/////
//public string OrderBy
//{
// get { return _OrderBy; }
// set { _OrderBy = value; }
//}
private string _WhereSql = "";
///
/// 自定义查询条件
///
public string WhereSql
{
get
{
return this._WhereSql;
}
set
{
value = value.Trim().ToLower();
if (value.StartsWith("where"))
{
value = value.Substring(5, value.Length - 5);
}
this._WhereSql = value;
}
}
private EntityPersistType persistType;
///
/// 操作类型
///
public EntityPersistType PersistType
{
get { return persistType; }
set { persistType = value; }
}
///
/// 模块
///
public abstract string ModuleName { get; }
///
/// 排序
///
public abstract string OrderBy { get; set; }
private Dictionary _entydic;
///
/// 实体集合操作
///
public Dictionary EntyDic
{
get { return _entydic; }
set { _entydic = value; }
}
public Dictionary _values = new Dictionary();
///
/// 状态值属性
///
public Dictionary Values
{
get { return this._values; }
set { this._values = value; }
}
///
/// 属性值修改情况
///
/// 字段名称
/// 当前值
protected void ToChanaged(string FieldName, object currentValue)
{
if (Values.ContainsKey(FieldName))
{
EntityValue val = _values[FieldName];
if (object.Equals(val.OriginalValue, currentValue))
{
val.CurrentValue = null;
val.IsChanage = false;
}
else
{
val.CurrentValue = currentValue;
val.IsChanage = true;
}
}
}
///
/// 获得对象的值
///
/// 字段名称
///
protected object ToValue(string FieldName)
{
if (Values.ContainsKey(FieldName))
{
EntityValue val = _values[FieldName];
if (val.CurrentValue != null)
{
return val.CurrentValue;
}
if (val.OriginalValue != null)
{
return val.OriginalValue;
}
return null;
}
return null;
}
public abstract void GetEntity(string oid);
public abstract void GetEntity(DataAccess db);
}
}