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;
using System.Text;

public partial class Distributor_Retailer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["LOGINID"] == null && Session["USERNAME"] == null)
            {
                Response.Redirect("../login.aspx");
            }
            if (!IsPostBack)
            {
                GetMargenDetail();
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }  
    }
    public void GetMargenDetail()
    {
        try
        {
            SqlParameter[] parm = new SqlParameter[]
            {
                new SqlParameter ("@ServiceType","Online"),
                new SqlParameter ("@userType","Agent"),
                new SqlParameter ("@comissionCategory","2")
            };
            DataSet ds = SqlHelper.GetDataSet(SqlHelper.mainConnectionString, CommandType.StoredProcedure, "UDP_GetMarginDetail", parm);
            if (ds.Tables[0].Rows.Count > 0)
            {
                DataTable dt = ds.Tables["Table"].Copy();

                DataView dv = new DataView(dt);
                dv.Sort = "OperatorType DESC";
                GridRetailer.DataSource = dv;
                GridRetailer.DataBind();
            }
        }
        catch (Exception ev)
        {

        }
    }
    protected void GridRetailer_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridRetailer.PageIndex = e.NewPageIndex;
        //GridRetailer.DataBind();
        GetMargenDetail();
    }
}
