CshtmlTemplateCode.cs
1.19 KB
using Hh.Mes.POJO.WebEntity.tool;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Hh.Mes.T4
{
public partial class CshtmlTemplate
{
private readonly string AreaName;
private readonly string ControllerName;
private readonly List<TableColumnInfo> EditColumns;
private readonly List<TableColumnInfo> QueryColumns;
private readonly string TitleName;
private readonly bool IsDetail;
public CshtmlTemplate(string areaName, string tableName, List<TableColumnInfo> tableColumns, string tableDescription, int filter = 3)
{
AreaName = areaName;
var str = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(tableName);
ControllerName = string.Join("", str.Split("_"));
TitleName = string.IsNullOrWhiteSpace(tableDescription) ? tableName : tableDescription;
EditColumns = tableColumns;
QueryColumns = EditColumns.Where(x => x.TypeName.Equals("string", StringComparison.OrdinalIgnoreCase)).Take(filter).ToList();
IsDetail = tableName.EndsWith("detail", System.StringComparison.OrdinalIgnoreCase);
}
}
}