Exemple #1
0
        public Task GetViewSetting([FromForm] int viewId)
        {
            //#1 获取视图对象
            ViewSetting setting = ViewAgent.Instance().GetViewSetting(viewId);
            IViewBase   view    = ViewUtils.CreateInstance(setting.Code, string.Empty);

            return(this.GetResult(view.ToJsonString()));
        }
Exemple #2
0
        public Task GetSiteConfig([FromForm] int id)
        {
            ViewSiteConfig config  = ViewAgent.Instance().GetSiteViewConfig(id);
            ViewSetting    setting = ViewAgent.Instance().GetViewSetting(config.ViewID);
            IViewBase      view    = ViewUtils.CreateInstance(setting.Code, config.Setting);

            return(this.GetResult(view.ToSettingObject()));
        }
Exemple #3
0
        public override void OnActivate()
        {
            base.OnActivate();

            if (m_mapCtrl != null && ViewAgent.HasPrior(m_mapCtrl.ActiveView))
            {
                ViewAgent.Prior(m_mapCtrl.ActiveView);
            }
        }
Exemple #4
0
        public Task SaveModelInfo()
        {
            ViewModel model = this.context.Request.Form.Fill <ViewModel>();

            return(this.GetResult(ViewAgent.Instance().SaveModelInfo(model), "保存成功", new
            {
                model.ID
            }));
        }
Exemple #5
0
        public override void OnActivate()
        {
            base.OnActivate();

            if (m_mapCtrl != null)
            {
                ViewAgent.ZoomAll(m_mapCtrl.ActiveView);
            }
        }
Exemple #6
0
 public Task TemplateList([FromForm] PlatformSource platform)
 {
     return(this.GetResult(this.ShowResult(ViewAgent.Instance().GetTemplateList(platform), t => new
     {
         t.ID,
         t.Name,
         t.Platform,
         t.Preview
     })));
 }
Exemple #7
0
 public Task SiteTemplateList([FromForm] int siteid)
 {
     return(this.GetResult(this.ShowResult(ViewAgent.Instance().GetSiteTemplateList(siteid), t => new
     {
         t.ID,
         t.Name,
         t.Platform,
         t.SiteID,
         t.Domain
     })));
 }
Exemple #8
0
        public Task SaveTemplateInfo([FromForm] int id, [FromForm] string name, [FromForm] PlatformSource platform, [FromForm] string cover, [FromForm] string model)
        {
            ViewTemplate template = new ViewTemplate()
            {
                ID       = id,
                Name     = name,
                Platform = platform,
                Preview  = cover
            };

            return(this.GetResult(ViewAgent.Instance().SaveTemplateInfo(template, WebAgent.GetArray <int>(model))));
        }
Exemple #9
0
        public Task SaveSiteTemplateInfo([FromForm] int id, [FromForm] string name, [FromForm] PlatformSource platform, [FromForm] string domain, [FromForm] int siteid, [FromForm] string model)
        {
            ViewSiteTemplate template = new ViewSiteTemplate()
            {
                ID       = id,
                Name     = name,
                Platform = platform,
                Domain   = domain,
                SiteID   = siteid
            };

            return(this.GetResult(ViewAgent.Instance().SaveSiteTemplateInfo(template, WebAgent.GetArray <int>(model))));
        }
        public async Task <ActionResult> ViewAgent()
        {
            var userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext()));
            var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(new ApplicationDbContext()));

            var role = await roleManager.FindByNameAsync("Agent");

            var roleUsers = userManager.Users.Where(u => u.Roles.Any(r => r.RoleId == role.Id));

            var viewModel = new ViewAgent
            {
                ViewAgents = roleUsers.ToList()
            };

            return(View(viewModel));
        }
Exemple #11
0
        public Task GetTemplateInfo([FromForm] int id)
        {
            ViewTemplate template = ViewAgent.Instance().GetTemplateInfo(id) ?? new ViewTemplate()
            {
                Configs = new List <ViewTemplateConfig>()
            };

            return(this.GetResult(new
            {
                template.ID,
                template.Platform,
                template.Name,
                template.Preview,
                Models = template.Configs.Select(t => t.ModelID)
            }));
        }
Exemple #12
0
        public Task GetModelInfo([FromForm] int?id, [FromForm] int?viewId)
        {
            ViewModel model = ViewAgent.Instance().GetModelInfo(id == null ? 0 : id.Value) ?? new ViewModel()
            {
                ViewID = viewId ?? 0
            };
            List <ViewContent> contents = BDC.ViewContent.Where(t => t.ModelID == model.ID).ToList();

            return(this.GetResult(new
            {
                model.ID,
                model.Name,
                model.Path,
                model.Preview,
                model.ViewID,
                model.Description,
                Resources = model.ResourceFiles,
                Content = contents
            }));
        }
Exemple #13
0
        public Task SaveModelFile([FromForm] int id, [FromForm] IFormFile file, [FromForm] long modified)
        {
            string name = file.FileName;
            string ext  = name.Substring(name.LastIndexOf('.') + 1);
            bool   success;

            switch (ext)
            {
            case "html":
                success = ViewAgent.Instance().SaveModelPage(id, Encoding.UTF8.GetString(file.ToArray()));
                break;

            case "css":
                success = ViewAgent.Instance().SaveModelStyle(id, Encoding.UTF8.GetString(file.ToArray()));
                break;

            default:
                success = ViewAgent.Instance().SaveModelResource(id, file);
                break;
            }
            return(this.GetResult(success));
        }
Exemple #14
0
 /// <summary>
 /// 全局的一次性执行
 /// </summary>
 static SysFilterAttribute()
 {
     // 视图的数据初始化
     ViewAgent.Instance().Initialize();
 }
Exemple #15
0
 public Task SaveSiteConfig([FromForm] int id, [FromForm] string setting)
 {
     return(this.GetResult(ViewAgent.Instance().SaveSiteViewConfig(id, setting)));
 }
Exemple #16
0
 public Task DeleteModel([FromForm] int id)
 {
     return(this.GetResult(ViewAgent.Instance().DeleteModel(id)));
 }
Exemple #17
0
        public Task Initialize()
        {
            int count = ViewAgent.Instance().Initialize();

            return(this.GetResult(true, $"找到{count}个视图配置"));
        }
Exemple #18
0
 public Task SiteTemplateDelete([FromForm] int id)
 {
     return(this.GetResult(ViewAgent.Instance().DeleteSiteTemplate(id)));
 }
Exemple #19
0
 public Task DeleteModelResource([FromForm] int modelId, [FromForm] string name)
 {
     return(this.GetResult(ViewAgent.Instance().DeleteModelResource(modelId, name)));
 }