public static void InitPropertyList(String strTableName) { InitBasePropertyList(); if (PropertyList.ContainsKey(strTableName) == false) { Dictionary <String, PropertyInfo> innerList = new Dictionary <string, PropertyInfo>(); BusinessObject obj = BusinessObjectFactory.GetBusinessObject(strTableName); if (obj == null) { return; } PropertyInfo[] properties = obj.GetType().GetProperties(); foreach (PropertyInfo prop in properties) { if (IsBaseProperty(prop.Name) == false) { innerList.Add(prop.Name, prop); } } if (innerList.Count > 0) { PropertyList.Add(strTableName, innerList); } } }
public static BusinessObject GetBusinessObject(BusinessObject sourceObj, String strTableName) { BusinessObject obj = BusinessObjectFactory.GetBusinessObject(strTableName); obj.GetFromBusinessObject(sourceObj); return(obj); }
public BusinessObject SetToBusinessObject(String strDestTableName) { BusinessObject objResultObject = BusinessObjectFactory.GetBusinessObject(strDestTableName + "Info"); foreach (PropertyInfo destProp in BusinessObjectHelper.PropertyList[strDestTableName].Values) { PropertyInfo srcProp = BusinessObjectHelper.GetProperty(this.AATableName, destProp.Name); if (srcProp != null) { object objValue = ABCDynamicInvoker.GetValue(this, srcProp); ABCDynamicInvoker.SetValue(objResultObject, destProp, objValue); } } return(objResultObject); }
public static BusinessObject GetBusinessObject(DataRow row, String strTableName) { if (row == null) { return(null); } InitPropertyList(strTableName); Dictionary <String, PropertyInfo> lstInner = null; if (PropertyList.TryGetValue(strTableName, out lstInner) == false) { return(null); } #region ABCDynamicInvoker BusinessObject obj = BusinessObjectFactory.GetBusinessObject(strTableName); foreach (DataColumn column in row.Table.Columns) { object objValue = row[column]; if (objValue == System.DBNull.Value) { continue; } if (objValue.GetType() == typeof(Int64)) { objValue = Convert.ToInt32(objValue); } PropertyInfo property = null; lstInner.TryGetValue(column.ColumnName, out property); if (property != null) { ABCDynamicInvoker.SetValue(obj, property, objValue); } } return(obj); #endregion }