public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.USER.USER_COMPANY_AUTH_MODEL model, params string[] updateProperties) { Apps.Models.USER_COMPANY_AUTH entity = m_Rep.GetById(model.COMPANY); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.COMPANY = model.COMPANY; entity.COMPANY_NAME = model.COMPANY_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_COMPANY_AUTH_MODEL); Type typeE = typeof(Apps.Models.USER_COMPANY_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_COMPANY_AUTH_MODEL model) { Apps.Models.USER_COMPANY_AUTH entity = m_Rep.GetById(model.COMPANY); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.USER_COMPANY_AUTH(); entity.COMPANY = model.COMPANY; entity.COMPANY_NAME = model.COMPANY_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_COMPANY_AUTH_MODEL GetById(string id) { Apps.Models.USER_COMPANY_AUTH entity = m_Rep.GetById(id); if (entity != null) { //USER_COMPANY_AUTH entity = m_Rep.GetById(id); Apps.Models.SCV.USER.USER_COMPANY_AUTH_MODEL model = new Apps.Models.SCV.USER.USER_COMPANY_AUTH_MODEL(); model.COMPANY = entity.COMPANY; model.COMPANY_NAME = entity.COMPANY_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); } }