Esempio n. 1
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.Spm.Spm_TracesInfoModel model, params string[] updateProperties)
        {
            Spm_TracesInfo entity = m_Rep.GetById(model.Id);

            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.Id            = model.Id;
                entity.ExInfoId      = model.ExInfoId;
                entity.AcceptStation = model.AcceptStation;
                entity.AcceptTime    = model.AcceptTime;
            }
            else
            {
                Type type  = typeof(Apps.Models.Spm.Spm_TracesInfoModel);
                Type typeE = typeof(Apps.Models.Spm_TracesInfo);
                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);
        }
Esempio n. 2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.Spm.Spm_TracesInfoModel model)
        {
            Spm_TracesInfo entity = m_Rep.GetById(model.Id);

            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity               = new Spm_TracesInfo();
            entity.Id            = model.Id;
            entity.ExInfoId      = model.ExInfoId;
            entity.AcceptStation = model.AcceptStation;
            entity.AcceptTime    = model.AcceptTime;

            m_Rep.Create(entity);
        }
Esempio n. 3
0
        public virtual Apps.Models.Spm.Spm_TracesInfoModel GetById(string id)
        {
            Spm_TracesInfo entity = m_Rep.GetById(id);

            if (entity != null)
            {
                //Spm_TracesInfo entity = m_Rep.GetById(id);
                Apps.Models.Spm.Spm_TracesInfoModel model = new Apps.Models.Spm.Spm_TracesInfoModel();
                model.Id            = entity.Id;
                model.ExInfoId      = entity.ExInfoId;
                model.AcceptStation = entity.AcceptStation;
                model.AcceptTime    = entity.AcceptTime;

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