public EditableEntity(Type sqlClientEntityType) { this.m_sqlClientEntity = Activator.CreateInstance(sqlClientEntityType) as MyGeneration.dOOdads.SqlClientEntity; if (this.m_sqlClientEntity == null) { throw new Exception("Can't create SqlClientEntity of type " + sqlClientEntityType.ToString()); } }
public static int GetEntityValueInt(SqlClientEntity entity, string columnName) { int entityValueInt = 0; if (!entity.IsColumnNull(columnName)) { try { entityValueInt = int.Parse(entity.GetColumn(columnName).ToString()); } catch { } } return entityValueInt; }
public static decimal GetEntityValueDecimal(SqlClientEntity entity, string columnName) { decimal entityValueDecimal = 0; if (!entity.IsColumnNull(columnName)) { try { entityValueDecimal = Convert.ToDecimal(entity.GetColumn(columnName).ToString()); } catch { } } return entityValueDecimal; }
public static bool GetEntityValueBool(SqlClientEntity entity, string columnName) { bool entityValueBoll = false; if (!entity.IsColumnNull(columnName)) { try { entityValueBoll = Convert.ToBoolean(entity.GetColumn(columnName).ToString()); } catch { } } return entityValueBoll; }
public EditableEntity(MyGeneration.dOOdads.SqlClientEntity e) { m_sqlClientEntity = e; }
public static bool SetWhereParamValue(ref SqlClientEntity entity, string valueName, object value) { PropertyInfo wherePropertyInfo = entity.GetType().GetProperty("Where"); if (wherePropertyInfo == null) return false; object wherePropertyValue = wherePropertyInfo.GetValue(entity, null); if (wherePropertyValue == null) return false; PropertyInfo whereParamPropertyInfo = wherePropertyValue.GetType().GetProperty(valueName); if (whereParamPropertyInfo == null) return false; WhereParameter whereParamValue = whereParamPropertyInfo.GetValue(wherePropertyValue, null) as WhereParameter; if (whereParamValue == null) return false; whereParamValue.Value = value; return true; }