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;
using JuSNS.Model;
using JuSNS.UI.Control;
using JuSNS.Common;

namespace JuSNS.Web.home.Group
{
    public partial class index : JuSNS.UI.Page.UserPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind();
            LoadList();
        }


        /// <summary>
        /// 加载分页
        /// </summary>
        /// <param name="PageIndex">当前页数</param>
        protected void LoadList()
        {
            int r, p, PageIndex = 0;
            PageIndex = Convert.ToInt32(Request.QueryString["Page"]);
            SqlConditionInfo st = new SqlConditionInfo("@UserID", UserID, TypeCode.Int32);

            DataTable dt = JuSNS.Home.UtilPage.GetPage("DyanGroup_aspx", PageIndex, 20, out r, out p, st);
            if (dt != null)
            {
                Rpt_DyanGroup.DataSource = dt;
                Rpt_DyanGroup.DataBind();
                dt.Clear();
                dt.Dispose();
            }
        }

        /// <summary>
        /// 取得会员姓名
        /// </summary>
        /// <param name="UserID">会员编号</param>
        /// <returns></returns>
        protected string getUserName(object UserID)
        {
            string s_Name = "&nbsp;";
            if (UserID != DBNull.Value)
            {
                JuSNS.Home.User user = new JuSNS.Home.User();
                UserInfo userinfo = new UserInfo();
                userinfo = user.GetUserInfo(Convert.ToInt32(UserID));
                s_Name = "<a href=\"" + rooDir + "/user/" + JuSNS.Common.Public.URLWrite("", "r", UserID.ToString()) + "\">" + userinfo.Username + "</a>";
            }
            return s_Name;
        }

        /// <summary>
        /// 取得时间
        /// </summary>
        /// <param name="time">时间</param>
        /// <returns></returns>
        protected string getTime(object time, object id)
        {
            string s_Time = string.Empty;
            if (time != DBNull.Value)
                s_Time = "(" + JuSNS.Common.Public.getTimeEXSpan(Convert.ToDateTime(time)) + ")";
            return s_Time;
        }

        /// <summary>
        /// 显示是否置顶
        /// </summary>
        /// <param name="topnum"></param>
        /// <returns></returns>
        protected string getIsTop(object topnum)
        {
            string s_Top = "";
            if (topnum.ToString() == "1")
                s_Top = "<span class=\"reshow\">[置顶]</span>";
            return s_Top;
        }
    }
}
