public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.NEXT.NEXT_NUMBER_MODEL model, params string[] updateProperties) { Apps.Models.NEXT_NUMBER entity = m_Rep.GetById(model.NEXT_NUM_KEY); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.NEXT_NUM_KEY = model.NEXT_NUM_KEY; entity.NEXT_NUM = model.NEXT_NUM; entity.PREFIX = model.PREFIX; entity.SUFFIX = model.SUFFIX; entity.SYSTEM_CREATED = model.SYSTEM_CREATED; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.RESET_BY_DAY = model.RESET_BY_DAY; entity.MIN_VALUE = model.MIN_VALUE; entity.MAX_VALUE = model.MAX_VALUE; entity.LENGTH = model.LENGTH; entity.PADDING_POS = model.PADDING_POS; entity.PADDING_CHAR = model.PADDING_CHAR; entity.RESET_BY_MONTH = model.RESET_BY_MONTH; entity.RESET_BY_YEAR = model.RESET_BY_YEAR; entity.RESET_BY_WEEK = model.RESET_BY_WEEK; entity.LAST_NUM_DATE = model.LAST_NUM_DATE; 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; } else { Type type = typeof(Apps.Models.SCV.NEXT.NEXT_NUMBER_MODEL); Type typeE = typeof(Apps.Models.NEXT_NUMBER); 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.NEXT.NEXT_NUMBER_MODEL GetById(string id) { Apps.Models.NEXT_NUMBER entity = m_Rep.GetById(id); if (entity != null) { //NEXT_NUMBER entity = m_Rep.GetById(id); Apps.Models.SCV.NEXT.NEXT_NUMBER_MODEL model = new Apps.Models.SCV.NEXT.NEXT_NUMBER_MODEL(); model.NEXT_NUM_KEY = entity.NEXT_NUM_KEY; model.NEXT_NUM = entity.NEXT_NUM; model.PREFIX = entity.PREFIX; model.SUFFIX = entity.SUFFIX; model.SYSTEM_CREATED = entity.SYSTEM_CREATED; model.USER_STAMP = entity.USER_STAMP; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; model.RESET_BY_DAY = entity.RESET_BY_DAY; model.MIN_VALUE = entity.MIN_VALUE; model.MAX_VALUE = entity.MAX_VALUE; model.LENGTH = entity.LENGTH; model.PADDING_POS = entity.PADDING_POS; model.PADDING_CHAR = entity.PADDING_CHAR; model.RESET_BY_MONTH = entity.RESET_BY_MONTH; model.RESET_BY_YEAR = entity.RESET_BY_YEAR; model.RESET_BY_WEEK = entity.RESET_BY_WEEK; model.LAST_NUM_DATE = entity.LAST_NUM_DATE; 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; return(model); } else { return(null); } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.NEXT.NEXT_NUMBER_MODEL model) { Apps.Models.NEXT_NUMBER entity = m_Rep.GetById(model.NEXT_NUM_KEY); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.NEXT_NUMBER(); entity.NEXT_NUM_KEY = model.NEXT_NUM_KEY; entity.NEXT_NUM = model.NEXT_NUM; entity.PREFIX = model.PREFIX; entity.SUFFIX = model.SUFFIX; entity.SYSTEM_CREATED = model.SYSTEM_CREATED; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; entity.RESET_BY_DAY = model.RESET_BY_DAY; entity.MIN_VALUE = model.MIN_VALUE; entity.MAX_VALUE = model.MAX_VALUE; entity.LENGTH = model.LENGTH; entity.PADDING_POS = model.PADDING_POS; entity.PADDING_CHAR = model.PADDING_CHAR; entity.RESET_BY_MONTH = model.RESET_BY_MONTH; entity.RESET_BY_YEAR = model.RESET_BY_YEAR; entity.RESET_BY_WEEK = model.RESET_BY_WEEK; entity.LAST_NUM_DATE = model.LAST_NUM_DATE; 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; m_Rep.Create(entity); }