Esempio n. 1
0
        public virtual Apps.Models.Sys.SysModuleModel GetById(string id)
        {
            SysModule entity = m_Rep.GetById(id);

            if (entity != null)
            {
                //SysModule entity = m_Rep.GetById(id);
                Apps.Models.Sys.SysModuleModel model = new Apps.Models.Sys.SysModuleModel();
                model.Id             = entity.Id;
                model.Name           = entity.Name;
                model.EnglishName    = entity.EnglishName;
                model.ParentId       = entity.ParentId;
                model.AreasName      = entity.AreasName;
                model.ControllerName = entity.ControllerName;
                model.ActionName     = entity.ActionName;
                model.FormMethod     = entity.FormMethod;
                model.OperationType  = entity.OperationType;
                model.Iconic         = entity.Iconic;
                model.Sort           = entity.Sort;
                model.Remark         = entity.Remark;
                model.Enable         = entity.Enable;
                model.CreatePerson   = entity.CreatePerson;
                model.CreateTime     = entity.CreateTime;
                model.IsLast         = entity.IsLast;
                model.Version        = entity.Version;

                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.Sys.SysModuleModel model)
        {
            SysModule entity = m_Rep.GetById(model.Id);

            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity                = new SysModule();
            entity.Id             = model.Id;
            entity.Name           = model.Name;
            entity.EnglishName    = model.EnglishName;
            entity.ParentId       = model.ParentId;
            entity.AreasName      = model.AreasName;
            entity.ControllerName = model.ControllerName;
            entity.ActionName     = model.ActionName;
            entity.FormMethod     = model.FormMethod;
            entity.OperationType  = model.OperationType;
            entity.Iconic         = model.Iconic;
            entity.Sort           = model.Sort;
            entity.Remark         = model.Remark;
            entity.Enable         = model.Enable;
            entity.CreatePerson   = model.CreatePerson;
            entity.CreateTime     = model.CreateTime;
            entity.IsLast         = model.IsLast;
            entity.Version        = model.Version;

            m_Rep.Create(entity);
        }
Esempio n. 3
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.Sys.SysModuleModel model, params string[] updateProperties)
        {
            SysModule entity = m_Rep.GetById(model.Id);

            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.Id             = model.Id;
                entity.Name           = model.Name;
                entity.EnglishName    = model.EnglishName;
                entity.ParentId       = model.ParentId;
                entity.AreasName      = model.AreasName;
                entity.ControllerName = model.ControllerName;
                entity.ActionName     = model.ActionName;
                entity.FormMethod     = model.FormMethod;
                entity.OperationType  = model.OperationType;
                entity.Iconic         = model.Iconic;
                entity.Sort           = model.Sort;
                entity.Remark         = model.Remark;
                entity.Enable         = model.Enable;
                entity.CreatePerson   = model.CreatePerson;
                entity.CreateTime     = model.CreateTime;
                entity.IsLast         = model.IsLast;
                entity.Version        = model.Version;
            }
            else
            {
                Type type  = typeof(Apps.Models.Sys.SysModuleModel);
                Type typeE = typeof(Apps.Models.SysModule);
                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);
        }