Exemple #1
0
 public static HEntityCommon HEntity(object _oE)
 {
     if (null == _oE)
         return null;
     HEntityCommon oEntity = new HEntityCommon(_oE);
     return oEntity;
 }
Exemple #2
0
 private string FormatSelectWhere(HEntityCommon _oE)
 {
     int nLength = _oE._activeEntity.ObjectFields.Length;
     StringBuilder sb = new StringBuilder("1=1");
     for (int i = 0; i < nLength; i++)
     {
         object oValue = _oE._activeEntity.ObjectFields[i].GetValue(_oE._activeEntity.ActiveObject);
         if (null != oValue)
         {
             string strWhere = FormatSelectValue(oValue, _oE._activeEntity.ObjectFields[i]);
             if (!string.IsNullOrEmpty(strWhere))
                 sb.Append(string.Format(" and {0}", strWhere));
         }
     }
     return sb.ToString();
 }
Exemple #3
0
 private static object[] ChangeTableToEntitys(HEntityCommon _oE, DataTable _dt)
 {
     if (null == _dt || _dt.Rows.Count == 0)
         return null;
     int nRowNum = _dt.Rows.Count;
     ArrayList alItems = new ArrayList();
     for (int i = 0; i < nRowNum; i++)
     {
         DataRow rowItem = _dt.Rows[i];
         object oInstance = Activator.CreateInstance(_oE._activeEntity.ObjectType);
         foreach (FieldInfo oF in _oE._activeEntity.ObjectFields)
         {
             if (rowItem[oF.Name] is DBNull)
                 oF.SetValue(oInstance, null);
             else
                 oF.SetValue(oInstance, rowItem[oF.Name]);
         }
         alItems.Add(oInstance);
     }
     return (object[])alItems.ToArray(_oE._activeEntity.ObjectType);
 }