public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.g.g_login_history_MODEL model, params string[] updateProperties) { Apps.Models.g_login_history 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_ip = model.g_ip; entity.g_date = model.g_date; entity.g_type = model.g_type; entity.g_category1 = model.g_category1; entity.g_category2 = model.g_category2; entity.g_category3 = model.g_category3; } else { Type type = typeof(Apps.Models.SCV.g.g_login_history_MODEL); Type typeE = typeof(Apps.Models.g_login_history); 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_login_history_MODEL model) { Apps.Models.g_login_history entity = m_Rep.GetById(model.ID); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.g_login_history(); entity.ID = model.ID; entity.g_username = model.g_username; entity.g_ip = model.g_ip; entity.g_date = model.g_date; entity.g_type = model.g_type; entity.g_category1 = model.g_category1; entity.g_category2 = model.g_category2; entity.g_category3 = model.g_category3; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.g.g_login_history_MODEL GetById(string id) { Apps.Models.g_login_history entity = m_Rep.GetById(id); if (entity != null) { //g_login_history entity = m_Rep.GetById(id); Apps.Models.SCV.g.g_login_history_MODEL model = new Apps.Models.SCV.g.g_login_history_MODEL(); model.ID = entity.ID; model.g_username = entity.g_username; model.g_ip = entity.g_ip; model.g_date = entity.g_date; model.g_type = entity.g_type; model.g_category1 = entity.g_category1; model.g_category2 = entity.g_category2; model.g_category3 = entity.g_category3; return(model); } else { return(null); } }