public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.RECEIPT.RECEIPT_HEADER_MODEL model, params string[] updateProperties)
        {
            Apps.Models.RECEIPT_HEADER entity = m_Rep.GetById(model.INTERNAL_RECEIPT_NUM);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.INTERNAL_RECEIPT_NUM = model.INTERNAL_RECEIPT_NUM;
                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;
                entity.UPLOAD_INTERFACE_FLAG      = model.UPLOAD_INTERFACE_FLAG;
                entity.CREATE_DATE_TIME           = model.CREATE_DATE_TIME;
                entity.CREATE_USER                = model.CREATE_USER;
                entity.USER_DEF9                  = model.USER_DEF9;
                entity.USER_DEF10                 = model.USER_DEF10;
                entity.UPLOAD_INTERFACE_DATE_TIME = model.UPLOAD_INTERFACE_DATE_TIME;
                entity.UPLOAD_INTERFACE_REQUIRED  = model.UPLOAD_INTERFACE_REQUIRED;
                entity.HOST_COMPANY               = model.HOST_COMPANY;
                entity.RECEIPT_NOTE               = model.RECEIPT_NOTE;
                entity.SHIPPING_NOTE              = model.SHIPPING_NOTE;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.RECEIPT.RECEIPT_HEADER_MODEL);
                Type typeE = typeof(Apps.Models.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);
        }
        public virtual Apps.Models.SCV.RECEIPT.RECEIPT_HEADER_MODEL GetById(string id)
        {
            Apps.Models.RECEIPT_HEADER entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //RECEIPT_HEADER entity = m_Rep.GetById(id);
                Apps.Models.SCV.RECEIPT.RECEIPT_HEADER_MODEL model = new Apps.Models.SCV.RECEIPT.RECEIPT_HEADER_MODEL();
                model.INTERNAL_RECEIPT_NUM = entity.INTERNAL_RECEIPT_NUM;
                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;
                model.UPLOAD_INTERFACE_FLAG      = entity.UPLOAD_INTERFACE_FLAG;
                model.CREATE_DATE_TIME           = entity.CREATE_DATE_TIME;
                model.CREATE_USER                = entity.CREATE_USER;
                model.USER_DEF9                  = entity.USER_DEF9;
                model.USER_DEF10                 = entity.USER_DEF10;
                model.UPLOAD_INTERFACE_DATE_TIME = entity.UPLOAD_INTERFACE_DATE_TIME;
                model.UPLOAD_INTERFACE_REQUIRED  = entity.UPLOAD_INTERFACE_REQUIRED;
                model.HOST_COMPANY               = entity.HOST_COMPANY;
                model.RECEIPT_NOTE               = entity.RECEIPT_NOTE;
                model.SHIPPING_NOTE              = entity.SHIPPING_NOTE;

                return(model);
            }
            else
            {
                return(null);
            }
        }
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.RECEIPT.RECEIPT_HEADER_MODEL model)
        {
            Apps.Models.RECEIPT_HEADER entity = m_Rep.GetById(model.INTERNAL_RECEIPT_NUM);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.RECEIPT_HEADER();
            entity.INTERNAL_RECEIPT_NUM = model.INTERNAL_RECEIPT_NUM;
            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;
            entity.UPLOAD_INTERFACE_FLAG      = model.UPLOAD_INTERFACE_FLAG;
            entity.CREATE_DATE_TIME           = model.CREATE_DATE_TIME;
            entity.CREATE_USER                = model.CREATE_USER;
            entity.USER_DEF9                  = model.USER_DEF9;
            entity.USER_DEF10                 = model.USER_DEF10;
            entity.UPLOAD_INTERFACE_DATE_TIME = model.UPLOAD_INTERFACE_DATE_TIME;
            entity.UPLOAD_INTERFACE_REQUIRED  = model.UPLOAD_INTERFACE_REQUIRED;
            entity.HOST_COMPANY               = model.HOST_COMPANY;
            entity.RECEIPT_NOTE               = model.RECEIPT_NOTE;
            entity.SHIPPING_NOTE              = model.SHIPPING_NOTE;

            m_Rep.Create(entity);
        }