public virtual Apps.Models.SCV.AR.AR_UPLOAD_RECEIPT_HEADER_MODEL GetById(string id)
        {
            Apps.Models.AR_UPLOAD_RECEIPT_HEADER entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //AR_UPLOAD_RECEIPT_HEADER entity = m_Rep.GetById(id);
                Apps.Models.SCV.AR.AR_UPLOAD_RECEIPT_HEADER_MODEL model = new Apps.Models.SCV.AR.AR_UPLOAD_RECEIPT_HEADER_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.WAREHOUSE             = entity.WAREHOUSE;
                model.COMPANY                 = entity.COMPANY;
                model.RECEIPT_ID              = entity.RECEIPT_ID;
                model.RECEIPT_TYPE            = entity.RECEIPT_TYPE;
                model.PRIORITY                = entity.PRIORITY;
                model.LEADING_STS             = entity.LEADING_STS;
                model.TRAILING_STS            = entity.TRAILING_STS;
                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;
                model.RECV_DOCK               = entity.RECV_DOCK;
                model.CLOSE_DATE              = entity.CLOSE_DATE;
                model.CREATE_DATE             = entity.CREATE_DATE;
                model.START_CHECKIN_DATE      = entity.START_CHECKIN_DATE;
                model.END_CHECKIN_DATE        = entity.END_CHECKIN_DATE;
                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.TOTAL_QTY               = entity.TOTAL_QTY;
                model.TOTAL_LINES             = entity.TOTAL_LINES;

                return(model);
            }
            else
            {
                return(null);
            }
        }
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.AR.AR_UPLOAD_RECEIPT_HEADER_MODEL model)
        {
            Apps.Models.AR_UPLOAD_RECEIPT_HEADER entity = m_Rep.GetById(model.INTERFACE_RECORD_ID);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.AR_UPLOAD_RECEIPT_HEADER();
            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.WAREHOUSE             = model.WAREHOUSE;
            entity.COMPANY                 = model.COMPANY;
            entity.RECEIPT_ID              = model.RECEIPT_ID;
            entity.RECEIPT_TYPE            = model.RECEIPT_TYPE;
            entity.PRIORITY                = model.PRIORITY;
            entity.LEADING_STS             = model.LEADING_STS;
            entity.TRAILING_STS            = model.TRAILING_STS;
            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;
            entity.RECV_DOCK               = model.RECV_DOCK;
            entity.CLOSE_DATE              = model.CLOSE_DATE;
            entity.CREATE_DATE             = model.CREATE_DATE;
            entity.START_CHECKIN_DATE      = model.START_CHECKIN_DATE;
            entity.END_CHECKIN_DATE        = model.END_CHECKIN_DATE;
            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.TOTAL_QTY               = model.TOTAL_QTY;
            entity.TOTAL_LINES             = model.TOTAL_LINES;

            m_Rep.Create(entity);
        }
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.AR.AR_UPLOAD_RECEIPT_HEADER_MODEL model, params string[] updateProperties)
        {
            Apps.Models.AR_UPLOAD_RECEIPT_HEADER 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.WAREHOUSE             = model.WAREHOUSE;
                entity.COMPANY                 = model.COMPANY;
                entity.RECEIPT_ID              = model.RECEIPT_ID;
                entity.RECEIPT_TYPE            = model.RECEIPT_TYPE;
                entity.PRIORITY                = model.PRIORITY;
                entity.LEADING_STS             = model.LEADING_STS;
                entity.TRAILING_STS            = model.TRAILING_STS;
                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;
                entity.RECV_DOCK               = model.RECV_DOCK;
                entity.CLOSE_DATE              = model.CLOSE_DATE;
                entity.CREATE_DATE             = model.CREATE_DATE;
                entity.START_CHECKIN_DATE      = model.START_CHECKIN_DATE;
                entity.END_CHECKIN_DATE        = model.END_CHECKIN_DATE;
                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.TOTAL_QTY               = model.TOTAL_QTY;
                entity.TOTAL_LINES             = model.TOTAL_LINES;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.AR.AR_UPLOAD_RECEIPT_HEADER_MODEL);
                Type typeE = typeof(Apps.Models.AR_UPLOAD_RECEIPT_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);
        }