using CZFW.Core;
using CZFW.Framework.Attributes;
using CZFW.Framework.Model.Entity;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CZKJ.GBRS2.Entity
{
///
/// 公开信息
///
[Table("cz_gbrs2_publicinfo")]
public class PublicInfoEntity : EntityBase,ISeo,IShare
{
///
/// 标题
///
[Display(Name = "标题")]
[StringLength(1024)]
[Required(ErrorMessage = "不能为空")]
public string Title { get; set; }
///
/// 类型
///
[Display(Name = "类型")]
[Invisible(AddVisible = true, FormVisible = true)]
[DropdownSrc(SrcUrl = "/Manage/PublicType/GetChildList?parentId=")]
[Required]
public int TypeId { get; set; }
///
/// 图片
///
[Display(Name = "图片")]
[StringLength(512)]
[DataType(DataType.ImageUrl)]
public string Image { get; set; }
///
/// 简介
///
[Display(Name = "简介")]
[StringLength(1024)]
[DataType(DataType.MultilineText)]
public string Summary { get; set; }
///
/// 详情
///
[Display(Name = "详情")]
[DataType(DataType.Html)]
public string Detail { get; set; }
///
/// 文件名称
///
[Display(Name = "文件名称")]
[StringLength(128)]
public string FileName { get; set; }
///
/// 文件路径
///
[Display(Name = "文件Url")]
[StringLength(1024)]
[Invisible]
public string FileUrl { get; set; }
///
/// 发布时间
///
[Display(Name = "发布时间")]
[DataType(DataType.DateTime)]
public DateTime PublishTime { get; set; }
///
///类型
///
[NotMapped]
[Display(Name = "类型")]
[Invisible(TableVisible = true, ViewVisible = true)]
public string TypeName { get; set; }
#region SEO及分享
[NotMapped]
private string seotitle;
[NotMapped]
private string seodescription;
[NotMapped]
private string seokeywords;
[NotMapped]
private string sharetitle;
[NotMapped]
private string sharedescription;
[NotMapped]
private string shareurl;
[NotMapped]
private string shareimage;
[StringLength(128)]
[Display(Name = "SEO标题")]
[Invisible(FormVisible = true, AddVisible = true)]
public string SeoTitle
{
get { return string.IsNullOrEmpty(seotitle) ? Title : seotitle; }
set { seotitle = value; }
}
///
/// SEO描述
///
[StringLength(512)]
[Display(Name = @"SEO描述")]
[DataType(DataType.MultilineText)]
[Invisible(FormVisible = true, AddVisible = true)]
public string SeoDescription
{
get { return string.IsNullOrEmpty(seodescription) ? Summary : seodescription; }
set { seodescription = value; }
}
///
/// SEO关键词
///
[StringLength(128)]
[Display(Name = @"SEO关键词")]
[Invisible(FormVisible = true, AddVisible = true)]
public string SeoKeywords
{
get { return string.IsNullOrEmpty(seokeywords) ? Title : seokeywords; }
set { seokeywords = value; }
}
///
/// 分享图片
///
[StringLength(512)]
[Display(Name = @"分享图片")]
[DataType(DataType.ImageUrl)]
[Invisible(FormVisible = true, AddVisible = true)]
public string ShareImage
{
get { return string.IsNullOrEmpty(shareimage) ? Image : shareimage; }
set { shareimage = value; }
}
///
/// 分享标题
///
[StringLength(128)]
[Display(Name = @"分享标题")]
[Invisible(FormVisible = true, AddVisible = true)]
public string ShareTitle
{
get { return string.IsNullOrEmpty(sharetitle) ? Title : sharetitle; }
set { sharetitle = value; }
}
///
/// 分享URL
///
[StringLength(512)]
[Display(Name = @"分享URL")]
[Invisible(FormVisible = true, AddVisible = true)]
public string ShareUrl
{
get { return string.IsNullOrEmpty(shareurl) ? ConfigHelper.GetValue("SystemInfo:Website") : shareurl; }
set { shareurl = value; }
}
///
/// 分享描述
///
[StringLength(512)]
[Display(Name = @"分享描述")]
[Invisible(FormVisible = true, AddVisible = true)]
public string ShareDescription
{
get { return string.IsNullOrEmpty(sharedescription) ? Summary : sharedescription; }
set { sharedescription = value; }
}
#endregion
}
}