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.ApiInterface;
using JuSNS.ApiInterface;
using System.Collections.Generic;

namespace JuSNS.Web.system.app
{
    public partial class appmore : JuSNS.UI.Page.ManagePage
    {
        int id = 0;
        protected string sort = "app";
        protected AppInfo theappinfo = new AppInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            int.TryParse(Request.QueryString["id"], out id);
            if (id == 0)
            {
                PageError("参数错误", Request.UrlReferrer.ToString());
            }
            theappinfo = App.GetAppInfo(id);
            bindAppType();
            DataBind();
        }
        /// <summary>
        /// 绑定应用类别
        /// </summary>
        protected void bindAppType()
        {
            string type = Request.QueryString["c"];
            DataTable dt = new DataTable();
            dt.Columns.Add("type", typeof(int));
            dt.Columns.Add("typestr", typeof(string));
            dt.Columns.Add("typeclass", typeof(string));
            DataRow dr = dt.NewRow();
            dr["typeclass"] = "";
            if (string.IsNullOrEmpty(type) || type == "0")
            {
                dr["typeclass"] = "current";
            }
            dr["type"] = 0;
            dr["typestr"] = "全部";
            dt.Rows.Add(dr);
            foreach (KeyValuePair<int, string> kv in JuSNS.Config.UserApiConfig.AppType)
            {
                dr = dt.NewRow();
                dr["typeclass"] = "";
                if (type == kv.Key.ToString())
                {
                    dr["typeclass"] = "current";
                }
                dr["type"] = kv.Key;
                dr["typestr"] = kv.Value;
                dt.Rows.Add(dr);
            }
            this.apptypelist.DataSource = dt;
            this.apptypelist.DataBind();
        }
    }
}
