📄 modeltemplate.cs
字号:
namespace PowerEasy.CommonModel
{
using PowerEasy.Common;
using PowerEasy.Enumerations;
using PowerEasy.IDal.CommonModel;
using PowerEasy.Model.CommonModel;
using System;
using System.Collections.Generic;
public sealed class ModelTemplate
{
private static readonly IModelTemplate dal = DataAccess.CreateCotentModelTemplate();
private static Serialize<FieldInfo> ser = new Serialize<FieldInfo>();
private ModelTemplate()
{
}
public static DataActionState Add(ModelTemplatesInfo modelTemplatesInfo)
{
DataActionState unknown = DataActionState.Unknown;
EncodeModelInfo(modelTemplatesInfo);
if (dal.Add(modelTemplatesInfo))
{
unknown = DataActionState.Successed;
}
return unknown;
}
public static bool Delete(string id)
{
return (DataValidator.IsValidId(id) && dal.Delete(id));
}
private static void EncodeModelInfo(ModelTemplatesInfo modelTemplatesInfo)
{
modelTemplatesInfo.TemplateName = DataSecurity.HtmlEncode(modelTemplatesInfo.TemplateName);
modelTemplatesInfo.TemplateDescription = DataSecurity.HtmlEncode(modelTemplatesInfo.TemplateDescription);
}
public static bool ExportData(string templateId, string importPath, bool chkFormatConn)
{
return (DataValidator.IsValidId(templateId) && dal.ExportData(templateId, importPath.Replace("'", ""), chkFormatConn));
}
public static int GetCountNumber(int startRowIndexId, int maxNumberRows)
{
return dal.GetCountNumber();
}
public static int GetCountNumber(int startRowIndexId, int maxNumberRows, ModelType type)
{
return dal.GetCountNumber();
}
public static string GetField(int id)
{
return dal.GetField(id);
}
public static IList<FieldInfo> GetFieldListByTemplateId(int templateId)
{
string field = GetField(templateId);
return ser.DeserializeFieldList(field);
}
public static IList<ModelTemplatesInfo> GetImportList(string importPath)
{
return dal.GetImportList(importPath.Replace("'", ""));
}
public static IList<ModelTemplatesInfo> GetImportList(string importPath, ModelType type)
{
return dal.GetImportList(importPath.Replace("'", ""), type);
}
public static ModelTemplatesInfo GetInfoById(int id)
{
return dal.GetInfoById(id);
}
public static IList<ModelTemplatesInfo> GetModelTemplateInfoList(int startRowIndexId, int maxNumberRows)
{
return dal.GetModelTemplateInfoList(startRowIndexId, maxNumberRows);
}
public static IList<ModelTemplatesInfo> GetModelTemplateInfoList(int startRowIndexId, int maxNumberRows, ModelType type)
{
return dal.GetModelTemplateInfoList(startRowIndexId, maxNumberRows, type);
}
public static bool ImportData(string templateId, string importPath)
{
return (DataValidator.IsValidId(templateId) && dal.ImportData(templateId, importPath.Replace("'", "")));
}
public static DataActionState Update(ModelTemplatesInfo modelTemplatesInfo)
{
DataActionState unknown = DataActionState.Unknown;
EncodeModelInfo(modelTemplatesInfo);
if (dal.Update(modelTemplatesInfo))
{
unknown = DataActionState.Successed;
}
return unknown;
}
public static bool UpdateField(int id, string fieldList)
{
return dal.UpdateField(id, fieldList);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -