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 MasterAdmin_UserDetails : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                getmy_network_details();
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
    private void getmy_network_details()
    {
        try
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@LoginId",Session["LOGINID"].ToString()),
                new SqlParameter("@UserName",txtusername.Text.Trim())
            };
            DataSet ds = SqlHelper.GetDataSet(SqlHelper.mainConnectionString, CommandType.StoredProcedure, "usp_GetAgentList", param);
            if (ds.Tables[0].Rows.Count != 0)
            {
                gvActiveAgent.DataSource = ds;
                gvActiveAgent.DataBind();
            }
            else
            {
                gvActiveAgent.DataSource = null;
                gvActiveAgent.DataBind();
            }
        }
        catch (Exception ex)
        {
            //Server.Transfer("Error.aspx?id=" + ex + "");
            throw (ex);
        }
    }

    protected void btnActive_Click(object sender, EventArgs e)
    {
        try
        {
           if(txtusername.Text.Trim()=="")
            {
                lblerror.Text = "Please Enter Username";
                lblerror.ForeColor = Color.Red;
                return;
            }
            getmy_network_details();

        }
        catch (Exception ex)
        {
            throw (ex);
        }
        
    }

  
    protected void gvActiveAgent_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        try
        {
            gvActiveAgent.PageIndex = e.NewPageIndex;
            getmy_network_details();
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
}