public virtual Apps.Models.SCV.CYCLE.CYCLE_COUNT_DETAIL_MODEL GetById(string id)
        {
            Apps.Models.CYCLE_COUNT_DETAIL entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //CYCLE_COUNT_DETAIL entity = m_Rep.GetById(id);
                Apps.Models.SCV.CYCLE.CYCLE_COUNT_DETAIL_MODEL model = new Apps.Models.SCV.CYCLE.CYCLE_COUNT_DETAIL_MODEL();
                model.INTERNAL_COUNT_NUM       = entity.INTERNAL_COUNT_NUM;
                model.INTERNAL_CYCLE_COUNT_NUM = entity.INTERNAL_CYCLE_COUNT_NUM;
                model.ROUND                   = entity.ROUND;
                model.GROUP_NUM               = entity.GROUP_NUM;
                model.GROUP_INDEX             = entity.GROUP_INDEX;
                model.WAREHOUSE               = entity.WAREHOUSE;
                model.LOCATION                = entity.LOCATION;
                model.PARENT_LPN              = entity.PARENT_LPN;
                model.LPN                     = entity.LPN;
                model.ITEM                    = entity.ITEM;
                model.ITEM_DESC               = entity.ITEM_DESC;
                model.COMPANY                 = entity.COMPANY;
                model.INVENTORY_STS           = entity.INVENTORY_STS;
                model.SYSTEM_QTY              = entity.SYSTEM_QTY;
                model.COUNTED_QTY             = entity.COUNTED_QTY;
                model.QUANTITY_UM             = entity.QUANTITY_UM;
                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.COUNT_ATTRIBUTE         = entity.COUNT_ATTRIBUTE;
                model.COUNTED_DATE_TIME       = entity.COUNTED_DATE_TIME;
                model.COUNTED_BY_USER         = entity.COUNTED_BY_USER;
                model.ASSIGNED_USER           = entity.ASSIGNED_USER;
                model.ASSIGNED_DATE_TIME      = entity.ASSIGNED_DATE_TIME;
                model.COMPLETED_USER          = entity.COMPLETED_USER;
                model.COMPLETED_DATE_TIME     = entity.COMPLETED_DATE_TIME;
                model.CONDITION               = entity.CONDITION;
                model.CREATED_USER            = entity.CREATED_USER;
                model.CREATED_DATE_TIME       = entity.CREATED_DATE_TIME;
                model.LAST_MODIFIED_USER      = entity.LAST_MODIFIED_USER;
                model.LAST_MODIFIED_DATE_TIME = entity.LAST_MODIFIED_DATE_TIME;
                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;

                return(model);
            }
            else
            {
                return(null);
            }
        }
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.CYCLE.CYCLE_COUNT_DETAIL_MODEL model)
        {
            Apps.Models.CYCLE_COUNT_DETAIL entity = m_Rep.GetById(model.INTERNAL_COUNT_NUM);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.CYCLE_COUNT_DETAIL();
            entity.INTERNAL_COUNT_NUM       = model.INTERNAL_COUNT_NUM;
            entity.INTERNAL_CYCLE_COUNT_NUM = model.INTERNAL_CYCLE_COUNT_NUM;
            entity.ROUND                   = model.ROUND;
            entity.GROUP_NUM               = model.GROUP_NUM;
            entity.GROUP_INDEX             = model.GROUP_INDEX;
            entity.WAREHOUSE               = model.WAREHOUSE;
            entity.LOCATION                = model.LOCATION;
            entity.PARENT_LPN              = model.PARENT_LPN;
            entity.LPN                     = model.LPN;
            entity.ITEM                    = model.ITEM;
            entity.ITEM_DESC               = model.ITEM_DESC;
            entity.COMPANY                 = model.COMPANY;
            entity.INVENTORY_STS           = model.INVENTORY_STS;
            entity.SYSTEM_QTY              = model.SYSTEM_QTY;
            entity.COUNTED_QTY             = model.COUNTED_QTY;
            entity.QUANTITY_UM             = model.QUANTITY_UM;
            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.COUNT_ATTRIBUTE         = model.COUNT_ATTRIBUTE;
            entity.COUNTED_DATE_TIME       = model.COUNTED_DATE_TIME;
            entity.COUNTED_BY_USER         = model.COUNTED_BY_USER;
            entity.ASSIGNED_USER           = model.ASSIGNED_USER;
            entity.ASSIGNED_DATE_TIME      = model.ASSIGNED_DATE_TIME;
            entity.COMPLETED_USER          = model.COMPLETED_USER;
            entity.COMPLETED_DATE_TIME     = model.COMPLETED_DATE_TIME;
            entity.CONDITION               = model.CONDITION;
            entity.CREATED_USER            = model.CREATED_USER;
            entity.CREATED_DATE_TIME       = model.CREATED_DATE_TIME;
            entity.LAST_MODIFIED_USER      = model.LAST_MODIFIED_USER;
            entity.LAST_MODIFIED_DATE_TIME = model.LAST_MODIFIED_DATE_TIME;
            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;

            m_Rep.Create(entity);
        }
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.CYCLE.CYCLE_COUNT_DETAIL_MODEL model, params string[] updateProperties)
        {
            Apps.Models.CYCLE_COUNT_DETAIL entity = m_Rep.GetById(model.INTERNAL_COUNT_NUM);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.INTERNAL_COUNT_NUM       = model.INTERNAL_COUNT_NUM;
                entity.INTERNAL_CYCLE_COUNT_NUM = model.INTERNAL_CYCLE_COUNT_NUM;
                entity.ROUND                   = model.ROUND;
                entity.GROUP_NUM               = model.GROUP_NUM;
                entity.GROUP_INDEX             = model.GROUP_INDEX;
                entity.WAREHOUSE               = model.WAREHOUSE;
                entity.LOCATION                = model.LOCATION;
                entity.PARENT_LPN              = model.PARENT_LPN;
                entity.LPN                     = model.LPN;
                entity.ITEM                    = model.ITEM;
                entity.ITEM_DESC               = model.ITEM_DESC;
                entity.COMPANY                 = model.COMPANY;
                entity.INVENTORY_STS           = model.INVENTORY_STS;
                entity.SYSTEM_QTY              = model.SYSTEM_QTY;
                entity.COUNTED_QTY             = model.COUNTED_QTY;
                entity.QUANTITY_UM             = model.QUANTITY_UM;
                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.COUNT_ATTRIBUTE         = model.COUNT_ATTRIBUTE;
                entity.COUNTED_DATE_TIME       = model.COUNTED_DATE_TIME;
                entity.COUNTED_BY_USER         = model.COUNTED_BY_USER;
                entity.ASSIGNED_USER           = model.ASSIGNED_USER;
                entity.ASSIGNED_DATE_TIME      = model.ASSIGNED_DATE_TIME;
                entity.COMPLETED_USER          = model.COMPLETED_USER;
                entity.COMPLETED_DATE_TIME     = model.COMPLETED_DATE_TIME;
                entity.CONDITION               = model.CONDITION;
                entity.CREATED_USER            = model.CREATED_USER;
                entity.CREATED_DATE_TIME       = model.CREATED_DATE_TIME;
                entity.LAST_MODIFIED_USER      = model.LAST_MODIFIED_USER;
                entity.LAST_MODIFIED_DATE_TIME = model.LAST_MODIFIED_DATE_TIME;
                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;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.CYCLE.CYCLE_COUNT_DETAIL_MODEL);
                Type typeE = typeof(Apps.Models.CYCLE_COUNT_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);
        }