public virtual Apps.Models.SCV.INTERFACE.INTERFACE_TABLE_STATISTIC_MODEL GetById(string id) { Apps.Models.INTERFACE_TABLE_STATISTIC entity = m_Rep.GetById(id); if (entity != null) { //INTERFACE_TABLE_STATISTIC entity = m_Rep.GetById(id); Apps.Models.SCV.INTERFACE.INTERFACE_TABLE_STATISTIC_MODEL model = new Apps.Models.SCV.INTERFACE.INTERFACE_TABLE_STATISTIC_MODEL(); model.FUNCTION_AREA = entity.FUNCTION_AREA; model.FROM_TABLE = entity.FROM_TABLE; model.TO_TABLE = entity.TO_TABLE; model.DIRECTION = entity.DIRECTION; model.FROM_STATISTIC_SQL = entity.FROM_STATISTIC_SQL; model.TO_STATISTIC_SQL = entity.TO_STATISTIC_SQL; model.LINK_FIELD = entity.LINK_FIELD; model.USER = entity.USER; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; model.ACTIVE = entity.ACTIVE; return(model); } else { return(null); } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.INTERFACE.INTERFACE_TABLE_STATISTIC_MODEL model) { Apps.Models.INTERFACE_TABLE_STATISTIC entity = m_Rep.GetById(model.FUNCTION_AREA); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.INTERFACE_TABLE_STATISTIC(); entity.FUNCTION_AREA = model.FUNCTION_AREA; entity.FROM_TABLE = model.FROM_TABLE; entity.TO_TABLE = model.TO_TABLE; entity.DIRECTION = model.DIRECTION; entity.FROM_STATISTIC_SQL = model.FROM_STATISTIC_SQL; entity.TO_STATISTIC_SQL = model.TO_STATISTIC_SQL; entity.LINK_FIELD = model.LINK_FIELD; entity.USER = model.USER; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.ACTIVE = model.ACTIVE; m_Rep.Create(entity); }
public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.INTERFACE.INTERFACE_TABLE_STATISTIC_MODEL model, params string[] updateProperties) { Apps.Models.INTERFACE_TABLE_STATISTIC entity = m_Rep.GetById(model.FUNCTION_AREA); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.FUNCTION_AREA = model.FUNCTION_AREA; entity.FROM_TABLE = model.FROM_TABLE; entity.TO_TABLE = model.TO_TABLE; entity.DIRECTION = model.DIRECTION; entity.FROM_STATISTIC_SQL = model.FROM_STATISTIC_SQL; entity.TO_STATISTIC_SQL = model.TO_STATISTIC_SQL; entity.LINK_FIELD = model.LINK_FIELD; entity.USER = model.USER; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.ACTIVE = model.ACTIVE; } else { Type type = typeof(Apps.Models.SCV.INTERFACE.INTERFACE_TABLE_STATISTIC_MODEL); Type typeE = typeof(Apps.Models.INTERFACE_TABLE_STATISTIC); foreach (var item in updateProperties) { System.Reflection.PropertyInfo pi = type.GetProperty(item); System.Reflection.PropertyInfo piE = typeE.GetProperty(item); piE.SetValue(entity, pi.GetValue(model), null); } } m_Rep.Modify(entity, updateProperties); }