public virtual Apps.Models.SCV.INVENTORY.INVENTORY_TRANSACTION_MODEL GetById(string id)
        {
            Apps.Models.INVENTORY_TRANSACTION entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //INVENTORY_TRANSACTION entity = m_Rep.GetById(id);
                Apps.Models.SCV.INVENTORY.INVENTORY_TRANSACTION_MODEL model = new Apps.Models.SCV.INVENTORY.INVENTORY_TRANSACTION_MODEL();
                model.INTERNAL_INV_TRAN_ID = entity.INTERNAL_INV_TRAN_ID;
                model.TRANSACTION_TYPE     = entity.TRANSACTION_TYPE;
                model.WAREHOUSE            = entity.WAREHOUSE;
                model.COMPANY               = entity.COMPANY;
                model.ITEM                  = entity.ITEM;
                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.QUANTITY              = entity.QUANTITY;
                model.QUANTITY_UM           = entity.QUANTITY_UM;
                model.LOCATION              = entity.LOCATION;
                model.LPN                   = entity.LPN;
                model.TASK_ID               = entity.TASK_ID;
                model.TASK_TYPE             = entity.TASK_TYPE;
                model.REFERENCE_ID          = entity.REFERENCE_ID;
                model.REFERENCE_NUM         = entity.REFERENCE_NUM;
                model.REFERENCE_TYPE        = entity.REFERENCE_TYPE;
                model.REFERENCE_LINE_NUM    = entity.REFERENCE_LINE_NUM;
                model.BEFORE_ON_HAND_QTY    = entity.BEFORE_ON_HAND_QTY;
                model.BEFORE_IN_TRANSIT_QTY = entity.BEFORE_IN_TRANSIT_QTY;
                model.BEFORE_ALLOC_QTY      = entity.BEFORE_ALLOC_QTY;
                model.BEFORE_STS            = entity.BEFORE_STS;
                model.AFTER_ON_HAND_QTY     = entity.AFTER_ON_HAND_QTY;
                model.AFTER_IN_TRANSIT_QTY  = entity.AFTER_IN_TRANSIT_QTY;
                model.AFTER_ALLOC_QTY       = entity.AFTER_ALLOC_QTY;
                model.AFTER_STS             = entity.AFTER_STS;
                model.USER_NAME             = entity.USER_NAME;
                model.USER_STAMP            = entity.USER_STAMP;
                model.DATE_TIME_STAMP       = entity.DATE_TIME_STAMP;

                return(model);
            }
            else
            {
                return(null);
            }
        }
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.INVENTORY.INVENTORY_TRANSACTION_MODEL model)
        {
            Apps.Models.INVENTORY_TRANSACTION entity = m_Rep.GetById(model.INTERNAL_INV_TRAN_ID);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.INVENTORY_TRANSACTION();
            entity.INTERNAL_INV_TRAN_ID = model.INTERNAL_INV_TRAN_ID;
            entity.TRANSACTION_TYPE     = model.TRANSACTION_TYPE;
            entity.WAREHOUSE            = model.WAREHOUSE;
            entity.COMPANY               = model.COMPANY;
            entity.ITEM                  = model.ITEM;
            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.QUANTITY              = model.QUANTITY;
            entity.QUANTITY_UM           = model.QUANTITY_UM;
            entity.LOCATION              = model.LOCATION;
            entity.LPN                   = model.LPN;
            entity.TASK_ID               = model.TASK_ID;
            entity.TASK_TYPE             = model.TASK_TYPE;
            entity.REFERENCE_ID          = model.REFERENCE_ID;
            entity.REFERENCE_NUM         = model.REFERENCE_NUM;
            entity.REFERENCE_TYPE        = model.REFERENCE_TYPE;
            entity.REFERENCE_LINE_NUM    = model.REFERENCE_LINE_NUM;
            entity.BEFORE_ON_HAND_QTY    = model.BEFORE_ON_HAND_QTY;
            entity.BEFORE_IN_TRANSIT_QTY = model.BEFORE_IN_TRANSIT_QTY;
            entity.BEFORE_ALLOC_QTY      = model.BEFORE_ALLOC_QTY;
            entity.BEFORE_STS            = model.BEFORE_STS;
            entity.AFTER_ON_HAND_QTY     = model.AFTER_ON_HAND_QTY;
            entity.AFTER_IN_TRANSIT_QTY  = model.AFTER_IN_TRANSIT_QTY;
            entity.AFTER_ALLOC_QTY       = model.AFTER_ALLOC_QTY;
            entity.AFTER_STS             = model.AFTER_STS;
            entity.USER_NAME             = model.USER_NAME;
            entity.USER_STAMP            = model.USER_STAMP;
            entity.DATE_TIME_STAMP       = model.DATE_TIME_STAMP;

            m_Rep.Create(entity);
        }
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.INVENTORY.INVENTORY_TRANSACTION_MODEL model, params string[] updateProperties)
        {
            Apps.Models.INVENTORY_TRANSACTION entity = m_Rep.GetById(model.INTERNAL_INV_TRAN_ID);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.INTERNAL_INV_TRAN_ID = model.INTERNAL_INV_TRAN_ID;
                entity.TRANSACTION_TYPE     = model.TRANSACTION_TYPE;
                entity.WAREHOUSE            = model.WAREHOUSE;
                entity.COMPANY               = model.COMPANY;
                entity.ITEM                  = model.ITEM;
                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.QUANTITY              = model.QUANTITY;
                entity.QUANTITY_UM           = model.QUANTITY_UM;
                entity.LOCATION              = model.LOCATION;
                entity.LPN                   = model.LPN;
                entity.TASK_ID               = model.TASK_ID;
                entity.TASK_TYPE             = model.TASK_TYPE;
                entity.REFERENCE_ID          = model.REFERENCE_ID;
                entity.REFERENCE_NUM         = model.REFERENCE_NUM;
                entity.REFERENCE_TYPE        = model.REFERENCE_TYPE;
                entity.REFERENCE_LINE_NUM    = model.REFERENCE_LINE_NUM;
                entity.BEFORE_ON_HAND_QTY    = model.BEFORE_ON_HAND_QTY;
                entity.BEFORE_IN_TRANSIT_QTY = model.BEFORE_IN_TRANSIT_QTY;
                entity.BEFORE_ALLOC_QTY      = model.BEFORE_ALLOC_QTY;
                entity.BEFORE_STS            = model.BEFORE_STS;
                entity.AFTER_ON_HAND_QTY     = model.AFTER_ON_HAND_QTY;
                entity.AFTER_IN_TRANSIT_QTY  = model.AFTER_IN_TRANSIT_QTY;
                entity.AFTER_ALLOC_QTY       = model.AFTER_ALLOC_QTY;
                entity.AFTER_STS             = model.AFTER_STS;
                entity.USER_NAME             = model.USER_NAME;
                entity.USER_STAMP            = model.USER_STAMP;
                entity.DATE_TIME_STAMP       = model.DATE_TIME_STAMP;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.INVENTORY.INVENTORY_TRANSACTION_MODEL);
                Type typeE = typeof(Apps.Models.INVENTORY_TRANSACTION);
                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);
        }