public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.RULE.RULE_ASSIGNMENT_DETAIL_MODEL model, params string[] updateProperties) { Apps.Models.RULE_ASSIGNMENT_DETAIL entity = m_Rep.GetById(model.INTERNAL_NUM); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_NUM = model.INTERNAL_NUM; entity.RULE_ASSIGNMENT_NAME = model.RULE_ASSIGNMENT_NAME; entity.RULE_ASSIGNMENT_TYPE = model.RULE_ASSIGNMENT_TYPE; entity.SEQUENCE = model.SEQUENCE; entity.FILTER_NAME = model.FILTER_NAME; entity.RULE_ID = model.RULE_ID; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.ACTIVE = model.ACTIVE; } else { Type type = typeof(Apps.Models.SCV.RULE.RULE_ASSIGNMENT_DETAIL_MODEL); Type typeE = typeof(Apps.Models.RULE_ASSIGNMENT_DETAIL); 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.RULE.RULE_ASSIGNMENT_DETAIL_MODEL model) { Apps.Models.RULE_ASSIGNMENT_DETAIL entity = m_Rep.GetById(model.INTERNAL_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.RULE_ASSIGNMENT_DETAIL(); entity.INTERNAL_NUM = model.INTERNAL_NUM; entity.RULE_ASSIGNMENT_NAME = model.RULE_ASSIGNMENT_NAME; entity.RULE_ASSIGNMENT_TYPE = model.RULE_ASSIGNMENT_TYPE; entity.SEQUENCE = model.SEQUENCE; entity.FILTER_NAME = model.FILTER_NAME; entity.RULE_ID = model.RULE_ID; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.ACTIVE = model.ACTIVE; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.RULE.RULE_ASSIGNMENT_DETAIL_MODEL GetById(string id) { Apps.Models.RULE_ASSIGNMENT_DETAIL entity = m_Rep.GetById(id); if (entity != null) { //RULE_ASSIGNMENT_DETAIL entity = m_Rep.GetById(id); Apps.Models.SCV.RULE.RULE_ASSIGNMENT_DETAIL_MODEL model = new Apps.Models.SCV.RULE.RULE_ASSIGNMENT_DETAIL_MODEL(); model.INTERNAL_NUM = entity.INTERNAL_NUM; model.RULE_ASSIGNMENT_NAME = entity.RULE_ASSIGNMENT_NAME; model.RULE_ASSIGNMENT_TYPE = entity.RULE_ASSIGNMENT_TYPE; model.SEQUENCE = entity.SEQUENCE; model.FILTER_NAME = entity.FILTER_NAME; model.RULE_ID = entity.RULE_ID; model.USER_STAMP = entity.USER_STAMP; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; model.ACTIVE = entity.ACTIVE; return(model); } else { return(null); } }