using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace FineUIPro.Web.common
{
    public partial class mainMenu_Party : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OrganizingLifePic();
                ThemePartyDayPic();
            }
        }
        /// 
        /// 
        /// 
        public string swiperHtml1;
        public string swiperHtml2;
        #region 组织生活会
        /// 
        /// 组织生活会图片显示
        /// 
        public void OrganizingLifePic()
        {
            swiperHtml1 = " ";
            var getP = from x in Funs.DB.Party_OrganizingLife
                       join y in Funs.DB.AttachFile on x.OrganizingLifeId equals y.ToKeyId
                       where y.AttachFileId != null && y.AttachUrl != null
                       orderby x.OrganizingLifeDate descending
                       select new { x.OrganizingLifeId, x.Theme, x.Year, y.AttachUrl };
            var getList = getP.OrderByDescending(x => x.Year).Take(5).ToList();
            if (getList.Count() > 0)
            {
                foreach (var item in getList)
                {
                    var geturl = Funs.GetStrListByStr(item.AttachUrl, ',');
                    foreach (var itemurl in geturl)
                    {
                        if (!string.IsNullOrEmpty(itemurl))
                        {
                            swiperHtml1 += @"
     
                            " + item.Theme + @"
                            ![]() 
                            
                             ";
                        }
                    }
                }
            }
            else
            {
                swiperHtml1 += @"";
            }
        }
        #endregion
        #region 主题党日活动
        /// 
        /// 主题党日活动图片显示
        /// 
        public void ThemePartyDayPic()
        {
            swiperHtml2 = " ";
            var getP = from x in Funs.DB.Party_ThemePartyDay
                       join y in Funs.DB.AttachFile on x.ThemePartyDayId equals y.ToKeyId
                       where y.AttachFileId != null && y.AttachUrl != null
                       orderby x.ConveneDate descending
                       select new { x.ThemePartyDayId, x.Theme, x.Year, y.AttachUrl };
            var getList = getP.OrderByDescending(x => x.Year).Take(5).ToList();
            if (getList.Count() > 0)
            {
                foreach (var item in getList)
                {
                    var geturl = Funs.GetStrListByStr(item.AttachUrl, ',');
                    foreach (var itemurl in geturl)
                    {
                        if (!string.IsNullOrEmpty(itemurl))
                        {
                            swiperHtml2 += @"       
                            " + item.Theme + @"
                            ![]() 
                            
                             ";
                        }
                    }
                }
            }
            else
            {
                swiperHtml2 += @"";
            }
        }
        #endregion
        protected string swiper3
        {
            get
            {
                var getPartyPioneerDemonstration = (from x in Funs.DB.Party_PartyPioneerDemonstration
                                                    orderby x.CompileDate descending
                                                    select x).Distinct().Take(20);
                string strNoticeHtml = string.Empty;
                foreach (var item in getPartyPioneerDemonstration)
                {
                    string url = "../Party/PartyPioneerDemonstrationEdit.aspx?type=see&partyPioneerDemonstrationId=" + item.PartyPioneerDemonstrationId;
                    string name = BLL.PartyerService.GetNameByPartyId(item.PartyerId);
                    strNoticeHtml += "" + name + "
" + string.Format("{0:yyyy-MM-dd}", item.CompileDate) + "
" + name + "
" + string.Format("{0:yyyy-MM-dd}", item.StudyDate) + "