public virtual Apps.Models.SCV.LOCATION.LOCATION_INVENTORY_TEMP_MODEL GetById(string id)
        {
            Apps.Models.LOCATION_INVENTORY_TEMP entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //LOCATION_INVENTORY_TEMP entity = m_Rep.GetById(id);
                Apps.Models.SCV.LOCATION.LOCATION_INVENTORY_TEMP_MODEL model = new Apps.Models.SCV.LOCATION.LOCATION_INVENTORY_TEMP_MODEL();
                model.INTERNAL_LOCATION_INV = entity.INTERNAL_LOCATION_INV;
                model.FLAG            = entity.FLAG;
                model.CODE            = entity.CODE;
                model.MESSAGE         = entity.MESSAGE;
                model.WAREHOUSE       = entity.WAREHOUSE;
                model.LOCATION        = entity.LOCATION;
                model.ITEM            = entity.ITEM;
                model.ITEM_DESC       = entity.ITEM_DESC;
                model.COMPANY         = entity.COMPANY;
                model.PERMANENT       = entity.PERMANENT;
                model.ATTRIBUTE_NUM   = entity.ATTRIBUTE_NUM;
                model.ON_HAND_QTY     = entity.ON_HAND_QTY;
                model.IN_TRANSIT_QTY  = entity.IN_TRANSIT_QTY;
                model.ALLOCATED_QTY   = entity.ALLOCATED_QTY;
                model.QUANTITY_UM     = entity.QUANTITY_UM;
                model.INVENTORY_STS   = entity.INVENTORY_STS;
                model.AGING_DATE      = entity.AGING_DATE;
                model.USER_STAMP      = entity.USER_STAMP;
                model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP;
                model.LPN             = entity.LPN;
                model.PARENT_LPN      = entity.PARENT_LPN;
                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.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.LOCATION.LOCATION_INVENTORY_TEMP_MODEL model)
        {
            Apps.Models.LOCATION_INVENTORY_TEMP entity = m_Rep.GetById(model.INTERNAL_LOCATION_INV);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.LOCATION_INVENTORY_TEMP();
            entity.INTERNAL_LOCATION_INV = model.INTERNAL_LOCATION_INV;
            entity.FLAG            = model.FLAG;
            entity.CODE            = model.CODE;
            entity.MESSAGE         = model.MESSAGE;
            entity.WAREHOUSE       = model.WAREHOUSE;
            entity.LOCATION        = model.LOCATION;
            entity.ITEM            = model.ITEM;
            entity.ITEM_DESC       = model.ITEM_DESC;
            entity.COMPANY         = model.COMPANY;
            entity.PERMANENT       = model.PERMANENT;
            entity.ATTRIBUTE_NUM   = model.ATTRIBUTE_NUM;
            entity.ON_HAND_QTY     = model.ON_HAND_QTY;
            entity.IN_TRANSIT_QTY  = model.IN_TRANSIT_QTY;
            entity.ALLOCATED_QTY   = model.ALLOCATED_QTY;
            entity.QUANTITY_UM     = model.QUANTITY_UM;
            entity.INVENTORY_STS   = model.INVENTORY_STS;
            entity.AGING_DATE      = model.AGING_DATE;
            entity.USER_STAMP      = model.USER_STAMP;
            entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP;
            entity.LPN             = model.LPN;
            entity.PARENT_LPN      = model.PARENT_LPN;
            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.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.LOCATION.LOCATION_INVENTORY_TEMP_MODEL model, params string[] updateProperties)
        {
            Apps.Models.LOCATION_INVENTORY_TEMP entity = m_Rep.GetById(model.INTERNAL_LOCATION_INV);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.INTERNAL_LOCATION_INV = model.INTERNAL_LOCATION_INV;
                entity.FLAG            = model.FLAG;
                entity.CODE            = model.CODE;
                entity.MESSAGE         = model.MESSAGE;
                entity.WAREHOUSE       = model.WAREHOUSE;
                entity.LOCATION        = model.LOCATION;
                entity.ITEM            = model.ITEM;
                entity.ITEM_DESC       = model.ITEM_DESC;
                entity.COMPANY         = model.COMPANY;
                entity.PERMANENT       = model.PERMANENT;
                entity.ATTRIBUTE_NUM   = model.ATTRIBUTE_NUM;
                entity.ON_HAND_QTY     = model.ON_HAND_QTY;
                entity.IN_TRANSIT_QTY  = model.IN_TRANSIT_QTY;
                entity.ALLOCATED_QTY   = model.ALLOCATED_QTY;
                entity.QUANTITY_UM     = model.QUANTITY_UM;
                entity.INVENTORY_STS   = model.INVENTORY_STS;
                entity.AGING_DATE      = model.AGING_DATE;
                entity.USER_STAMP      = model.USER_STAMP;
                entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP;
                entity.LPN             = model.LPN;
                entity.PARENT_LPN      = model.PARENT_LPN;
                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.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.LOCATION.LOCATION_INVENTORY_TEMP_MODEL);
                Type typeE = typeof(Apps.Models.LOCATION_INVENTORY_TEMP);
                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);
        }