コード例 #1
0
        public virtual Apps.Models.SCV.SHIPPING.SHIPPING_CONTAINER_HIS_MODEL GetById(string id)
        {
            Apps.Models.SHIPPING_CONTAINER_HIS entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //SHIPPING_CONTAINER_HIS entity = m_Rep.GetById(id);
                Apps.Models.SCV.SHIPPING.SHIPPING_CONTAINER_HIS_MODEL model = new Apps.Models.SCV.SHIPPING.SHIPPING_CONTAINER_HIS_MODEL();
                model.ID = entity.ID;
                model.INTERNAL_CONTAINER_NUM = entity.INTERNAL_CONTAINER_NUM;
                model.CONTAINER_ID           = entity.CONTAINER_ID;
                model.WEIGHT              = entity.WEIGHT;
                model.WEIGHT_NUM          = entity.WEIGHT_NUM;
                model.UPDATE_USER         = entity.UPDATE_USER;
                model.UPDATE_DATATIME     = entity.UPDATE_DATATIME;
                model.UPDATE_USERNAME     = entity.UPDATE_USERNAME;
                model.UPDATE_USERTRUENAME = entity.UPDATE_USERTRUENAME;
                model.TRACKING_NUMBER     = entity.TRACKING_NUMBER;

                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.SHIPPING.SHIPPING_CONTAINER_HIS_MODEL model)
        {
            Apps.Models.SHIPPING_CONTAINER_HIS entity = m_Rep.GetById(model.ID);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity    = new Apps.Models.SHIPPING_CONTAINER_HIS();
            entity.ID = model.ID;
            entity.INTERNAL_CONTAINER_NUM = model.INTERNAL_CONTAINER_NUM;
            entity.CONTAINER_ID           = model.CONTAINER_ID;
            entity.WEIGHT              = model.WEIGHT;
            entity.WEIGHT_NUM          = model.WEIGHT_NUM;
            entity.UPDATE_USER         = model.UPDATE_USER;
            entity.UPDATE_DATATIME     = model.UPDATE_DATATIME;
            entity.UPDATE_USERNAME     = model.UPDATE_USERNAME;
            entity.UPDATE_USERTRUENAME = model.UPDATE_USERTRUENAME;
            entity.TRACKING_NUMBER     = model.TRACKING_NUMBER;

            m_Rep.Create(entity);
        }
コード例 #3
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.SHIPPING.SHIPPING_CONTAINER_HIS_MODEL model, params string[] updateProperties)
        {
            Apps.Models.SHIPPING_CONTAINER_HIS entity = m_Rep.GetById(model.ID);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.ID = model.ID;
                entity.INTERNAL_CONTAINER_NUM = model.INTERNAL_CONTAINER_NUM;
                entity.CONTAINER_ID           = model.CONTAINER_ID;
                entity.WEIGHT              = model.WEIGHT;
                entity.WEIGHT_NUM          = model.WEIGHT_NUM;
                entity.UPDATE_USER         = model.UPDATE_USER;
                entity.UPDATE_DATATIME     = model.UPDATE_DATATIME;
                entity.UPDATE_USERNAME     = model.UPDATE_USERNAME;
                entity.UPDATE_USERTRUENAME = model.UPDATE_USERTRUENAME;
                entity.TRACKING_NUMBER     = model.TRACKING_NUMBER;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.SHIPPING.SHIPPING_CONTAINER_HIS_MODEL);
                Type typeE = typeof(Apps.Models.SHIPPING_CONTAINER_HIS);
                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);
        }