#region
|
|
using System;
|
|
#endregion
|
|
namespace CSFrameworkV5.Interfaces.InterfaceModels
|
{
|
/// <summary>
|
/// 字段定义实体类
|
/// </summary>
|
[Serializable]
|
public class FieldNameDef
|
{
|
public FieldNameDef()
|
{
|
FieldName = "";
|
Caption = "";
|
}
|
|
/// <summary>
|
/// 构造器
|
/// </summary>
|
/// <param name="fieldName"></param>
|
/// <param name="caption"></param>
|
/// <param name="isStringType">对应SQL脚本,字符匹配类型</param>
|
public FieldNameDef(string fieldName, string caption, string fieldType)
|
{
|
FieldName = fieldName;
|
Caption = caption;
|
FieldType = fieldType;
|
}
|
|
/// <summary>
|
/// 预设字段标题
|
/// </summary>
|
public string Caption { get; set; }
|
|
/// <summary>
|
/// DB物理字段名
|
/// </summary>
|
public string FieldName { get; set; }
|
|
public string FieldType { get; set; }
|
|
/// <summary>
|
/// 排序,1升序,2降序,对应ImageIndex的图片序号
|
/// </summary>
|
public int OrderBy { get; set; }
|
|
public FieldNameDef Copy()
|
{
|
var o = new FieldNameDef();
|
o.Caption = Caption;
|
o.FieldName = FieldName;
|
o.FieldType = FieldType;
|
o.OrderBy = OrderBy;
|
return o;
|
}
|
|
/// <summary>
|
/// 拼接SQL需要加单引号的字段类型,如:varchar,datetime等
|
/// </summary>
|
/// <returns></returns>
|
public bool IsStringType()
|
{
|
if (string.IsNullOrEmpty(FieldType)) return true;
|
|
var stringTypes =
|
",VarChar,Char,Date,DateTime,DateTime2,NChar,NText,NVarchar,SmallDateTime,Text,Time,Timestamp,UniqueIdentifier,Xml,";
|
return stringTypes.ToLower()
|
.IndexOf("," + FieldType.ToLower() + ",") >= 0;
|
}
|
}
|
}
|