添加项目文件。
This commit is contained in:
58
HT.Cloud.Code/Form/FormUtil.cs
Normal file
58
HT.Cloud.Code/Form/FormUtil.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace HT.Cloud.Code
|
||||
{
|
||||
public class FormUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取值
|
||||
/// </summary>
|
||||
/// <param name="form">The form.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static List<string> SetValue(string content)
|
||||
{
|
||||
List<FormValue> list = JsonHelper.ToObject<List<FormValue>>(content);
|
||||
List<string> temp = new List<string>();
|
||||
SetFormValue(list, temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
private static List<string> SetFormValue(List<FormValue> list, List<string> temp)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (item.tag == "grid")
|
||||
{
|
||||
foreach (var column in item.columns)
|
||||
{
|
||||
SetFormValue(column.list, temp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.Add(item.id);
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
public static List<string> SetValueByWeb(string webForm)
|
||||
{
|
||||
var path = AppDomain.CurrentDomain.RelativeSearchPath ?? AppDomain.CurrentDomain.BaseDirectory;
|
||||
var referencedAssemblies = Directory.GetFiles(path, "*.dll").Select(Assembly.LoadFrom).ToArray();
|
||||
var t = referencedAssemblies
|
||||
.SelectMany(a => a.GetTypes().Where(t => t.FullName.Contains("HT.Cloud.Domain.") && t.FullName.Contains("." + webForm + "Entity"))).First();
|
||||
List<string> temp = new List<string>();
|
||||
PropertyInfo[] pArray = t.GetProperties();
|
||||
Array.ForEach<PropertyInfo>(pArray, p =>
|
||||
{
|
||||
temp.Add(p.Name);
|
||||
});
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
}
|
24
HT.Cloud.Code/Form/FormValue.cs
Normal file
24
HT.Cloud.Code/Form/FormValue.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HT.Cloud.Code
|
||||
{
|
||||
/// <summary>
|
||||
/// 表单设计类
|
||||
/// </summary>
|
||||
public class FormValue
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string label { get; set; }
|
||||
public int index { get; set; }
|
||||
public string tag { get; set; }
|
||||
public int span { get; set; }
|
||||
public List<FormEx> columns { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class FormEx
|
||||
{
|
||||
public int span { get; set; }
|
||||
public List<FormValue> list { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user