public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.AUDIT.AUDIT_LOG_MODEL model, params string[] updateProperties) { Apps.Models.AUDIT_LOG entity = m_Rep.GetById(model.INTERNAL_ID); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_ID = model.INTERNAL_ID; entity.WAREHOUSE = model.WAREHOUSE; entity.MESSAGE = model.MESSAGE; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.USER_STAMP = model.USER_STAMP; entity.VALUE = model.VALUE; } else { Type type = typeof(Apps.Models.SCV.AUDIT.AUDIT_LOG_MODEL); Type typeE = typeof(Apps.Models.AUDIT_LOG); 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.AUDIT.AUDIT_LOG_MODEL model) { Apps.Models.AUDIT_LOG entity = m_Rep.GetById(model.INTERNAL_ID); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.AUDIT_LOG(); entity.INTERNAL_ID = model.INTERNAL_ID; entity.WAREHOUSE = model.WAREHOUSE; entity.MESSAGE = model.MESSAGE; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.USER_STAMP = model.USER_STAMP; entity.VALUE = model.VALUE; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.AUDIT.AUDIT_LOG_MODEL GetById(string id) { Apps.Models.AUDIT_LOG entity = m_Rep.GetById(id); if (entity != null) { //AUDIT_LOG entity = m_Rep.GetById(id); Apps.Models.SCV.AUDIT.AUDIT_LOG_MODEL model = new Apps.Models.SCV.AUDIT.AUDIT_LOG_MODEL(); model.INTERNAL_ID = entity.INTERNAL_ID; model.WAREHOUSE = entity.WAREHOUSE; model.MESSAGE = entity.MESSAGE; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; model.USER_STAMP = entity.USER_STAMP; model.VALUE = entity.VALUE; return(model); } else { return(null); } }