public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.CONFIG.CONFIG_VALUE_MODEL model, params string[] updateProperties) { Apps.Models.CONFIG_VALUE entity = m_Rep.GetById(model.OBJECT_ID); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.OBJECT_ID = model.OBJECT_ID; entity.RECORD_TYPE = model.RECORD_TYPE; entity.IDENTIFIER = model.IDENTIFIER; entity.VALUE = model.VALUE; entity.DESCRIPTION = model.DESCRIPTION; entity.ACTIVE = model.ACTIVE; entity.SYSTEM_CREATED = model.SYSTEM_CREATED; } else { Type type = typeof(Apps.Models.SCV.CONFIG.CONFIG_VALUE_MODEL); Type typeE = typeof(Apps.Models.CONFIG_VALUE); 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); }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.CONFIG.CONFIG_VALUE_MODEL model) { Apps.Models.CONFIG_VALUE entity = m_Rep.GetById(model.OBJECT_ID); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.CONFIG_VALUE(); entity.OBJECT_ID = model.OBJECT_ID; entity.RECORD_TYPE = model.RECORD_TYPE; entity.IDENTIFIER = model.IDENTIFIER; entity.VALUE = model.VALUE; entity.DESCRIPTION = model.DESCRIPTION; entity.ACTIVE = model.ACTIVE; entity.SYSTEM_CREATED = model.SYSTEM_CREATED; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.CONFIG.CONFIG_VALUE_MODEL GetById(string id) { Apps.Models.CONFIG_VALUE entity = m_Rep.GetById(id); if (entity != null) { //CONFIG_VALUE entity = m_Rep.GetById(id); Apps.Models.SCV.CONFIG.CONFIG_VALUE_MODEL model = new Apps.Models.SCV.CONFIG.CONFIG_VALUE_MODEL(); model.OBJECT_ID = entity.OBJECT_ID; model.RECORD_TYPE = entity.RECORD_TYPE; model.IDENTIFIER = entity.IDENTIFIER; model.VALUE = entity.VALUE; model.DESCRIPTION = entity.DESCRIPTION; model.ACTIVE = entity.ACTIVE; model.SYSTEM_CREATED = entity.SYSTEM_CREATED; return(model); } else { return(null); } }