public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.USER.USER_ZONE_AUTH_MODEL model, params string[] updateProperties) { Apps.Models.USER_ZONE_AUTH entity = m_Rep.GetById(model.ZONE); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.ZONE = model.ZONE; entity.ZONE_NAME = model.ZONE_NAME; entity.USER_ID = model.USER_ID; entity.USER_NAME = model.USER_NAME; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; } else { Type type = typeof(Apps.Models.SCV.USER.USER_ZONE_AUTH_MODEL); Type typeE = typeof(Apps.Models.USER_ZONE_AUTH); 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.USER.USER_ZONE_AUTH_MODEL model) { Apps.Models.USER_ZONE_AUTH entity = m_Rep.GetById(model.ZONE); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.USER_ZONE_AUTH(); entity.ZONE = model.ZONE; entity.ZONE_NAME = model.ZONE_NAME; entity.USER_ID = model.USER_ID; entity.USER_NAME = model.USER_NAME; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.USER.USER_ZONE_AUTH_MODEL GetById(string id) { Apps.Models.USER_ZONE_AUTH entity = m_Rep.GetById(id); if (entity != null) { //USER_ZONE_AUTH entity = m_Rep.GetById(id); Apps.Models.SCV.USER.USER_ZONE_AUTH_MODEL model = new Apps.Models.SCV.USER.USER_ZONE_AUTH_MODEL(); model.ZONE = entity.ZONE; model.ZONE_NAME = entity.ZONE_NAME; model.USER_ID = entity.USER_ID; model.USER_NAME = entity.USER_NAME; model.USER_STAMP = entity.USER_STAMP; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; return(model); } else { return(null); } }