public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.DOCUMENT.DOCUMENT_ROUTING_MODEL model,params string[] updateProperties) { Apps.Models.DOCUMENT_ROUTING 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.DOCUMENT_TYPE = model.DOCUMENT_TYPE; entity.DOCUMENT_ID = model.DOCUMENT_ID; entity.COMPANY = model.COMPANY; entity.CARRIER = model.CARRIER; entity.CONTAINER_TYPE = model.CONTAINER_TYPE; entity.NUMBER_OF_COPIES = model.NUMBER_OF_COPIES; entity.DEVICE_NAME = model.DEVICE_NAME; entity.USER_ID = model.USER_ID; entity.WAREHOUSE = model.WAREHOUSE; entity.MACHINE_NAME = model.MACHINE_NAME; entity.CREATE_USER = model.CREATE_USER; entity.CREATE_DATE_TIME = model.CREATE_DATE_TIME; entity.LAST_MODIFY_USER = model.LAST_MODIFY_USER; entity.LAST_MODIFY_DATE_TIME = model.LAST_MODIFY_DATE_TIME; 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.USER_DEF9 = model.USER_DEF9; entity.USER_DEF10 = model.USER_DEF10; }else{ Type type = typeof(Apps.Models.SCV.DOCUMENT.DOCUMENT_ROUTING_MODEL); Type typeE = typeof(Apps.Models.DOCUMENT_ROUTING); 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.DOCUMENT.DOCUMENT_ROUTING_MODEL GetById(string id) { Apps.Models.DOCUMENT_ROUTING entity = m_Rep.GetById(id); if (entity!=null) { //DOCUMENT_ROUTING entity = m_Rep.GetById(id); Apps.Models.SCV.DOCUMENT.DOCUMENT_ROUTING_MODEL model = new Apps.Models.SCV.DOCUMENT.DOCUMENT_ROUTING_MODEL(); model.INTERNAL_NUM = entity.INTERNAL_NUM; model.DOCUMENT_TYPE = entity.DOCUMENT_TYPE; model.DOCUMENT_ID = entity.DOCUMENT_ID; model.COMPANY = entity.COMPANY; model.CARRIER = entity.CARRIER; model.CONTAINER_TYPE = entity.CONTAINER_TYPE; model.NUMBER_OF_COPIES = entity.NUMBER_OF_COPIES; model.DEVICE_NAME = entity.DEVICE_NAME; model.USER_ID = entity.USER_ID; model.WAREHOUSE = entity.WAREHOUSE; model.MACHINE_NAME = entity.MACHINE_NAME; model.CREATE_USER = entity.CREATE_USER; model.CREATE_DATE_TIME = entity.CREATE_DATE_TIME; model.LAST_MODIFY_USER = entity.LAST_MODIFY_USER; model.LAST_MODIFY_DATE_TIME = entity.LAST_MODIFY_DATE_TIME; 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.USER_DEF9 = entity.USER_DEF9; model.USER_DEF10 = entity.USER_DEF10; return model; } else { return null; } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.DOCUMENT.DOCUMENT_ROUTING_MODEL model) { Apps.Models.DOCUMENT_ROUTING entity = m_Rep.GetById(model.INTERNAL_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.DOCUMENT_ROUTING(); entity.INTERNAL_NUM = model.INTERNAL_NUM; entity.DOCUMENT_TYPE = model.DOCUMENT_TYPE; entity.DOCUMENT_ID = model.DOCUMENT_ID; entity.COMPANY = model.COMPANY; entity.CARRIER = model.CARRIER; entity.CONTAINER_TYPE = model.CONTAINER_TYPE; entity.NUMBER_OF_COPIES = model.NUMBER_OF_COPIES; entity.DEVICE_NAME = model.DEVICE_NAME; entity.USER_ID = model.USER_ID; entity.WAREHOUSE = model.WAREHOUSE; entity.MACHINE_NAME = model.MACHINE_NAME; entity.CREATE_USER = model.CREATE_USER; entity.CREATE_DATE_TIME = model.CREATE_DATE_TIME; entity.LAST_MODIFY_USER = model.LAST_MODIFY_USER; entity.LAST_MODIFY_DATE_TIME = model.LAST_MODIFY_DATE_TIME; 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.USER_DEF9 = model.USER_DEF9; entity.USER_DEF10 = model.USER_DEF10; m_Rep.Create(entity); }