public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.g.g_user_MODEL model, params string[] updateProperties) { Apps.Models.g_user entity = m_Rep.GetById(model.ID); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.ID = model.ID; entity.g_username = model.g_username; entity.g_password = model.g_password; entity.g_company = model.g_company; entity.g_mobile = model.g_mobile; entity.g_level = model.g_level; entity.g_sex = model.g_sex; } else { Type type = typeof(Apps.Models.SCV.g.g_user_MODEL); Type typeE = typeof(Apps.Models.g_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 void Create(ref ValidationErrors errors, Apps.Models.SCV.g.g_user_MODEL model) { Apps.Models.g_user entity = m_Rep.GetById(model.ID); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.g_user(); entity.ID = model.ID; entity.g_username = model.g_username; entity.g_password = model.g_password; entity.g_company = model.g_company; entity.g_mobile = model.g_mobile; entity.g_level = model.g_level; entity.g_sex = model.g_sex; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.g.g_user_MODEL GetById(string id) { Apps.Models.g_user entity = m_Rep.GetById(id); if (entity != null) { //g_user entity = m_Rep.GetById(id); Apps.Models.SCV.g.g_user_MODEL model = new Apps.Models.SCV.g.g_user_MODEL(); model.ID = entity.ID; model.g_username = entity.g_username; model.g_password = entity.g_password; model.g_company = entity.g_company; model.g_mobile = entity.g_mobile; model.g_level = entity.g_level; model.g_sex = entity.g_sex; return(model); } else { return(null); } }