using Mall.Model.Entity.TradePavilion;
using System;
using System.Collections.Generic;
using System.Text;

namespace Mall.Model.Extend.TradePavilion
{
    /// <summary>
    /// 商会活动表扩展实体类
    /// </summary>
    public class RB_Commerce_Activity_Extend : RB_Commerce_Activity
    {
        /// <summary>
        /// 活动名称
        /// </summary>
        public string ActivityTypeName { get; set; }

        /// <summary>
        /// 开始时间字符串
        /// </summary>
        public string StartTimeStr { get { return Common.ConvertHelper.FormatDate(this.StartTime); } }


        /// <summary>
        /// 结束时间字符串
        /// </summary>
        public string EndTimeStr { get { return Common.ConvertHelper.FormatDate(this.EndTime); } }


        /// <summary>
        /// 商会活动详情列表
        /// </summary>
        public List<RB_Commerce_Details_Extend> CommerceDetailsList { get; set; }

        /// <summary>
        /// 报名列表
        /// </summary>
        public List<RB_Commerce_Consult_Extend> CommerceConsultList { get; set; }

        /// <summary>
        /// 活动状态
        /// </summary>
        public int ActivityStatus
        {
            get
            {
                int status = 0;//未开始
                DateTime currentDay = Convert.ToDateTime(Common.ConvertHelper.FormatDate(DateTime.Now));
                if (currentDay >= this.StartTime && currentDay <= this.EndTime)
                {
                    status = 1;//进行中
                }
                else if (currentDay > this.EndTime)
                {
                    status = 2;//已结束
                }
                return status;
            }
        }

        /// <summary>
        /// 是否可报名
        /// </summary>
        public int IsSignUp
        {
            get
            {
                int isSign = 0;
                if (this.SignStartTime != null && this.SignEndTime != null)
                {
                    DateTime currentDay = Convert.ToDateTime(Common.ConvertHelper.FormatDate(DateTime.Now));
                    if (currentDay >= this.SignStartTime && currentDay <= this.SignEndTime)
                    {
                        isSign = 1;//可报名
                    }
                }
                return isSign;
            }
        }

        /// <summary>
        /// 报名开始时间
        /// </summary>
        public string SignStartTimeStr { get { return  Common.ConvertHelper.FormatTime(this.SignStartTime); } }

        /// <summary>
        /// 报名截止时间
        /// </summary>
        public string SignEndTimeStr { get { return  Common.ConvertHelper.FormatTime(this.SignEndTime); } }

        /// <summary>
        /// 活动状态字符串
        /// </summary>
        public string ActivityStatusStr
        {
            get
            {
                string str = "未开始";
                switch (this.ActivityStatus)
                {
                    case 0:
                        str = "未开始";
                        break;
                    case 1:
                        str = "进行中";
                        break;
                    case 2:
                        str = "已结束";
                        break;
                }
                return str;
            }
        }

        /// <summary>
        /// 报名人数
        /// </summary>
        public int JoinNum { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateByName { get; set; }

        /// <summary>
        /// 是否报名(0-未报名，1-已报名)
        /// </summary>
        public int IsJoinActivity { get; set; }
    }
}
