Exemplo n.º 1
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.Sys.SysRightModel model, params string[] updateProperties)
        {
            SysRight entity = m_Rep.GetById(model.Id);

            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.Id        = model.Id;
                entity.ModuleId  = model.ModuleId;
                entity.RoleId    = model.RoleId;
                entity.Rightflag = model.Rightflag;
            }
            else
            {
                Type type  = typeof(Apps.Models.Sys.SysRightModel);
                Type typeE = typeof(Apps.Models.SysRight);
                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);
        }
Exemplo n.º 2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.Sys.SysRightModel model)
        {
            SysRight entity = m_Rep.GetById(model.Id);

            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity           = new SysRight();
            entity.Id        = model.Id;
            entity.ModuleId  = model.ModuleId;
            entity.RoleId    = model.RoleId;
            entity.Rightflag = model.Rightflag;

            m_Rep.Create(entity);
        }
Exemplo n.º 3
0
        public virtual Apps.Models.Sys.SysRightModel GetById(string id)
        {
            SysRight entity = m_Rep.GetById(id);

            if (entity != null)
            {
                //SysRight entity = m_Rep.GetById(id);
                Apps.Models.Sys.SysRightModel model = new Apps.Models.Sys.SysRightModel();
                model.Id        = entity.Id;
                model.ModuleId  = entity.ModuleId;
                model.RoleId    = entity.RoleId;
                model.Rightflag = entity.Rightflag;

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