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 Distributor_ShowResult : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            ViewState["lblOperator"] = Convert.ToString(Request.QueryString["operatorname"]);
            ViewState["Loginid"] = Convert.ToString(Request.QueryString["Loginid"]);
            ViewState["ServiceType"] = Convert.ToString(Request.QueryString["ServiceName"]);
            ViewState["Fromdate"] = Convert.ToString(Request.QueryString["FrmDate"]);
            ViewState["Todate"] = Convert.ToString(Request.QueryString["ToDate"]);
            GetDataAccOperators();
        }
        catch (Exception ex)
        {
            throw (ex);
        }  
    }
    private void GetDataAccOperators()
    {
        try
        {
            SqlParameter[] getdataaccessopertor = new SqlParameter[]
            {
                new SqlParameter("@operator",ViewState["lblOperator"]),
                new SqlParameter("@loginid",ViewState["Loginid"]),
                new SqlParameter("@ServiceType",ViewState["ServiceType"]),
                new SqlParameter("@Fromdate",ViewState["Fromdate"]),
                new SqlParameter("@Todate",ViewState["Todate"])

            };
            DataSet ds = SqlHelper.GetDataSet(SqlHelper.mainConnectionString, CommandType.StoredProcedure, "USP_ALLTRANSACTION_REPORT_OPERATORWISE", getdataaccessopertor);
            if (ds.Tables[0].Rows.Count > 0)
            {
                GvTransactionReport.DataSource = ds;
                GvTransactionReport.DataBind();
                lblerror.Visible = false;
            }
            else
            {
                lblerror.Visible = true;
                lblerror.Text = "No transaction available";
                lblerror.ForeColor = Color.Red;
            }
        }
        catch (Exception ev)
        {
            //lblerror.Text = "" + ev;
            throw (ev);
        }
    }
}
