public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.BOM.BOM_DETAIL_MODEL model, params string[] updateProperties) { Apps.Models.BOM_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.INTERNAL_BOM_NUM = model.INTERNAL_BOM_NUM; entity.ITEM = model.ITEM; entity.COMPANY = model.COMPANY; entity.BUILD_SEQUENCE = model.BUILD_SEQUENCE; entity.BUILD_LEVEL = model.BUILD_LEVEL; entity.QTY_NEEDED_PER_ITEM = model.QTY_NEEDED_PER_ITEM; entity.QUANTITY_UM = model.QUANTITY_UM; entity.ALLOCATION_RULE = model.ALLOCATION_RULE; entity.FROM_LOC = model.FROM_LOC; entity.ITEM_DESC = model.ITEM_DESC; entity.UPLOAD_INTERFACE = model.UPLOAD_INTERFACE; 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; entity.PROCESS_STAMP = model.PROCESS_STAMP; entity.CREATED_USER = model.CREATED_USER; entity.CREATED_DATE_TIME = model.CREATED_DATE_TIME; entity.LAST_MODIFIED_USER = model.LAST_MODIFIED_USER; entity.LAST_MODIFIED_DATE_TIME = model.LAST_MODIFIED_DATE_TIME; } else { Type type = typeof(Apps.Models.SCV.BOM.BOM_DETAIL_MODEL); Type typeE = typeof(Apps.Models.BOM_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 Apps.Models.SCV.BOM.BOM_DETAIL_MODEL GetById(string id) { Apps.Models.BOM_DETAIL entity = m_Rep.GetById(id); if (entity != null) { //BOM_DETAIL entity = m_Rep.GetById(id); Apps.Models.SCV.BOM.BOM_DETAIL_MODEL model = new Apps.Models.SCV.BOM.BOM_DETAIL_MODEL(); model.INTERNAL_NUM = entity.INTERNAL_NUM; model.INTERNAL_BOM_NUM = entity.INTERNAL_BOM_NUM; model.ITEM = entity.ITEM; model.COMPANY = entity.COMPANY; model.BUILD_SEQUENCE = entity.BUILD_SEQUENCE; model.BUILD_LEVEL = entity.BUILD_LEVEL; model.QTY_NEEDED_PER_ITEM = entity.QTY_NEEDED_PER_ITEM; model.QUANTITY_UM = entity.QUANTITY_UM; model.ALLOCATION_RULE = entity.ALLOCATION_RULE; model.FROM_LOC = entity.FROM_LOC; model.ITEM_DESC = entity.ITEM_DESC; model.UPLOAD_INTERFACE = entity.UPLOAD_INTERFACE; 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; model.PROCESS_STAMP = entity.PROCESS_STAMP; model.CREATED_USER = entity.CREATED_USER; model.CREATED_DATE_TIME = entity.CREATED_DATE_TIME; model.LAST_MODIFIED_USER = entity.LAST_MODIFIED_USER; model.LAST_MODIFIED_DATE_TIME = entity.LAST_MODIFIED_DATE_TIME; return(model); } else { return(null); } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.BOM.BOM_DETAIL_MODEL model) { Apps.Models.BOM_DETAIL entity = m_Rep.GetById(model.INTERNAL_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.BOM_DETAIL(); entity.INTERNAL_NUM = model.INTERNAL_NUM; entity.INTERNAL_BOM_NUM = model.INTERNAL_BOM_NUM; entity.ITEM = model.ITEM; entity.COMPANY = model.COMPANY; entity.BUILD_SEQUENCE = model.BUILD_SEQUENCE; entity.BUILD_LEVEL = model.BUILD_LEVEL; entity.QTY_NEEDED_PER_ITEM = model.QTY_NEEDED_PER_ITEM; entity.QUANTITY_UM = model.QUANTITY_UM; entity.ALLOCATION_RULE = model.ALLOCATION_RULE; entity.FROM_LOC = model.FROM_LOC; entity.ITEM_DESC = model.ITEM_DESC; entity.UPLOAD_INTERFACE = model.UPLOAD_INTERFACE; 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; entity.PROCESS_STAMP = model.PROCESS_STAMP; entity.CREATED_USER = model.CREATED_USER; entity.CREATED_DATE_TIME = model.CREATED_DATE_TIME; entity.LAST_MODIFIED_USER = model.LAST_MODIFIED_USER; entity.LAST_MODIFIED_DATE_TIME = model.LAST_MODIFIED_DATE_TIME; m_Rep.Create(entity); }