using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Drawing;

public partial class Index : System.Web.UI.Page
{
    string date = DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss");
    string usertype;
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["LOGINID"] == null && Session["USERTYPE"] == null)
            {
                Response.Redirect("../login.aspx");
            }
            usertype = Session["USERTYPE"].ToString();
            if (!IsPostBack)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "test", "askToConfirm();", true);
                userdetails();
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }  
    }
    public void userdetails()
    {
        try
        {
            SqlParameter[] get_user_details = new SqlParameter[]
            {
                new SqlParameter("@LOGINID",Session["LOGINID"].ToString())
            };
            SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.mainConnectionString, CommandType.StoredProcedure, "UDP_USERDETAILS", get_user_details);
            if (dr.Read())
            {
                lblAgentID.Text = Convert.ToString(dr["USERNAME"]);
                lblAgency_firm_name.Text = Convert.ToString(dr["CORPORATENAME"]);
                lbl_FirstName.Text = Convert.ToString(dr["firstname"]);
                lbl_LastName.Text = Convert.ToString(dr["LASTNAME"]);
                lbl_registered_emailid.Text = Convert.ToString(dr["EMAILID"]);
                lbl_registered_mobileno.Text = Convert.ToString(dr["MOBILENO"]);
                lbl_balance.Text = Convert.ToString(dr["balance"]);
                //lbl_COMMISSION.Text = Convert.ToString(dr["COMMISSION"]);
            }
            dr.Close();
        }
        catch (Exception ex)
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OhCrap", String.Format("alert('There is some technical problem. Please try again');"), true);
        }
    }    
    protected void btnFundRequestSelf_Click(object sender, EventArgs e)
    {
        Response.Redirect("FundRequestSelf.aspx");
    }
}
