public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.UPLOAD.UPLOAD_OBJECT_MODEL model, params string[] updateProperties) { Apps.Models.UPLOAD_OBJECT entity = m_Rep.GetById(model.INTERNAL_NUM); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_NUM = model.INTERNAL_NUM; entity.UPLOAD_KEY = model.UPLOAD_KEY; entity.UPLOAD_COMPANY = model.UPLOAD_COMPANY; entity.UPLOAD_TYPE = model.UPLOAD_TYPE; entity.USER_DEF1 = model.USER_DEF1; entity.USER_DEF2 = model.USER_DEF2; entity.USER_DEF3 = model.USER_DEF3; entity.USER_DEF4 = model.USER_DEF4; } else { Type type = typeof(Apps.Models.SCV.UPLOAD.UPLOAD_OBJECT_MODEL); Type typeE = typeof(Apps.Models.UPLOAD_OBJECT); 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.UPLOAD.UPLOAD_OBJECT_MODEL model) { Apps.Models.UPLOAD_OBJECT entity = m_Rep.GetById(model.INTERNAL_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.UPLOAD_OBJECT(); entity.INTERNAL_NUM = model.INTERNAL_NUM; entity.UPLOAD_KEY = model.UPLOAD_KEY; entity.UPLOAD_COMPANY = model.UPLOAD_COMPANY; entity.UPLOAD_TYPE = model.UPLOAD_TYPE; entity.USER_DEF1 = model.USER_DEF1; entity.USER_DEF2 = model.USER_DEF2; entity.USER_DEF3 = model.USER_DEF3; entity.USER_DEF4 = model.USER_DEF4; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.UPLOAD.UPLOAD_OBJECT_MODEL GetById(string id) { Apps.Models.UPLOAD_OBJECT entity = m_Rep.GetById(id); if (entity != null) { //UPLOAD_OBJECT entity = m_Rep.GetById(id); Apps.Models.SCV.UPLOAD.UPLOAD_OBJECT_MODEL model = new Apps.Models.SCV.UPLOAD.UPLOAD_OBJECT_MODEL(); model.INTERNAL_NUM = entity.INTERNAL_NUM; model.UPLOAD_KEY = entity.UPLOAD_KEY; model.UPLOAD_COMPANY = entity.UPLOAD_COMPANY; model.UPLOAD_TYPE = entity.UPLOAD_TYPE; model.USER_DEF1 = entity.USER_DEF1; model.USER_DEF2 = entity.USER_DEF2; model.USER_DEF3 = entity.USER_DEF3; model.USER_DEF4 = entity.USER_DEF4; return(model); } else { return(null); } }