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.IO;
using System.Text;
using System.Net;
using System.Net.Mail;
using System.Xml;


public partial class DthRecharge : System.Web.UI.Page
{
    string opname;
    DataSet ds = new DataSet();   
    string varOperator;
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["LOGINID"] == null && Session["USERNAME"] == null)
            {
                Response.Redirect("../login.aspx");
            }
            lblerror.Text = Request.QueryString["error"];
            if (lblerror.Text == "Successfully Completed")
            {
                lblerror.ForeColor = Color.Blue;
            }
            else
            {
                lblerror.ForeColor = Color.Red;
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }  
    }
    
    protected void rbntDivOperaterDTHRecharge_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            SqlParameter[] getoperatorstatus = new SqlParameter[]
            {
                new SqlParameter("@WLID",Session["WhitelabelId"].ToString()),
                new SqlParameter("@operator",rbntDivOperaterDTHRecharge.SelectedItem.Text),
                new SqlParameter("@ServiceType","DTH")
            };
            ds = SqlHelper.GetDataSet(SqlHelper.mainConnectionString, CommandType.StoredProcedure, "usp_Getoperatorstatus", getoperatorstatus);
            if (ds.Tables[0].Rows[0]["Flag"].ToString().Equals("1"))
            {
                SqlParameter[] GetCurrentVendor = new SqlParameter[]
                {
                    new SqlParameter("@operator",rbntDivOperaterDTHRecharge.SelectedItem.Text),
                    new SqlParameter("@ServiceType","DTH")
                };
                ds = SqlHelper.GetDataSet(SqlHelper.mainConnectionString, CommandType.StoredProcedure, "usp_GetServiceVendor", GetCurrentVendor);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Session["varoperator"] = rbntDivOperaterDTHRecharge.SelectedItem.Text.ToUpper().Trim();
                    Session["serviceprovider"] = ds.Tables[0].Rows[0]["ServiceProvider"].ToString();
                    Session["operatorValue"] = rbntDivOperaterDTHRecharge.SelectedValue.Trim();
                    Response.Redirect("DthRecharge2.aspx");
                }
            }
            else
            {
                lblerror.Text = "Currently this service is not available.";
                lblerror.ForeColor = Color.Red;
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }

}
