コード例 #1
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.ITEM.ITEM_BEIYONG_MODEL model, params string[] updateProperties)
        {
            Apps.Models.ITEM_BEIYONG entity = m_Rep.GetById(model.ID);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.ID     = model.ID;
                entity.huowei = model.huowei;
                entity.item   = model.item;
                entity.data   = model.data;
                entity.datab  = model.datab;
                entity.ndata  = model.ndata;
                entity.ndatab = model.ndatab;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.ITEM.ITEM_BEIYONG_MODEL);
                Type typeE = typeof(Apps.Models.ITEM_BEIYONG);
                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);
        }
コード例 #2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.ITEM.ITEM_BEIYONG_MODEL model)
        {
            Apps.Models.ITEM_BEIYONG entity = m_Rep.GetById(model.ID);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity        = new Apps.Models.ITEM_BEIYONG();
            entity.ID     = model.ID;
            entity.huowei = model.huowei;
            entity.item   = model.item;
            entity.data   = model.data;
            entity.datab  = model.datab;
            entity.ndata  = model.ndata;
            entity.ndatab = model.ndatab;

            m_Rep.Create(entity);
        }
コード例 #3
0
        public virtual Apps.Models.SCV.ITEM.ITEM_BEIYONG_MODEL GetById(string id)
        {
            Apps.Models.ITEM_BEIYONG entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //ITEM_BEIYONG entity = m_Rep.GetById(id);
                Apps.Models.SCV.ITEM.ITEM_BEIYONG_MODEL model = new Apps.Models.SCV.ITEM.ITEM_BEIYONG_MODEL();
                model.ID     = entity.ID;
                model.huowei = entity.huowei;
                model.item   = entity.item;
                model.data   = entity.data;
                model.datab  = entity.datab;
                model.ndata  = entity.ndata;
                model.ndatab = entity.ndatab;

                return(model);
            }
            else
            {
                return(null);
            }
        }