public virtual Apps.Models.SCV.REPLENISHMENT.REPLENISHMENT_REQUEST_MODEL GetById(string id)
        {
            Apps.Models.REPLENISHMENT_REQUEST entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //REPLENISHMENT_REQUEST entity = m_Rep.GetById(id);
                Apps.Models.SCV.REPLENISHMENT.REPLENISHMENT_REQUEST_MODEL model = new Apps.Models.SCV.REPLENISHMENT.REPLENISHMENT_REQUEST_MODEL();
                model.INTERNAL_RPLN_REQ_NUM = entity.INTERNAL_RPLN_REQ_NUM;
                model.COMPANY             = entity.COMPANY;
                model.WAREHOUSE           = entity.WAREHOUSE;
                model.PRIORITY            = entity.PRIORITY;
                model.ITEM                = entity.ITEM;
                model.ITEM_DESC           = entity.ITEM_DESC;
                model.ALLOCATED_QTY       = entity.ALLOCATED_QTY;
                model.QUANTITY_UM         = entity.QUANTITY_UM;
                model.ATTRIBUTE_NUM       = entity.ATTRIBUTE_NUM;
                model.ALLOCATION_ZONE     = entity.ALLOCATION_ZONE;
                model.INTERNAL_WAVE_NUM   = entity.INTERNAL_WAVE_NUM;
                model.USER_STAMP          = entity.USER_STAMP;
                model.DATE_TIME_STAMP     = entity.DATE_TIME_STAMP;
                model.CONVERTED_ALLOC_QTY = entity.CONVERTED_ALLOC_QTY;
                model.CONVERTED_QTY_UM    = entity.CONVERTED_QTY_UM;
                model.FROM_LOC            = entity.FROM_LOC;
                model.TO_LOC              = entity.TO_LOC;
                model.FROM_TEMPL_FIELD1   = entity.FROM_TEMPL_FIELD1;
                model.FROM_TEMPL_FIELD2   = entity.FROM_TEMPL_FIELD2;
                model.FROM_TEMPL_FIELD3   = entity.FROM_TEMPL_FIELD3;
                model.FROM_TEMPL_FIELD4   = entity.FROM_TEMPL_FIELD4;
                model.FROM_TEMPL_FIELD5   = entity.FROM_TEMPL_FIELD5;
                model.TO_TEMPL_FIELD1     = entity.TO_TEMPL_FIELD1;
                model.TO_TEMPL_FIELD2     = entity.TO_TEMPL_FIELD2;
                model.TO_TEMPL_FIELD3     = entity.TO_TEMPL_FIELD3;
                model.TO_TEMPL_FIELD4     = entity.TO_TEMPL_FIELD4;
                model.TO_TEMPL_FIELD5     = entity.TO_TEMPL_FIELD5;
                model.TASK_CREATED        = entity.TASK_CREATED;
                model.FROM_ZONE           = entity.FROM_ZONE;
                model.FROM_LPN            = entity.FROM_LPN;
                model.FROM_PARENT_LPN     = entity.FROM_PARENT_LPN;
                model.TO_ZONE             = entity.TO_ZONE;
                model.TO_LPN              = entity.TO_LPN;
                model.TO_PARENT_LPN       = entity.TO_PARENT_LPN;
                model.REPLENISHMENT_TYPE  = entity.REPLENISHMENT_TYPE;
                model.INVENTORY_STS       = entity.INVENTORY_STS;

                return(model);
            }
            else
            {
                return(null);
            }
        }
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.REPLENISHMENT.REPLENISHMENT_REQUEST_MODEL model)
        {
            Apps.Models.REPLENISHMENT_REQUEST entity = m_Rep.GetById(model.INTERNAL_RPLN_REQ_NUM);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.REPLENISHMENT_REQUEST();
            entity.INTERNAL_RPLN_REQ_NUM = model.INTERNAL_RPLN_REQ_NUM;
            entity.COMPANY             = model.COMPANY;
            entity.WAREHOUSE           = model.WAREHOUSE;
            entity.PRIORITY            = model.PRIORITY;
            entity.ITEM                = model.ITEM;
            entity.ITEM_DESC           = model.ITEM_DESC;
            entity.ALLOCATED_QTY       = model.ALLOCATED_QTY;
            entity.QUANTITY_UM         = model.QUANTITY_UM;
            entity.ATTRIBUTE_NUM       = model.ATTRIBUTE_NUM;
            entity.ALLOCATION_ZONE     = model.ALLOCATION_ZONE;
            entity.INTERNAL_WAVE_NUM   = model.INTERNAL_WAVE_NUM;
            entity.USER_STAMP          = model.USER_STAMP;
            entity.DATE_TIME_STAMP     = model.DATE_TIME_STAMP;
            entity.CONVERTED_ALLOC_QTY = model.CONVERTED_ALLOC_QTY;
            entity.CONVERTED_QTY_UM    = model.CONVERTED_QTY_UM;
            entity.FROM_LOC            = model.FROM_LOC;
            entity.TO_LOC              = model.TO_LOC;
            entity.FROM_TEMPL_FIELD1   = model.FROM_TEMPL_FIELD1;
            entity.FROM_TEMPL_FIELD2   = model.FROM_TEMPL_FIELD2;
            entity.FROM_TEMPL_FIELD3   = model.FROM_TEMPL_FIELD3;
            entity.FROM_TEMPL_FIELD4   = model.FROM_TEMPL_FIELD4;
            entity.FROM_TEMPL_FIELD5   = model.FROM_TEMPL_FIELD5;
            entity.TO_TEMPL_FIELD1     = model.TO_TEMPL_FIELD1;
            entity.TO_TEMPL_FIELD2     = model.TO_TEMPL_FIELD2;
            entity.TO_TEMPL_FIELD3     = model.TO_TEMPL_FIELD3;
            entity.TO_TEMPL_FIELD4     = model.TO_TEMPL_FIELD4;
            entity.TO_TEMPL_FIELD5     = model.TO_TEMPL_FIELD5;
            entity.TASK_CREATED        = model.TASK_CREATED;
            entity.FROM_ZONE           = model.FROM_ZONE;
            entity.FROM_LPN            = model.FROM_LPN;
            entity.FROM_PARENT_LPN     = model.FROM_PARENT_LPN;
            entity.TO_ZONE             = model.TO_ZONE;
            entity.TO_LPN              = model.TO_LPN;
            entity.TO_PARENT_LPN       = model.TO_PARENT_LPN;
            entity.REPLENISHMENT_TYPE  = model.REPLENISHMENT_TYPE;
            entity.INVENTORY_STS       = model.INVENTORY_STS;

            m_Rep.Create(entity);
        }
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.REPLENISHMENT.REPLENISHMENT_REQUEST_MODEL model, params string[] updateProperties)
        {
            Apps.Models.REPLENISHMENT_REQUEST entity = m_Rep.GetById(model.INTERNAL_RPLN_REQ_NUM);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.INTERNAL_RPLN_REQ_NUM = model.INTERNAL_RPLN_REQ_NUM;
                entity.COMPANY             = model.COMPANY;
                entity.WAREHOUSE           = model.WAREHOUSE;
                entity.PRIORITY            = model.PRIORITY;
                entity.ITEM                = model.ITEM;
                entity.ITEM_DESC           = model.ITEM_DESC;
                entity.ALLOCATED_QTY       = model.ALLOCATED_QTY;
                entity.QUANTITY_UM         = model.QUANTITY_UM;
                entity.ATTRIBUTE_NUM       = model.ATTRIBUTE_NUM;
                entity.ALLOCATION_ZONE     = model.ALLOCATION_ZONE;
                entity.INTERNAL_WAVE_NUM   = model.INTERNAL_WAVE_NUM;
                entity.USER_STAMP          = model.USER_STAMP;
                entity.DATE_TIME_STAMP     = model.DATE_TIME_STAMP;
                entity.CONVERTED_ALLOC_QTY = model.CONVERTED_ALLOC_QTY;
                entity.CONVERTED_QTY_UM    = model.CONVERTED_QTY_UM;
                entity.FROM_LOC            = model.FROM_LOC;
                entity.TO_LOC              = model.TO_LOC;
                entity.FROM_TEMPL_FIELD1   = model.FROM_TEMPL_FIELD1;
                entity.FROM_TEMPL_FIELD2   = model.FROM_TEMPL_FIELD2;
                entity.FROM_TEMPL_FIELD3   = model.FROM_TEMPL_FIELD3;
                entity.FROM_TEMPL_FIELD4   = model.FROM_TEMPL_FIELD4;
                entity.FROM_TEMPL_FIELD5   = model.FROM_TEMPL_FIELD5;
                entity.TO_TEMPL_FIELD1     = model.TO_TEMPL_FIELD1;
                entity.TO_TEMPL_FIELD2     = model.TO_TEMPL_FIELD2;
                entity.TO_TEMPL_FIELD3     = model.TO_TEMPL_FIELD3;
                entity.TO_TEMPL_FIELD4     = model.TO_TEMPL_FIELD4;
                entity.TO_TEMPL_FIELD5     = model.TO_TEMPL_FIELD5;
                entity.TASK_CREATED        = model.TASK_CREATED;
                entity.FROM_ZONE           = model.FROM_ZONE;
                entity.FROM_LPN            = model.FROM_LPN;
                entity.FROM_PARENT_LPN     = model.FROM_PARENT_LPN;
                entity.TO_ZONE             = model.TO_ZONE;
                entity.TO_LPN              = model.TO_LPN;
                entity.TO_PARENT_LPN       = model.TO_PARENT_LPN;
                entity.REPLENISHMENT_TYPE  = model.REPLENISHMENT_TYPE;
                entity.INVENTORY_STS       = model.INVENTORY_STS;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.REPLENISHMENT.REPLENISHMENT_REQUEST_MODEL);
                Type typeE = typeof(Apps.Models.REPLENISHMENT_REQUEST);
                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);
        }