public virtual Apps.Models.SCV.WORK.WORK_ORDER_DETAIL_MODEL GetById(string id)
        {
            Apps.Models.WORK_ORDER_DETAIL entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //WORK_ORDER_DETAIL entity = m_Rep.GetById(id);
                Apps.Models.SCV.WORK.WORK_ORDER_DETAIL_MODEL model = new Apps.Models.SCV.WORK.WORK_ORDER_DETAIL_MODEL();
                model.INTERNAL_NUM            = entity.INTERNAL_NUM;
                model.INTERNAL_WORK_ORDER_NUM = entity.INTERNAL_WORK_ORDER_NUM;
                model.WAREHOUSE                  = entity.WAREHOUSE;
                model.ITEM                       = entity.ITEM;
                model.COMPANY                    = entity.COMPANY;
                model.BUILD_SEQ                  = entity.BUILD_SEQ;
                model.BUILD_LEVEL                = entity.BUILD_LEVEL;
                model.QTY_NEEDED_PER_ITEM        = entity.QTY_NEEDED_PER_ITEM;
                model.TOTAL_QTY_NEEDED           = entity.TOTAL_QTY_NEEDED;
                model.TOTAL_QTY_USED             = entity.TOTAL_QTY_USED;
                model.QUANTITY_UM                = entity.QUANTITY_UM;
                model.FROM_LOC                   = entity.FROM_LOC;
                model.ALLOCATION_RULE            = entity.ALLOCATION_RULE;
                model.INTERNAL_WAVE_NUM          = entity.INTERNAL_WAVE_NUM;
                model.TASK_CREATED               = entity.TASK_CREATED;
                model.ALLOCATED                  = entity.ALLOCATED;
                model.TOTAL_CONVERTED_QTY_NEEDED = entity.TOTAL_CONVERTED_QTY_NEEDED;
                model.CONVERTED_UM               = entity.CONVERTED_UM;
                model.ITEM_DESC                  = entity.ITEM_DESC;
                model.IN_ALLOCATION              = entity.IN_ALLOCATION;
                model.ATTRIBUTE_NUM              = entity.ATTRIBUTE_NUM;
                model.ATTRIBUTE1                 = entity.ATTRIBUTE1;
                model.ATTRIBUTE2                 = entity.ATTRIBUTE2;
                model.ATTRIBUTE3                 = entity.ATTRIBUTE3;
                model.ATTRIBUTE4                 = entity.ATTRIBUTE4;
                model.ATTRIBUTE5                 = entity.ATTRIBUTE5;
                model.ATTRIBUTE6                 = entity.ATTRIBUTE6;
                model.ATTRIBUTE7                 = entity.ATTRIBUTE7;
                model.ATTRIBUTE8                 = entity.ATTRIBUTE8;
                model.LPN               = entity.LPN;
                model.PARENT_LPN        = entity.PARENT_LPN;
                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_STAMP        = entity.USER_STAMP;
                model.PROCESS_STAMP     = entity.PROCESS_STAMP;
                model.CREATED_DATE_TIME = entity.CREATED_DATE_TIME;

                return(model);
            }
            else
            {
                return(null);
            }
        }
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.WORK.WORK_ORDER_DETAIL_MODEL model)
        {
            Apps.Models.WORK_ORDER_DETAIL entity = m_Rep.GetById(model.INTERNAL_NUM);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.WORK_ORDER_DETAIL();
            entity.INTERNAL_NUM            = model.INTERNAL_NUM;
            entity.INTERNAL_WORK_ORDER_NUM = model.INTERNAL_WORK_ORDER_NUM;
            entity.WAREHOUSE                  = model.WAREHOUSE;
            entity.ITEM                       = model.ITEM;
            entity.COMPANY                    = model.COMPANY;
            entity.BUILD_SEQ                  = model.BUILD_SEQ;
            entity.BUILD_LEVEL                = model.BUILD_LEVEL;
            entity.QTY_NEEDED_PER_ITEM        = model.QTY_NEEDED_PER_ITEM;
            entity.TOTAL_QTY_NEEDED           = model.TOTAL_QTY_NEEDED;
            entity.TOTAL_QTY_USED             = model.TOTAL_QTY_USED;
            entity.QUANTITY_UM                = model.QUANTITY_UM;
            entity.FROM_LOC                   = model.FROM_LOC;
            entity.ALLOCATION_RULE            = model.ALLOCATION_RULE;
            entity.INTERNAL_WAVE_NUM          = model.INTERNAL_WAVE_NUM;
            entity.TASK_CREATED               = model.TASK_CREATED;
            entity.ALLOCATED                  = model.ALLOCATED;
            entity.TOTAL_CONVERTED_QTY_NEEDED = model.TOTAL_CONVERTED_QTY_NEEDED;
            entity.CONVERTED_UM               = model.CONVERTED_UM;
            entity.ITEM_DESC                  = model.ITEM_DESC;
            entity.IN_ALLOCATION              = model.IN_ALLOCATION;
            entity.ATTRIBUTE_NUM              = model.ATTRIBUTE_NUM;
            entity.ATTRIBUTE1                 = model.ATTRIBUTE1;
            entity.ATTRIBUTE2                 = model.ATTRIBUTE2;
            entity.ATTRIBUTE3                 = model.ATTRIBUTE3;
            entity.ATTRIBUTE4                 = model.ATTRIBUTE4;
            entity.ATTRIBUTE5                 = model.ATTRIBUTE5;
            entity.ATTRIBUTE6                 = model.ATTRIBUTE6;
            entity.ATTRIBUTE7                 = model.ATTRIBUTE7;
            entity.ATTRIBUTE8                 = model.ATTRIBUTE8;
            entity.LPN               = model.LPN;
            entity.PARENT_LPN        = model.PARENT_LPN;
            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_STAMP        = model.USER_STAMP;
            entity.PROCESS_STAMP     = model.PROCESS_STAMP;
            entity.CREATED_DATE_TIME = model.CREATED_DATE_TIME;

            m_Rep.Create(entity);
        }
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.WORK.WORK_ORDER_DETAIL_MODEL model, params string[] updateProperties)
        {
            Apps.Models.WORK_ORDER_DETAIL entity = m_Rep.GetById(model.INTERNAL_NUM);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.INTERNAL_NUM            = model.INTERNAL_NUM;
                entity.INTERNAL_WORK_ORDER_NUM = model.INTERNAL_WORK_ORDER_NUM;
                entity.WAREHOUSE                  = model.WAREHOUSE;
                entity.ITEM                       = model.ITEM;
                entity.COMPANY                    = model.COMPANY;
                entity.BUILD_SEQ                  = model.BUILD_SEQ;
                entity.BUILD_LEVEL                = model.BUILD_LEVEL;
                entity.QTY_NEEDED_PER_ITEM        = model.QTY_NEEDED_PER_ITEM;
                entity.TOTAL_QTY_NEEDED           = model.TOTAL_QTY_NEEDED;
                entity.TOTAL_QTY_USED             = model.TOTAL_QTY_USED;
                entity.QUANTITY_UM                = model.QUANTITY_UM;
                entity.FROM_LOC                   = model.FROM_LOC;
                entity.ALLOCATION_RULE            = model.ALLOCATION_RULE;
                entity.INTERNAL_WAVE_NUM          = model.INTERNAL_WAVE_NUM;
                entity.TASK_CREATED               = model.TASK_CREATED;
                entity.ALLOCATED                  = model.ALLOCATED;
                entity.TOTAL_CONVERTED_QTY_NEEDED = model.TOTAL_CONVERTED_QTY_NEEDED;
                entity.CONVERTED_UM               = model.CONVERTED_UM;
                entity.ITEM_DESC                  = model.ITEM_DESC;
                entity.IN_ALLOCATION              = model.IN_ALLOCATION;
                entity.ATTRIBUTE_NUM              = model.ATTRIBUTE_NUM;
                entity.ATTRIBUTE1                 = model.ATTRIBUTE1;
                entity.ATTRIBUTE2                 = model.ATTRIBUTE2;
                entity.ATTRIBUTE3                 = model.ATTRIBUTE3;
                entity.ATTRIBUTE4                 = model.ATTRIBUTE4;
                entity.ATTRIBUTE5                 = model.ATTRIBUTE5;
                entity.ATTRIBUTE6                 = model.ATTRIBUTE6;
                entity.ATTRIBUTE7                 = model.ATTRIBUTE7;
                entity.ATTRIBUTE8                 = model.ATTRIBUTE8;
                entity.LPN               = model.LPN;
                entity.PARENT_LPN        = model.PARENT_LPN;
                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_STAMP        = model.USER_STAMP;
                entity.PROCESS_STAMP     = model.PROCESS_STAMP;
                entity.CREATED_DATE_TIME = model.CREATED_DATE_TIME;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.WORK.WORK_ORDER_DETAIL_MODEL);
                Type typeE = typeof(Apps.Models.WORK_ORDER_DETAIL);
                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);
        }