Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bool imp = Request.QueryString["Import"] != null && Convert.ToBoolean(Request.QueryString["Import"]);
                Import = imp ? 1 : 0;

                if (Request.QueryString["Next"] != null)
                {
                }
                if (Request.QueryString["PageNo"] != null)
                {
                    int page = Convert.ToInt32(Request.QueryString["PageNo"]);
                    PageNo = Math.Max(page, 1);
                }
                else
                {
                    PageNo = 1;
                }
                if (Request.QueryString["Next"] != null)
                {
                    bool?next = Convert.ToBoolean(Request.QueryString["Next"]);
                    PageNo = next.Value ? PageNo + 1 : Math.Max(1, PageNo - 1);
                }
                Page1 = (Math.Max(PageNo, 1) - 1) / PageListNumber * PageListNumber + 1;
            }
            else
            {
                Page1 = 1;
            }
            var    isImport = Import == 1;
            string json     = _serviceClient.GetFlightCount(isImport);

            if (json.JObjCodeTrue() && json.JobjMessageConvert <int>() > 0)
            {
                TotalCount = json.JobjMessageConvert <int>();
                TotalPage  = TotalCount / PageSize + (TotalCount % PageSize == 0 ? 0 : 1);
                json       = _serviceClient.GetFlights(isImport, PageNo, PageSize);
                if (json.JObjCodeTrue())
                {
                    var source = from it in json.JObjMessageToken()
                                 select new
                    {
                        Address   = it["Address"].ValueOrDefault <string>(),
                        Approach  = it["Approach"].ValueOrDefault <string>(),
                        Flight    = it["Flight"].ValueOrDefault <string>(),
                        DateLimit = it["DateLimit"].ValueOrDefault <string>()
                    };
                    if (isImport)
                    {
                        RepeaterImport.DataSource = source;
                        RepeaterImport.DataBind();
                    }
                    else
                    {
                        RepeaterExport.DataSource = source;
                        RepeaterExport.DataBind();
                    }
                }
            }


            Page.ClientScript.RegisterStartupScript(GetType(), "pageNoSelector",
                                                    "<script language='javascript'>pageNoSelector(" + Import + "," + PageNo + "," + TotalPage +
                                                    ");</script>");
        }