#region using System; #endregion namespace CSFrameworkV5.Interfaces.InterfaceModels { /// /// 字段定义实体类 /// [Serializable] public class FieldNameDef { public FieldNameDef() { FieldName = ""; Caption = ""; } /// /// 构造器 /// /// /// /// 对应SQL脚本,字符匹配类型 public FieldNameDef(string fieldName, string caption, string fieldType) { FieldName = fieldName; Caption = caption; FieldType = fieldType; } /// /// 预设字段标题 /// public string Caption { get; set; } /// /// DB物理字段名 /// public string FieldName { get; set; } public string FieldType { get; set; } /// /// 排序,1升序,2降序,对应ImageIndex的图片序号 /// 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; } /// /// 拼接SQL需要加单引号的字段类型,如:varchar,datetime等 /// /// 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; } } }