public virtual Apps.Models.SCV.MESSAGE.MESSAGE_ROUTE_MODEL GetById(string id) { Apps.Models.MESSAGE_ROUTE entity = m_Rep.GetById(id); if (entity != null) { //MESSAGE_ROUTE entity = m_Rep.GetById(id); Apps.Models.SCV.MESSAGE.MESSAGE_ROUTE_MODEL model = new Apps.Models.SCV.MESSAGE.MESSAGE_ROUTE_MODEL(); model.ROUTE_ID = entity.ROUTE_ID; model.SRC_END_POINT = entity.SRC_END_POINT; model.DST_END_POINT = entity.DST_END_POINT; model.MESSAGE_TYPE = entity.MESSAGE_TYPE; model.SUB_TYPE = entity.SUB_TYPE; model.MESSAGE_UDF1 = entity.MESSAGE_UDF1; model.MESSAGE_UDF2 = entity.MESSAGE_UDF2; model.MESSAGE_UDF3 = entity.MESSAGE_UDF3; model.MESSAGE_UDF4 = entity.MESSAGE_UDF4; 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.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; model.PROCESS_STAMP = entity.PROCESS_STAMP; model.ACTIVE = entity.ACTIVE; return(model); } else { return(null); } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.MESSAGE.MESSAGE_ROUTE_MODEL model) { Apps.Models.MESSAGE_ROUTE entity = m_Rep.GetById(model.ROUTE_ID); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.MESSAGE_ROUTE(); entity.ROUTE_ID = model.ROUTE_ID; entity.SRC_END_POINT = model.SRC_END_POINT; entity.DST_END_POINT = model.DST_END_POINT; entity.MESSAGE_TYPE = model.MESSAGE_TYPE; entity.SUB_TYPE = model.SUB_TYPE; entity.MESSAGE_UDF1 = model.MESSAGE_UDF1; entity.MESSAGE_UDF2 = model.MESSAGE_UDF2; entity.MESSAGE_UDF3 = model.MESSAGE_UDF3; entity.MESSAGE_UDF4 = model.MESSAGE_UDF4; 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.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.PROCESS_STAMP = model.PROCESS_STAMP; entity.ACTIVE = model.ACTIVE; m_Rep.Create(entity); }
public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.MESSAGE.MESSAGE_ROUTE_MODEL model, params string[] updateProperties) { Apps.Models.MESSAGE_ROUTE entity = m_Rep.GetById(model.ROUTE_ID); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.ROUTE_ID = model.ROUTE_ID; entity.SRC_END_POINT = model.SRC_END_POINT; entity.DST_END_POINT = model.DST_END_POINT; entity.MESSAGE_TYPE = model.MESSAGE_TYPE; entity.SUB_TYPE = model.SUB_TYPE; entity.MESSAGE_UDF1 = model.MESSAGE_UDF1; entity.MESSAGE_UDF2 = model.MESSAGE_UDF2; entity.MESSAGE_UDF3 = model.MESSAGE_UDF3; entity.MESSAGE_UDF4 = model.MESSAGE_UDF4; 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.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.PROCESS_STAMP = model.PROCESS_STAMP; entity.ACTIVE = model.ACTIVE; } else { Type type = typeof(Apps.Models.SCV.MESSAGE.MESSAGE_ROUTE_MODEL); Type typeE = typeof(Apps.Models.MESSAGE_ROUTE); 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); }