public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.RETURNED.RETURNED_PACKAGE_MODEL model, params string[] updateProperties) { Apps.Models.RETURNED_PACKAGE entity = m_Rep.GetById(model.INTERNAL_PACKAGE_NUM); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_PACKAGE_NUM = model.INTERNAL_PACKAGE_NUM; entity.PACKAGE_ID = model.PACKAGE_ID; entity.STATUS = model.STATUS; entity.CART_ID = model.CART_ID; entity.CART_POS = model.CART_POS; entity.RETURN_TRACKING_NUMBER = model.RETURN_TRACKING_NUMBER; entity.SHIP_TRACKING_NUMBER = model.SHIP_TRACKING_NUMBER; entity.RECEIPT_ID = model.RECEIPT_ID; entity.SHIPMENT_ID = model.SHIPMENT_ID; entity.SHIP_FROM = model.SHIP_FROM; entity.SHIP_FROM_PHONE_NUM = model.SHIP_FROM_PHONE_NUM; entity.RETURN_REASON = model.RETURN_REASON; 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; 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.RETURNED.RETURNED_PACKAGE_MODEL); Type typeE = typeof(Apps.Models.RETURNED_PACKAGE); 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.RETURNED.RETURNED_PACKAGE_MODEL GetById(string id) { Apps.Models.RETURNED_PACKAGE entity = m_Rep.GetById(id); if (entity != null) { //RETURNED_PACKAGE entity = m_Rep.GetById(id); Apps.Models.SCV.RETURNED.RETURNED_PACKAGE_MODEL model = new Apps.Models.SCV.RETURNED.RETURNED_PACKAGE_MODEL(); model.INTERNAL_PACKAGE_NUM = entity.INTERNAL_PACKAGE_NUM; model.PACKAGE_ID = entity.PACKAGE_ID; model.STATUS = entity.STATUS; model.CART_ID = entity.CART_ID; model.CART_POS = entity.CART_POS; model.RETURN_TRACKING_NUMBER = entity.RETURN_TRACKING_NUMBER; model.SHIP_TRACKING_NUMBER = entity.SHIP_TRACKING_NUMBER; model.RECEIPT_ID = entity.RECEIPT_ID; model.SHIPMENT_ID = entity.SHIPMENT_ID; model.SHIP_FROM = entity.SHIP_FROM; model.SHIP_FROM_PHONE_NUM = entity.SHIP_FROM_PHONE_NUM; model.RETURN_REASON = entity.RETURN_REASON; 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; 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.RETURNED.RETURNED_PACKAGE_MODEL model) { Apps.Models.RETURNED_PACKAGE entity = m_Rep.GetById(model.INTERNAL_PACKAGE_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.RETURNED_PACKAGE(); entity.INTERNAL_PACKAGE_NUM = model.INTERNAL_PACKAGE_NUM; entity.PACKAGE_ID = model.PACKAGE_ID; entity.STATUS = model.STATUS; entity.CART_ID = model.CART_ID; entity.CART_POS = model.CART_POS; entity.RETURN_TRACKING_NUMBER = model.RETURN_TRACKING_NUMBER; entity.SHIP_TRACKING_NUMBER = model.SHIP_TRACKING_NUMBER; entity.RECEIPT_ID = model.RECEIPT_ID; entity.SHIPMENT_ID = model.SHIPMENT_ID; entity.SHIP_FROM = model.SHIP_FROM; entity.SHIP_FROM_PHONE_NUM = model.SHIP_FROM_PHONE_NUM; entity.RETURN_REASON = model.RETURN_REASON; 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; 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); }