-
Notifications
You must be signed in to change notification settings - Fork 9
/
DragNDropColumnsViewComponent.cs
58 lines (51 loc) · 1.96 KB
/
DragNDropColumnsViewComponent.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using ExpressBase.Common;
using ExpressBase.Data;
using ExpressBase.Objects.ServiceStack_Artifacts;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using ServiceStack;
using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ExpressBase.Web.Components
{
public class DragNDropColumnsViewComponent:ViewComponent
{
protected IServiceClient ServiceClient { get; set; }
protected RedisClient Redis { get; set; }
public DragNDropColumnsViewComponent(IServiceClient _client, IRedisClient _redis)
{
this.ServiceClient = _client as JsonServiceClient;
this.Redis = _redis as RedisClient;
}
public async Task<IViewComponentResult> InvokeAsync(string dsRefid)
{
//DataSourceColumnsResponse columnresp = this.Redis.Get<DataSourceColumnsResponse>(string.Format("{0}_columns", dsRefid));
//if (columnresp == null || columnresp.IsNull)
// columnresp = this.ServiceClient.Get<DataSourceColumnsResponse>(new DataSourceColumnsRequest { RefId = dsRefid, TenantAccountId = ViewBag.cid });
//ViewBag.data = GetTreeData(columnresp.Columns);
return View();
}
private string GetTreeData(ColumnColletion columns)
{
List<string> CNodes = new List<string>();
//Dictionary<string, List<string>> tree = new Dictionary<string, List<string>>();
TreeData td = new TreeData();
td.text = "sxxxx";
foreach(EbDataColumn column in columns)
{
td.nodes.Add(column.ColumnName);
}
//tree.Add("xxxx", CNodes);
var xx = JsonConvert.SerializeObject(td);
return xx;
}
}
public class TreeData
{
public string text;
public List<string> nodes;
}
}