using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json.Linq;

public partial class Agent_aeps : System.Web.UI.Page
{
    AEPS objAEPS = new AEPS();
    protected void Page_Load(object sender, EventArgs e)
    {
        string userid = "";
        if (Session["USERNAME"].ToString() == "AG80297")
        {
            userid = "100080297";
        }
        else
        {
            userid = Convert.ToString(Session["USERNAME"]);
        }
        //string Response = objAEPS.way_in(Convert.ToString(userid));
        //string Response1 = objAEPS.way_in(Convert.ToString("100080297"));
        string Response1 = objAEPS.way_in(Convert.ToString(userid));
        string[] response = Response1.Split('-');
        if (Response1.Contains("SU"))
        {
           
            Response.Redirect(Convert.ToString(response[1]));
             Response.Write("<script>window.open ('" + Convert.ToString(response[1]) + "','_blank');</script>");
         
        }
        else
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OhCrap", String.Format("alert('" + response[1] + "');"), true); return;
        }

        
    }
}