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