using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace JuSNS.Web.home.Movie
{
    public partial class top : JuSNS.UI.Page.UserPage
    {
        private double MaxCnt = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind();
            LoadList();
            getSort();
        }

        /// <summary>
        /// 加载分页
        /// </summary>
        /// <param name="PageIndex">当前页数</param>
        protected void LoadList()
        {
            JuSNS.Home.Movie movie = new JuSNS.Home.Movie();
            DataTable dt = movie.getTopFriendMovie(UserID);
            if (dt != null && dt.Rows.Count > 0)
            {
                MaxCnt = Convert.ToDouble(dt.Rows[0]["cnt"].ToString());
                Rpt_TopFriend.DataSource = dt;
                Rpt_TopFriend.DataBind();
            }
        }

        /// <summary>
        /// 取得自已的样式
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        protected string getCss(object uid)
        {
            string s_Css = "";
            if (Convert.ToInt32(uid) == UserID)
                s_Css = "class=\"current\"";
            return s_Css;
        }

        /// <summary>
        /// 取得宽度
        /// </summary>
        /// <param name="Cnt"></param>
        /// <returns></returns>
        protected string getWidth(object Cnt)
        {
            Double Width = 0;
            if (MaxCnt != 0)
                Width = (Convert.ToDouble(Cnt) / MaxCnt) * 250;
            return Width.ToString();
        }

        /// <summary>
        /// 取得分类列表
        /// </summary>
        protected void getSort()
        {
            string s_temp = "";
            JuSNS.Home.Movie movie = new JuSNS.Home.Movie();
            DataTable sortdt = movie.getDictMovieSortList();
            for (int i = 0; i < sortdt.Rows.Count; i++)
            {
                s_temp += " <a href=\"../movie/?s=" + sortdt.Rows[i]["ID"].ToString() + "&r=all\">" + sortdt.Rows[i]["SortName"].ToString() + "</a> |";
            }
            Lit_SortName.Text = s_temp.TrimEnd('|');
        }
    }
}
