public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.USER_MODEL model, params string[] updateProperties) { Apps.Models.USER entity = m_Rep.GetById(model.INTERNAL_USER_NUM); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_USER_NUM = model.INTERNAL_USER_NUM; entity.USER_ID = model.USER_ID; entity.DESCRIPTION = model.DESCRIPTION; entity.DEPARTMENT = model.DEPARTMENT; entity.ACTIVE = model.ACTIVE; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.DEFAULT_WHS = model.DEFAULT_WHS; entity.DEFAULT_RECV_PREF = model.DEFAULT_RECV_PREF; entity.DEFAULT_SHIP_PREF = model.DEFAULT_SHIP_PREF; entity.DEFAULT_TASK_PREF = model.DEFAULT_TASK_PREF; entity.ROLE = model.ROLE; entity.PERSONAL_DIR = model.PERSONAL_DIR; entity.IMAGE_URL = model.IMAGE_URL; entity.TITLE = model.TITLE; entity.GENDER = model.GENDER; entity.MOBILE = model.MOBILE; entity.PHONE = model.PHONE; entity.EMAIL = model.EMAIL; entity.USER_DEF1 = model.USER_DEF1; entity.USER_DEF2 = model.USER_DEF2; entity.USER_DEF3 = model.USER_DEF3; entity.USER_DEF4 = model.USER_DEF4; entity.USER_DEF5 = model.USER_DEF5; entity.USER_DEF6 = model.USER_DEF6; entity.USER_DEF7 = model.USER_DEF7; entity.USER_DEF8 = model.USER_DEF8; entity.CREATE_DATE_TIME = model.CREATE_DATE_TIME; entity.CREATE_USER = model.CREATE_USER; entity.USER_DEF9 = model.USER_DEF9; entity.USER_DEF10 = model.USER_DEF10; } else { Type type = typeof(Apps.Models.SCV.Sys.USER_MODEL); Type typeE = typeof(Apps.Models.USER); 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 Apps.Models.SCV.Sys.USER_MODEL GetById(string id) { Apps.Models.USER entity = m_Rep.GetById(id); if (entity != null) { //USER entity = m_Rep.GetById(id); Apps.Models.SCV.Sys.USER_MODEL model = new Apps.Models.SCV.Sys.USER_MODEL(); model.INTERNAL_USER_NUM = entity.INTERNAL_USER_NUM; model.USER_ID = entity.USER_ID; model.DESCRIPTION = entity.DESCRIPTION; model.DEPARTMENT = entity.DEPARTMENT; model.ACTIVE = entity.ACTIVE; model.USER_STAMP = entity.USER_STAMP; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; model.DEFAULT_WHS = entity.DEFAULT_WHS; model.DEFAULT_RECV_PREF = entity.DEFAULT_RECV_PREF; model.DEFAULT_SHIP_PREF = entity.DEFAULT_SHIP_PREF; model.DEFAULT_TASK_PREF = entity.DEFAULT_TASK_PREF; model.ROLE = entity.ROLE; model.PERSONAL_DIR = entity.PERSONAL_DIR; model.IMAGE_URL = entity.IMAGE_URL; model.TITLE = entity.TITLE; model.GENDER = entity.GENDER; model.MOBILE = entity.MOBILE; model.PHONE = entity.PHONE; model.EMAIL = entity.EMAIL; model.USER_DEF1 = entity.USER_DEF1; model.USER_DEF2 = entity.USER_DEF2; model.USER_DEF3 = entity.USER_DEF3; model.USER_DEF4 = entity.USER_DEF4; model.USER_DEF5 = entity.USER_DEF5; model.USER_DEF6 = entity.USER_DEF6; model.USER_DEF7 = entity.USER_DEF7; model.USER_DEF8 = entity.USER_DEF8; model.CREATE_DATE_TIME = entity.CREATE_DATE_TIME; model.CREATE_USER = entity.CREATE_USER; model.USER_DEF9 = entity.USER_DEF9; model.USER_DEF10 = entity.USER_DEF10; return(model); } else { return(null); } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.Sys.USER_MODEL model) { Apps.Models.USER entity = m_Rep.GetById(model.INTERNAL_USER_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.USER(); entity.INTERNAL_USER_NUM = model.INTERNAL_USER_NUM; entity.USER_ID = model.USER_ID; entity.DESCRIPTION = model.DESCRIPTION; entity.DEPARTMENT = model.DEPARTMENT; entity.ACTIVE = model.ACTIVE; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.DEFAULT_WHS = model.DEFAULT_WHS; entity.DEFAULT_RECV_PREF = model.DEFAULT_RECV_PREF; entity.DEFAULT_SHIP_PREF = model.DEFAULT_SHIP_PREF; entity.DEFAULT_TASK_PREF = model.DEFAULT_TASK_PREF; entity.ROLE = model.ROLE; entity.PERSONAL_DIR = model.PERSONAL_DIR; entity.IMAGE_URL = model.IMAGE_URL; entity.TITLE = model.TITLE; entity.GENDER = model.GENDER; entity.MOBILE = model.MOBILE; entity.PHONE = model.PHONE; entity.EMAIL = model.EMAIL; entity.USER_DEF1 = model.USER_DEF1; entity.USER_DEF2 = model.USER_DEF2; entity.USER_DEF3 = model.USER_DEF3; entity.USER_DEF4 = model.USER_DEF4; entity.USER_DEF5 = model.USER_DEF5; entity.USER_DEF6 = model.USER_DEF6; entity.USER_DEF7 = model.USER_DEF7; entity.USER_DEF8 = model.USER_DEF8; entity.CREATE_DATE_TIME = model.CREATE_DATE_TIME; entity.CREATE_USER = model.CREATE_USER; entity.USER_DEF9 = model.USER_DEF9; entity.USER_DEF10 = model.USER_DEF10; m_Rep.Create(entity); }