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 System.Collections.Generic;
using JuSNS.ApiInterface;
using JuSNS.Model;
using JuSNS.Model.ApiInterface;
using JuSNS.Home;
using JuSNS.UI.Control;
namespace JuSNS.Web.app
{
    public partial class index : JuSNS.UI.Page.UserPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.bindAppType();
            this.bindMyApp();
        }

        /// <summary>
        /// 绑定应用类别
        /// </summary>
        protected void bindAppType()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("type", typeof(int));
            dt.Columns.Add("typestr", typeof(string));
            dt.Columns.Add("typeclass", typeof(string));
            foreach (KeyValuePair<int, string> kv in JuSNS.Config.UserApiConfig.AppType)
            {
                DataRow dr = dt.NewRow();
                dr["typeclass"] = "";
                dr["type"] = kv.Key;
                dr["typestr"] = kv.Value;
                dt.Rows.Add(dr);
              
            }
            this.apptypelist.DataSource = dt;
            this.apptypelist.DataBind();
        }
        /// <summary>
        /// 绑定我的应用程序
        /// </summary>
        protected void bindMyApp()
        {
            string pagecode = "MyAppList_aspx";         
            int ReCount, PgCount;
            int PageIndex = 1;
            if (Request.QueryString["Page"] != null)
                PageIndex = Convert.ToInt32(Request.QueryString["Page"]);
            SqlConditionInfo[] con ={ new SqlConditionInfo("@UserID", this.UserID, TypeCode.Int32) };
            DataTable dt = UtilPage.GetPage(pagecode, PageIndex, PAGESZ, out ReCount, out PgCount, con);
            this.myapplist.DataSource = dt;
            this.myapplist.DataBind();
            string PageUrl = "index.aspx";
            if (PgCount > 1)
            {
                this.DivPage.InnerHtml = PageNavigator.Pagination(PageIndex, PgCount, PageUrl);
            }
        }
    }
}
