public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.AREAS_MODEL model, params string[] updateProperties) { Apps.Models.AREAS 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.ID = model.ID; entity.PARENT_ID = model.PARENT_ID; entity.TYPE = model.TYPE; entity.ZIP = model.ZIP; entity.NAME = model.NAME; } else { Type type = typeof(Apps.Models.SCV.Sys.AREAS_MODEL); Type typeE = typeof(Apps.Models.AREAS); 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.Sys.AREAS_MODEL model) { Apps.Models.AREAS entity = m_Rep.GetById(model.INTERNAL_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.AREAS(); entity.INTERNAL_NUM = model.INTERNAL_NUM; entity.ID = model.ID; entity.PARENT_ID = model.PARENT_ID; entity.TYPE = model.TYPE; entity.ZIP = model.ZIP; entity.NAME = model.NAME; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.Sys.AREAS_MODEL GetById(string id) { Apps.Models.AREAS entity = m_Rep.GetById(id); if (entity != null) { //AREAS entity = m_Rep.GetById(id); Apps.Models.SCV.Sys.AREAS_MODEL model = new Apps.Models.SCV.Sys.AREAS_MODEL(); model.INTERNAL_NUM = entity.INTERNAL_NUM; model.ID = entity.ID; model.PARENT_ID = entity.PARENT_ID; model.TYPE = entity.TYPE; model.ZIP = entity.ZIP; model.NAME = entity.NAME; return(model); } else { return(null); } }