示例#1
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.AREAS_MODEL model, params string[] updateProperties)
        {
            Apps.Models.AREAS entity = m_Rep.GetById(model.INTERNAL_NUM);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.INTERNAL_NUM = model.INTERNAL_NUM;
                entity.ID           = model.ID;
                entity.PARENT_ID    = model.PARENT_ID;
                entity.TYPE         = model.TYPE;
                entity.ZIP          = model.ZIP;
                entity.NAME         = model.NAME;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.Sys.AREAS_MODEL);
                Type typeE = typeof(Apps.Models.AREAS);
                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.Sys.AREAS_MODEL model)
        {
            Apps.Models.AREAS entity = m_Rep.GetById(model.INTERNAL_NUM);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.AREAS();
            entity.INTERNAL_NUM = model.INTERNAL_NUM;
            entity.ID           = model.ID;
            entity.PARENT_ID    = model.PARENT_ID;
            entity.TYPE         = model.TYPE;
            entity.ZIP          = model.ZIP;
            entity.NAME         = model.NAME;

            m_Rep.Create(entity);
        }
示例#3
0
        public virtual Apps.Models.SCV.Sys.AREAS_MODEL GetById(string id)
        {
            Apps.Models.AREAS entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //AREAS entity = m_Rep.GetById(id);
                Apps.Models.SCV.Sys.AREAS_MODEL model = new Apps.Models.SCV.Sys.AREAS_MODEL();
                model.INTERNAL_NUM = entity.INTERNAL_NUM;
                model.ID           = entity.ID;
                model.PARENT_ID    = entity.PARENT_ID;
                model.TYPE         = entity.TYPE;
                model.ZIP          = entity.ZIP;
                model.NAME         = entity.NAME;

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