Exemplo n.º 1
0
 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());
     }
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 public EditableEntity(MyGeneration.dOOdads.SqlClientEntity e)
 {
     m_sqlClientEntity = e;
 }
Exemplo n.º 6
0
    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;
    }