public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.DOWNLOAD.DOWNLOAD_SHIPMENTS_MODEL model)
        {
            Apps.Models.DOWNLOAD_SHIPMENTS entity = m_Rep.GetById(model.INTERFACE_RECORD_ID);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.DOWNLOAD_SHIPMENTS();
            entity.INTERFACE_RECORD_ID   = model.INTERFACE_RECORD_ID;
            entity.INTERFACE_ACTION_CODE = model.INTERFACE_ACTION_CODE;
            entity.INTERFACE_CONDITION   = model.INTERFACE_CONDITION;
            entity.PROCESS_STAMP         = model.PROCESS_STAMP;
            entity.INTERFACE_GUID        = model.INTERFACE_GUID;
            entity.WAREHOUSE             = model.WAREHOUSE;
            entity.COMPANY               = model.COMPANY;
            entity.SHIPMENT_ID           = model.SHIPMENT_ID;
            entity.ERP_ORDER             = model.ERP_ORDER;
            entity.SHIPMENT_TYPE         = model.SHIPMENT_TYPE;
            entity.SHIP_TO               = model.SHIP_TO;
            entity.SHIP_TO_NAME          = model.SHIP_TO_NAME;
            entity.SHIP_TO_ADDRESS1      = model.SHIP_TO_ADDRESS1;
            entity.SHIP_TO_ADDRESS2      = model.SHIP_TO_ADDRESS2;
            entity.SHIP_TO_DISTRICT      = model.SHIP_TO_DISTRICT;
            entity.SHIP_TO_CITY          = model.SHIP_TO_CITY;
            entity.SHIP_TO_STATE         = model.SHIP_TO_STATE;
            entity.SHIP_TO_COUNTRY       = model.SHIP_TO_COUNTRY;
            entity.SHIP_TO_POSTAL_CODE   = model.SHIP_TO_POSTAL_CODE;
            entity.SHIP_TO_ATTENTION_TO  = model.SHIP_TO_ATTENTION_TO;
            entity.SHIP_TO_PHONE_NUM     = model.SHIP_TO_PHONE_NUM;
            entity.SHIP_TO_MOBILE        = model.SHIP_TO_MOBILE;
            entity.SHIP_TO_FAX_NUM       = model.SHIP_TO_FAX_NUM;
            entity.SHIP_TO_EMAIL_ADDRESS = model.SHIP_TO_EMAIL_ADDRESS;
            entity.USER_STAMP            = model.USER_STAMP;
            entity.DATE_TIME_STAMP       = model.DATE_TIME_STAMP;
            entity.CARRIER               = model.CARRIER;
            entity.STOP_SEQ              = model.STOP_SEQ;
            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;
            entity.PROCESS_TYPE          = model.PROCESS_TYPE;
            entity.TOTAL_QTY             = model.TOTAL_QTY;
            entity.TOTAL_LINES           = model.TOTAL_LINES;
            entity.TOTAL_VALUE           = model.TOTAL_VALUE;
            entity.ERP_ORDER_LINE_NUM    = model.ERP_ORDER_LINE_NUM;
            entity.ITEM        = model.ITEM;
            entity.ITEM_DESC   = model.ITEM_DESC;
            entity.REQUEST_QTY = model.REQUEST_QTY;
            entity.QUANTITY_UM = model.QUANTITY_UM;
            entity.ATTRIBUTE1  = model.ATTRIBUTE1;

            m_Rep.Create(entity);
        }
        public virtual Apps.Models.SCV.DOWNLOAD.DOWNLOAD_SHIPMENTS_MODEL GetById(string id)
        {
            Apps.Models.DOWNLOAD_SHIPMENTS entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //DOWNLOAD_SHIPMENTS entity = m_Rep.GetById(id);
                Apps.Models.SCV.DOWNLOAD.DOWNLOAD_SHIPMENTS_MODEL model = new Apps.Models.SCV.DOWNLOAD.DOWNLOAD_SHIPMENTS_MODEL();
                model.INTERFACE_RECORD_ID   = entity.INTERFACE_RECORD_ID;
                model.INTERFACE_ACTION_CODE = entity.INTERFACE_ACTION_CODE;
                model.INTERFACE_CONDITION   = entity.INTERFACE_CONDITION;
                model.PROCESS_STAMP         = entity.PROCESS_STAMP;
                model.INTERFACE_GUID        = entity.INTERFACE_GUID;
                model.WAREHOUSE             = entity.WAREHOUSE;
                model.COMPANY               = entity.COMPANY;
                model.SHIPMENT_ID           = entity.SHIPMENT_ID;
                model.ERP_ORDER             = entity.ERP_ORDER;
                model.SHIPMENT_TYPE         = entity.SHIPMENT_TYPE;
                model.SHIP_TO               = entity.SHIP_TO;
                model.SHIP_TO_NAME          = entity.SHIP_TO_NAME;
                model.SHIP_TO_ADDRESS1      = entity.SHIP_TO_ADDRESS1;
                model.SHIP_TO_ADDRESS2      = entity.SHIP_TO_ADDRESS2;
                model.SHIP_TO_DISTRICT      = entity.SHIP_TO_DISTRICT;
                model.SHIP_TO_CITY          = entity.SHIP_TO_CITY;
                model.SHIP_TO_STATE         = entity.SHIP_TO_STATE;
                model.SHIP_TO_COUNTRY       = entity.SHIP_TO_COUNTRY;
                model.SHIP_TO_POSTAL_CODE   = entity.SHIP_TO_POSTAL_CODE;
                model.SHIP_TO_ATTENTION_TO  = entity.SHIP_TO_ATTENTION_TO;
                model.SHIP_TO_PHONE_NUM     = entity.SHIP_TO_PHONE_NUM;
                model.SHIP_TO_MOBILE        = entity.SHIP_TO_MOBILE;
                model.SHIP_TO_FAX_NUM       = entity.SHIP_TO_FAX_NUM;
                model.SHIP_TO_EMAIL_ADDRESS = entity.SHIP_TO_EMAIL_ADDRESS;
                model.USER_STAMP            = entity.USER_STAMP;
                model.DATE_TIME_STAMP       = entity.DATE_TIME_STAMP;
                model.CARRIER               = entity.CARRIER;
                model.STOP_SEQ              = entity.STOP_SEQ;
                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;
                model.PROCESS_TYPE          = entity.PROCESS_TYPE;
                model.TOTAL_QTY             = entity.TOTAL_QTY;
                model.TOTAL_LINES           = entity.TOTAL_LINES;
                model.TOTAL_VALUE           = entity.TOTAL_VALUE;
                model.ERP_ORDER_LINE_NUM    = entity.ERP_ORDER_LINE_NUM;
                model.ITEM        = entity.ITEM;
                model.ITEM_DESC   = entity.ITEM_DESC;
                model.REQUEST_QTY = entity.REQUEST_QTY;
                model.QUANTITY_UM = entity.QUANTITY_UM;
                model.ATTRIBUTE1  = entity.ATTRIBUTE1;

                return(model);
            }
            else
            {
                return(null);
            }
        }
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.DOWNLOAD.DOWNLOAD_SHIPMENTS_MODEL model, params string[] updateProperties)
        {
            Apps.Models.DOWNLOAD_SHIPMENTS entity = m_Rep.GetById(model.INTERFACE_RECORD_ID);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.INTERFACE_RECORD_ID   = model.INTERFACE_RECORD_ID;
                entity.INTERFACE_ACTION_CODE = model.INTERFACE_ACTION_CODE;
                entity.INTERFACE_CONDITION   = model.INTERFACE_CONDITION;
                entity.PROCESS_STAMP         = model.PROCESS_STAMP;
                entity.INTERFACE_GUID        = model.INTERFACE_GUID;
                entity.WAREHOUSE             = model.WAREHOUSE;
                entity.COMPANY               = model.COMPANY;
                entity.SHIPMENT_ID           = model.SHIPMENT_ID;
                entity.ERP_ORDER             = model.ERP_ORDER;
                entity.SHIPMENT_TYPE         = model.SHIPMENT_TYPE;
                entity.SHIP_TO               = model.SHIP_TO;
                entity.SHIP_TO_NAME          = model.SHIP_TO_NAME;
                entity.SHIP_TO_ADDRESS1      = model.SHIP_TO_ADDRESS1;
                entity.SHIP_TO_ADDRESS2      = model.SHIP_TO_ADDRESS2;
                entity.SHIP_TO_DISTRICT      = model.SHIP_TO_DISTRICT;
                entity.SHIP_TO_CITY          = model.SHIP_TO_CITY;
                entity.SHIP_TO_STATE         = model.SHIP_TO_STATE;
                entity.SHIP_TO_COUNTRY       = model.SHIP_TO_COUNTRY;
                entity.SHIP_TO_POSTAL_CODE   = model.SHIP_TO_POSTAL_CODE;
                entity.SHIP_TO_ATTENTION_TO  = model.SHIP_TO_ATTENTION_TO;
                entity.SHIP_TO_PHONE_NUM     = model.SHIP_TO_PHONE_NUM;
                entity.SHIP_TO_MOBILE        = model.SHIP_TO_MOBILE;
                entity.SHIP_TO_FAX_NUM       = model.SHIP_TO_FAX_NUM;
                entity.SHIP_TO_EMAIL_ADDRESS = model.SHIP_TO_EMAIL_ADDRESS;
                entity.USER_STAMP            = model.USER_STAMP;
                entity.DATE_TIME_STAMP       = model.DATE_TIME_STAMP;
                entity.CARRIER               = model.CARRIER;
                entity.STOP_SEQ              = model.STOP_SEQ;
                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;
                entity.PROCESS_TYPE          = model.PROCESS_TYPE;
                entity.TOTAL_QTY             = model.TOTAL_QTY;
                entity.TOTAL_LINES           = model.TOTAL_LINES;
                entity.TOTAL_VALUE           = model.TOTAL_VALUE;
                entity.ERP_ORDER_LINE_NUM    = model.ERP_ORDER_LINE_NUM;
                entity.ITEM        = model.ITEM;
                entity.ITEM_DESC   = model.ITEM_DESC;
                entity.REQUEST_QTY = model.REQUEST_QTY;
                entity.QUANTITY_UM = model.QUANTITY_UM;
                entity.ATTRIBUTE1  = model.ATTRIBUTE1;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.DOWNLOAD.DOWNLOAD_SHIPMENTS_MODEL);
                Type typeE = typeof(Apps.Models.DOWNLOAD_SHIPMENTS);
                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);
        }