public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.PACKING.PACKING_PREFERENCE_MODEL model, params string[] updateProperties) { Apps.Models.PACKING_PREFERENCE entity = m_Rep.GetById(model.INTERNAL_PREF_NUM); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_PREF_NUM = model.INTERNAL_PREF_NUM; entity.PREFERENCE_NAME = model.PREFERENCE_NAME; entity.AUTO_ASSIGN_CONTAINER_ID = model.AUTO_ASSIGN_CONTAINER_ID; } else { Type type = typeof(Apps.Models.SCV.PACKING.PACKING_PREFERENCE_MODEL); Type typeE = typeof(Apps.Models.PACKING_PREFERENCE); 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.PACKING.PACKING_PREFERENCE_MODEL model) { Apps.Models.PACKING_PREFERENCE entity = m_Rep.GetById(model.INTERNAL_PREF_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.PACKING_PREFERENCE(); entity.INTERNAL_PREF_NUM = model.INTERNAL_PREF_NUM; entity.PREFERENCE_NAME = model.PREFERENCE_NAME; entity.AUTO_ASSIGN_CONTAINER_ID = model.AUTO_ASSIGN_CONTAINER_ID; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.PACKING.PACKING_PREFERENCE_MODEL GetById(string id) { Apps.Models.PACKING_PREFERENCE entity = m_Rep.GetById(id); if (entity != null) { //PACKING_PREFERENCE entity = m_Rep.GetById(id); Apps.Models.SCV.PACKING.PACKING_PREFERENCE_MODEL model = new Apps.Models.SCV.PACKING.PACKING_PREFERENCE_MODEL(); model.INTERNAL_PREF_NUM = entity.INTERNAL_PREF_NUM; model.PREFERENCE_NAME = entity.PREFERENCE_NAME; model.AUTO_ASSIGN_CONTAINER_ID = entity.AUTO_ASSIGN_CONTAINER_ID; return(model); } else { return(null); } }