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.UI.Control;
using JuSNS.Home;
using JuSNS.ApiInterface;

namespace JuSNS.Web.system.app
{
    public partial class devrequest : JuSNS.UI.Page.ManagePage
    {
        protected string sort = "app";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string actype = Request.QueryString["type"];
                int id = 0;
                string value = Request.QueryString["value"];
                int.TryParse(Request.QueryString["id"], out id);

                if (!string.IsNullOrEmpty(actype))
                {
                    switch (actype.ToLower())
                    {
                        case "del":
                            Developer.DeleteDeveloper(id);
                            break;
                        case "pass":
                            if (string.IsNullOrEmpty(value) || value == "0")
                            {
                                Developer.DisableDeveloper(id);
                            }
                            else
                            {
                                Developer.PassDeveloper(id);
                            }
                            break;
                    }
                }

                bind();
            }
        }

        protected void bind()
        {
            string pagecode = "devRequest_aspx";
            int ReCount, PgCount;
            int PageIndex = 1;
            if (Request.QueryString["Page"] != null)
            {
                PageIndex = Convert.ToInt32(Request.QueryString["Page"]);
            }
            DataTable dt = UtilPage.GetPage(pagecode, PageIndex, PAGESZ, out ReCount, out PgCount, null);
            this.rpt.DataSource = dt;
            this.rpt.DataBind();
            string PageUrl = Request.FilePath;
            if (PgCount > 1)
            {
                this.DivPage.InnerHtml = PageNavigator.Pagination(PageIndex, PgCount, PageUrl);
            }
        }
        protected string vEnable(object enable)
        {
            int n = Convert.ToInt32(enable);
            if (n == 1)
            {
                return "ÒÑ¿ªÍ¨";
            }
            else
            {
                return "ÉóºËÖÐ";
            }
        }
    }
}
