public virtual Apps.Models.SCV.Sys.ATTRIBUTE_MODEL GetById(string id) { Apps.Models.ATTRIBUTE entity = m_Rep.GetById(id); if (entity != null) { //ATTRIBUTE entity = m_Rep.GetById(id); Apps.Models.SCV.Sys.ATTRIBUTE_MODEL model = new Apps.Models.SCV.Sys.ATTRIBUTE_MODEL(); model.ATTRIBUTE_NUM = entity.ATTRIBUTE_NUM; model.ITEM = entity.ITEM; model.COMPANY = entity.COMPANY; model.ATTRIBUTE1 = entity.ATTRIBUTE1; model.ATTRIBUTE2 = entity.ATTRIBUTE2; model.ATTRIBUTE3 = entity.ATTRIBUTE3; model.ATTRIBUTE4 = entity.ATTRIBUTE4; model.ATTRIBUTE5 = entity.ATTRIBUTE5; model.ATTRIBUTE6 = entity.ATTRIBUTE6; model.ATTRIBUTE7 = entity.ATTRIBUTE7; model.ATTRIBUTE8 = entity.ATTRIBUTE8; model.USER_STAMP = entity.USER_STAMP; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; return(model); } else { return(null); } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.Sys.ATTRIBUTE_MODEL model) { Apps.Models.ATTRIBUTE entity = m_Rep.GetById(model.ATTRIBUTE_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.ATTRIBUTE(); entity.ATTRIBUTE_NUM = model.ATTRIBUTE_NUM; entity.ITEM = model.ITEM; entity.COMPANY = model.COMPANY; entity.ATTRIBUTE1 = model.ATTRIBUTE1; entity.ATTRIBUTE2 = model.ATTRIBUTE2; entity.ATTRIBUTE3 = model.ATTRIBUTE3; entity.ATTRIBUTE4 = model.ATTRIBUTE4; entity.ATTRIBUTE5 = model.ATTRIBUTE5; entity.ATTRIBUTE6 = model.ATTRIBUTE6; entity.ATTRIBUTE7 = model.ATTRIBUTE7; entity.ATTRIBUTE8 = model.ATTRIBUTE8; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; m_Rep.Create(entity); }
public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.ATTRIBUTE_MODEL model, params string[] updateProperties) { Apps.Models.ATTRIBUTE entity = m_Rep.GetById(model.ATTRIBUTE_NUM); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.ATTRIBUTE_NUM = model.ATTRIBUTE_NUM; entity.ITEM = model.ITEM; entity.COMPANY = model.COMPANY; entity.ATTRIBUTE1 = model.ATTRIBUTE1; entity.ATTRIBUTE2 = model.ATTRIBUTE2; entity.ATTRIBUTE3 = model.ATTRIBUTE3; entity.ATTRIBUTE4 = model.ATTRIBUTE4; entity.ATTRIBUTE5 = model.ATTRIBUTE5; entity.ATTRIBUTE6 = model.ATTRIBUTE6; entity.ATTRIBUTE7 = model.ATTRIBUTE7; entity.ATTRIBUTE8 = model.ATTRIBUTE8; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; } else { Type type = typeof(Apps.Models.SCV.Sys.ATTRIBUTE_MODEL); Type typeE = typeof(Apps.Models.ATTRIBUTE); 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); }