public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.PURCHASE.PURCHASE_ORDER_HEADER_MODEL model, params string[] updateProperties) { Apps.Models.PURCHASE_ORDER_HEADER entity = m_Rep.GetById(model.INTERNAL_PURCHASE_ORDER_NUM); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_PURCHASE_ORDER_NUM = model.INTERNAL_PURCHASE_ORDER_NUM; entity.WAREHOUSE = model.WAREHOUSE; entity.COMPANY = model.COMPANY; entity.PURCHASE_ORDER_ID = model.PURCHASE_ORDER_ID; entity.PURCHASE_ORDER_TYPE = model.PURCHASE_ORDER_TYPE; entity.CLOSE_DATE = model.CLOSE_DATE; entity.PRIORITY = model.PRIORITY; entity.STATUS = model.STATUS; entity.ERP_ORDER_ID = model.ERP_ORDER_ID; entity.SHIP_FROM = model.SHIP_FROM; entity.SHIP_FROM_ADDRESS1 = model.SHIP_FROM_ADDRESS1; entity.SHIP_FROM_ADDRESS2 = model.SHIP_FROM_ADDRESS2; entity.SHIP_FROM_CITY = model.SHIP_FROM_CITY; entity.SHIP_FROM_STATE = model.SHIP_FROM_STATE; entity.SHIP_FROM_COUNTRY = model.SHIP_FROM_COUNTRY; entity.SHIP_FROM_POSTAL_CODE = model.SHIP_FROM_POSTAL_CODE; entity.SHIP_FROM_NAME = model.SHIP_FROM_NAME; entity.SHIP_FROM_ATTENTION_TO = model.SHIP_FROM_ATTENTION_TO; entity.SHIP_FROM_EMAIL_ADDRESS = model.SHIP_FROM_EMAIL_ADDRESS; entity.SHIP_FROM_PHONE_NUM = model.SHIP_FROM_PHONE_NUM; entity.SHIP_FROM_FAX_NUM = model.SHIP_FROM_FAX_NUM; entity.SCHEDULED_ARRIVE_DATE = model.SCHEDULED_ARRIVE_DATE; entity.ACTUAL_ARRIVE_DATE = model.ACTUAL_ARRIVE_DATE; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; } else { Type type = typeof(Apps.Models.SCV.PURCHASE.PURCHASE_ORDER_HEADER_MODEL); Type typeE = typeof(Apps.Models.PURCHASE_ORDER_HEADER); 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.PURCHASE.PURCHASE_ORDER_HEADER_MODEL GetById(string id) { Apps.Models.PURCHASE_ORDER_HEADER entity = m_Rep.GetById(id); if (entity != null) { //PURCHASE_ORDER_HEADER entity = m_Rep.GetById(id); Apps.Models.SCV.PURCHASE.PURCHASE_ORDER_HEADER_MODEL model = new Apps.Models.SCV.PURCHASE.PURCHASE_ORDER_HEADER_MODEL(); model.INTERNAL_PURCHASE_ORDER_NUM = entity.INTERNAL_PURCHASE_ORDER_NUM; model.WAREHOUSE = entity.WAREHOUSE; model.COMPANY = entity.COMPANY; model.PURCHASE_ORDER_ID = entity.PURCHASE_ORDER_ID; model.PURCHASE_ORDER_TYPE = entity.PURCHASE_ORDER_TYPE; model.CLOSE_DATE = entity.CLOSE_DATE; model.PRIORITY = entity.PRIORITY; model.STATUS = entity.STATUS; model.ERP_ORDER_ID = entity.ERP_ORDER_ID; model.SHIP_FROM = entity.SHIP_FROM; model.SHIP_FROM_ADDRESS1 = entity.SHIP_FROM_ADDRESS1; model.SHIP_FROM_ADDRESS2 = entity.SHIP_FROM_ADDRESS2; model.SHIP_FROM_CITY = entity.SHIP_FROM_CITY; model.SHIP_FROM_STATE = entity.SHIP_FROM_STATE; model.SHIP_FROM_COUNTRY = entity.SHIP_FROM_COUNTRY; model.SHIP_FROM_POSTAL_CODE = entity.SHIP_FROM_POSTAL_CODE; model.SHIP_FROM_NAME = entity.SHIP_FROM_NAME; model.SHIP_FROM_ATTENTION_TO = entity.SHIP_FROM_ATTENTION_TO; model.SHIP_FROM_EMAIL_ADDRESS = entity.SHIP_FROM_EMAIL_ADDRESS; model.SHIP_FROM_PHONE_NUM = entity.SHIP_FROM_PHONE_NUM; model.SHIP_FROM_FAX_NUM = entity.SHIP_FROM_FAX_NUM; model.SCHEDULED_ARRIVE_DATE = entity.SCHEDULED_ARRIVE_DATE; model.ACTUAL_ARRIVE_DATE = entity.ACTUAL_ARRIVE_DATE; model.USER_STAMP = entity.USER_STAMP; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; return(model); } else { return(null); } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.PURCHASE.PURCHASE_ORDER_HEADER_MODEL model) { Apps.Models.PURCHASE_ORDER_HEADER entity = m_Rep.GetById(model.INTERNAL_PURCHASE_ORDER_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.PURCHASE_ORDER_HEADER(); entity.INTERNAL_PURCHASE_ORDER_NUM = model.INTERNAL_PURCHASE_ORDER_NUM; entity.WAREHOUSE = model.WAREHOUSE; entity.COMPANY = model.COMPANY; entity.PURCHASE_ORDER_ID = model.PURCHASE_ORDER_ID; entity.PURCHASE_ORDER_TYPE = model.PURCHASE_ORDER_TYPE; entity.CLOSE_DATE = model.CLOSE_DATE; entity.PRIORITY = model.PRIORITY; entity.STATUS = model.STATUS; entity.ERP_ORDER_ID = model.ERP_ORDER_ID; entity.SHIP_FROM = model.SHIP_FROM; entity.SHIP_FROM_ADDRESS1 = model.SHIP_FROM_ADDRESS1; entity.SHIP_FROM_ADDRESS2 = model.SHIP_FROM_ADDRESS2; entity.SHIP_FROM_CITY = model.SHIP_FROM_CITY; entity.SHIP_FROM_STATE = model.SHIP_FROM_STATE; entity.SHIP_FROM_COUNTRY = model.SHIP_FROM_COUNTRY; entity.SHIP_FROM_POSTAL_CODE = model.SHIP_FROM_POSTAL_CODE; entity.SHIP_FROM_NAME = model.SHIP_FROM_NAME; entity.SHIP_FROM_ATTENTION_TO = model.SHIP_FROM_ATTENTION_TO; entity.SHIP_FROM_EMAIL_ADDRESS = model.SHIP_FROM_EMAIL_ADDRESS; entity.SHIP_FROM_PHONE_NUM = model.SHIP_FROM_PHONE_NUM; entity.SHIP_FROM_FAX_NUM = model.SHIP_FROM_FAX_NUM; entity.SCHEDULED_ARRIVE_DATE = model.SCHEDULED_ARRIVE_DATE; entity.ACTUAL_ARRIVE_DATE = model.ACTUAL_ARRIVE_DATE; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; m_Rep.Create(entity); }