public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.GENERIC.GENERIC_USER_AUTH_MODEL model, params string[] updateProperties) { Apps.Models.GENERIC_USER_AUTH entity = m_Rep.GetById(model.INTERNAL_AUTH_NUM); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_AUTH_NUM = model.INTERNAL_AUTH_NUM; entity.INTERNAL_USER_NUM = model.INTERNAL_USER_NUM; entity.USER_ID = model.USER_ID; entity.RECORD_TYPE = model.RECORD_TYPE; entity.AUTH_ITEM = model.AUTH_ITEM; entity.AUTH_ITEM_DESC = model.AUTH_ITEM_DESC; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; } else { Type type = typeof(Apps.Models.SCV.GENERIC.GENERIC_USER_AUTH_MODEL); Type typeE = typeof(Apps.Models.GENERIC_USER_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.GENERIC.GENERIC_USER_AUTH_MODEL model) { Apps.Models.GENERIC_USER_AUTH entity = m_Rep.GetById(model.INTERNAL_AUTH_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.GENERIC_USER_AUTH(); entity.INTERNAL_AUTH_NUM = model.INTERNAL_AUTH_NUM; entity.INTERNAL_USER_NUM = model.INTERNAL_USER_NUM; entity.USER_ID = model.USER_ID; entity.RECORD_TYPE = model.RECORD_TYPE; entity.AUTH_ITEM = model.AUTH_ITEM; entity.AUTH_ITEM_DESC = model.AUTH_ITEM_DESC; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.GENERIC.GENERIC_USER_AUTH_MODEL GetById(string id) { Apps.Models.GENERIC_USER_AUTH entity = m_Rep.GetById(id); if (entity != null) { //GENERIC_USER_AUTH entity = m_Rep.GetById(id); Apps.Models.SCV.GENERIC.GENERIC_USER_AUTH_MODEL model = new Apps.Models.SCV.GENERIC.GENERIC_USER_AUTH_MODEL(); model.INTERNAL_AUTH_NUM = entity.INTERNAL_AUTH_NUM; model.INTERNAL_USER_NUM = entity.INTERNAL_USER_NUM; model.USER_ID = entity.USER_ID; model.RECORD_TYPE = entity.RECORD_TYPE; model.AUTH_ITEM = entity.AUTH_ITEM; model.AUTH_ITEM_DESC = entity.AUTH_ITEM_DESC; model.USER_STAMP = entity.USER_STAMP; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; return(model); } else { return(null); } }