using System;
using System.Collections;
using System.Configuration;
using System.Data;
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.Data.OracleClient;

public partial class TranTermSearch : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadChannels();
            loadServices();

            pnlControlsChannel.Visible = false;
            pnlControlsMaster.Visible = false;
            pnlResultChannel.Visible = false;
            pnlResultMaster.Visible = false;

            txtFromTime.Text = "000000";
            txtToTime.Text = "235959";
            dtFrom .date = DateTime.Today.AddDays(-1).ToString("dd-MM-yyyy");
            dtTo.date = DateTime.Today.AddDays(-1).ToString("dd-MM-yyyy");
        }
        lblError.Text = "";
    }

    private void loadChannels()
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "poslookup_getter.get_pos_channels";

        oracom.Parameters.Add("p_output", OracleType.Cursor).Direction = ParameterDirection.Output;


        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        ddlChannels.DataSource = ds;
        ddlChannels.DataBind();

        oracon.Close();
    }

    private void loadServices()
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "poslookup_getter.get_merservices";

        oracom.Parameters.Add("p_servicename", OracleType.Cursor).Direction = ParameterDirection.Output;


        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        ddlServices.DataSource = ds;
        ddlServices.DataBind();

        oracon.Close();
    }

    protected void ddlPages_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (dtFrom.date.Length == 0 || dtTo.date.Length == 0 || txtFromTime.Text.Length == 0
                                   || txtToTime.Text.Length == 0 || txtTerminalID.Text.Length == 0)
        {
            if (ddlServices.SelectedValue == "001")
            {
                lblError.Text = "please complete all data";
            }
            else
            {
                pnlResultChannel.Visible = true;
                loadResult(Helper.gridSize(), int.Parse(ddlPages.SelectedValue));
                pnlControlsChannel.Visible = false;
            }
        }
        else
        {
            pnlResultChannel.Visible = true;
            loadResult(Helper.gridSize(), int.Parse(ddlPages.SelectedValue));
            pnlControlsChannel.Visible = false;
        }
    }

    protected void ddlPages1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (dtFrom.date.Length == 0 || dtTo.date.Length == 0 || txtFromTime.Text.Length == 0
                                   || txtToTime.Text.Length == 0 || txtTerminalID.Text.Length == 0)
        {
            if (ddlServices.SelectedValue == "001")
            {
                lblError.Text = "please complete all data";
            }
            else
            {
                pnlResultMaster.Visible = true;
                loadResult(Helper.gridSize(), int.Parse(ddlPages1.SelectedValue));
                pnlControlsMaster.Visible = false;
            }
        }
        else
        {
            pnlResultMaster.Visible = true;
            loadResult(Helper.gridSize(), int.Parse(ddlPages1.SelectedValue));
            pnlControlsMaster.Visible = false;
        }
    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("v"))
        {
            int index = int.Parse(e.CommandArgument.ToString());
            string tID = GridView1.DataKeys[index].Value.ToString();
            string type = ViewState["type"].ToString();
            if (type.Equals("CH"))
            {
                loadTranDetails(tID);
            }
            else
            {
                loadTranDetails1(tID);
            }
        }
    }

    protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("v"))
        {
            int index = int.Parse(e.CommandArgument.ToString());
            string tID = GridView2.DataKeys[index].Value.ToString();
            string type = ViewState["type"].ToString();
            if (type.Equals("CH"))
            {
                loadTranDetails(tID);
            }
            else
            {
                loadTranDetails1(tID);
            }
        }
    }

    private void loadTranDetails(string tID)
    {
        pnlControlsChannel.Visible = true;
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "TRANSACTIONS_SEARCHER.Get_Channel_Tran";

        oracom.Parameters.Add("p_ct_code", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_output", OracleType.Cursor).Direction = ParameterDirection.Output;

        oracom.Parameters["p_ct_code"].Value = tID;

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        oracon.Close();

        //set the data in the controls
        Label1.Text = ds.Tables[0].Rows[0]["RECORD_DATE"].ToString();
        Label2.Text = ds.Tables[0].Rows[0]["SETTL_DATE"].ToString();

        Label3.Text = ds.Tables[0].Rows[0]["TRAN_DATE"].ToString();
        Label4.Text = ds.Tables[0].Rows[0]["TRAN_TIME"].ToString();
        Label5.Text = ds.Tables[0].Rows[0]["CARD_NUMBER"].ToString();
        Label6.Text = ds.Tables[0].Rows[0]["ISO_RSP"].ToString();
        Label7.Text = ds.Tables[0].Rows[0]["TERM_ID"].ToString();
        Label8.Text = ds.Tables[0].Rows[0]["TRAN_AMOUNT"].ToString();
        Label9.Text = ds.Tables[0].Rows[0]["TRAN_SOURCE"].ToString();
        Label10.Text = ds.Tables[0].Rows[0]["TRAN_DEST"].ToString();
        Label11.Text = ds.Tables[0].Rows[0]["MSG_TYPE"].ToString();
        Label12.Text = ds.Tables[0].Rows[0]["TRACE_ID"].ToString();
        Label13.Text = ds.Tables[0].Rows[0]["FILE_NUMBER"].ToString();
        Label14.Text = ds.Tables[0].Rows[0]["CARD_BRAND"].ToString();
        Label15.Text = ds.Tables[0].Rows[0]["RRN"].ToString();
        Label16.Text = ds.Tables[0].Rows[0]["CARD_EXP_DATE"].ToString();
        Label17.Text = ds.Tables[0].Rows[0]["ACCT_NUMBER"].ToString();
        Label18.Text = ds.Tables[0].Rows[0]["AUTH_CODE"].ToString();
        Label19.Text = ds.Tables[0].Rows[0]["BUSS_CLS"].ToString();
        Label20.Text = ds.Tables[0].Rows[0]["RECON_STATUS"].ToString();
        Label21.Text = ds.Tables[0].Rows[0]["TRAN_CURR"].ToString();
        Label22.Text = ds.Tables[0].Rows[0]["SETTL_CURR"].ToString();
        Label23.Text = ds.Tables[0].Rows[0]["SETTL_AMOUNT"].ToString();
        Label24.Text = ds.Tables[0].Rows[0]["TRAN_CHG"].ToString();
        Label25.Text = ds.Tables[0].Rows[0]["MATCH_RESULT"].ToString();
        Label26.Text = ds.Tables[0].Rows[0]["CHIP_INDEX"].ToString();
        Label27.Text = ds.Tables[0].Rows[0]["channel_name"].ToString();
        Label28.Text = ds.Tables[0].Rows[0]["event_name"].ToString();
        Label29.Text = ds.Tables[0].Rows[0]["PCODE"].ToString();
        Label30.Text = ds.Tables[0].Rows[0]["FINANCIAL_FLAG"].ToString();
        Label31.Text = ds.Tables[0].Rows[0]["PRODUCT"].ToString();
        Label32.Text = ds.Tables[0].Rows[0]["MSG_RESAON_CODE"].ToString();
        Label33.Text = ds.Tables[0].Rows[0]["SETTL_FLAG"].ToString();
        Label82.Text = ds.Tables[0].Rows[0]["TRAN_TYPE"].ToString();
        /*06-06-2012 Add the new fields in the Channels_TRAN */
        lblFinValDate.Text = ds.Tables[0].Rows[0]["FINACLE_VALUE_DATE"].ToString();
        lblFinPostDate.Text = ds.Tables[0].Rows[0]["FINACLE_POSTING_DATE"].ToString();
        lblFinPostTime.Text = ds.Tables[0].Rows[0]["FINACLE_POSTING_TIME"].ToString();
        lblMerchantName.Text = ds.Tables[0].Rows[0]["MERCHANT_NAME"].ToString();

    }

    private void loadTranDetails1(string tID)
    {
        pnlControlsMaster.Visible = true;
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "TRANSACTIONS_SEARCHER.Get_Master_Tran";

        oracom.Parameters.Add("p_mt_code", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_output", OracleType.Cursor).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_match_grid", OracleType.Cursor).Direction = ParameterDirection.Output;

        oracom.Parameters["p_mt_code"].Value = tID;

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        oracon.Close();

        //set the data in the controls
        Label34.Text = ds.Tables[0].Rows[0]["RECORD_DATE"].ToString();
        Label35.Text = ds.Tables[0].Rows[0]["SETTL_DATE"].ToString();

        Label36.Text = ds.Tables[0].Rows[0]["TRAN_DATE"].ToString();
        Label37.Text = ds.Tables[0].Rows[0]["TRAN_TIME"].ToString();
        Label38.Text = ds.Tables[0].Rows[0]["CARD_NUMBER"].ToString();
        Label39.Text = ds.Tables[0].Rows[0]["PCODE"].ToString();
        Label40.Text = ds.Tables[0].Rows[0]["FINANCIAL_FLAG"].ToString();
        Label41.Text = ds.Tables[0].Rows[0]["B24_RSP"].ToString();
        Label42.Text = ds.Tables[0].Rows[0]["ISO_RSP"].ToString();
        Label43.Text = ds.Tables[0].Rows[0]["TERM_ID"].ToString();
        Label44.Text = ds.Tables[0].Rows[0]["TRAN_AMOUNT"].ToString();
        Label45.Text = ds.Tables[0].Rows[0]["TRAN_SOURCE"].ToString();
        Label46.Text = ds.Tables[0].Rows[0]["TRAN_DEST"].ToString();
        Label47.Text = ds.Tables[0].Rows[0]["MSG_TYPE"].ToString();
        Label48.Text = ds.Tables[0].Rows[0]["TRACE_ID"].ToString();
        Label49.Text = ds.Tables[0].Rows[0]["FILE_NUMBER"].ToString();
        Label50.Text = ds.Tables[0].Rows[0]["CARD_BRAND"].ToString();
        Label51.Text = ds.Tables[0].Rows[0]["RRN"].ToString();
        Label52.Text = ds.Tables[0].Rows[0]["CARD_EXP_DATE"].ToString();
        Label53.Text = ds.Tables[0].Rows[0]["ACCT_NUMBER"].ToString();
        Label54.Text = ds.Tables[0].Rows[0]["AUTH_CODE"].ToString();
        Label55.Text = ds.Tables[0].Rows[0]["BUSS_CLASS"].ToString();
        Label56.Text = ds.Tables[0].Rows[0]["TRAN_STATUS"].ToString();
        Label57.Text = ds.Tables[0].Rows[0]["TRAN_CURR"].ToString();
        Label58.Text = ds.Tables[0].Rows[0]["SETTL_CURR"].ToString();
        Label59.Text = ds.Tables[0].Rows[0]["SETTL_AMOUNT"].ToString();
        Label60.Text = ds.Tables[0].Rows[0]["TRAN_CHG"].ToString();
        Label61.Text = ds.Tables[0].Rows[0]["RECON_REQ_FLAG"].ToString();
        Label62.Text = ds.Tables[0].Rows[0]["RECON_PERFORMED_FLAG"].ToString();
        Label63.Text = ds.Tables[0].Rows[0]["MATCH_CRIERIA"].ToString();
        Label64.Text = ds.Tables[0].Rows[0]["MATCH_REF1"].ToString();
        Label65.Text = ds.Tables[0].Rows[0]["MATCH_REF2"].ToString();
        Label66.Text = ds.Tables[0].Rows[0]["MATCH_REF3"].ToString();
        Label67.Text = ds.Tables[0].Rows[0]["MATCH_REF4"].ToString();
        Label68.Text = ds.Tables[0].Rows[0]["MATCH_DATE1"].ToString();
        Label69.Text = ds.Tables[0].Rows[0]["MATCH_DATE2"].ToString();
        Label70.Text = ds.Tables[0].Rows[0]["MATCH_DATE3"].ToString();
        Label71.Text = ds.Tables[0].Rows[0]["MATCH_DATE4"].ToString();
        Label72.Text = ds.Tables[0].Rows[0]["CHIP_DATA"].ToString();
        Label73.Text = ds.Tables[0].Rows[0]["NEXT_MATCH"].ToString();
        Label74.Text = ds.Tables[0].Rows[0]["re_code"].ToString();
        Label75.Text = ds.Tables[0].Rows[0]["PRODUCT"].ToString();
        Label76.Text = ds.Tables[0].Rows[0]["ORIG_OSEQ_NUM"].ToString();
        Label77.Text = ds.Tables[0].Rows[0]["ORIG_DATE"].ToString();
        Label78.Text = ds.Tables[0].Rows[0]["ORIG_TIME"].ToString();
        Label79.Text = ds.Tables[0].Rows[0]["AMT_2"].ToString();
        Label80.Text = ds.Tables[0].Rows[0]["AMT_3"].ToString();
        Label81.Text = ds.Tables[0].Rows[0]["AUTH_AMT"].ToString();
        Label83.Text = ds.Tables[0].Rows[0]["merch_settle_desc"].ToString();

        GridView3.DataSource = ds.Tables[1];
        GridView3.DataBind();
    }

    protected void btnCancel_Click(object sender, EventArgs e)
    {
        pnlControlsChannel.Visible = false;
    }

    protected void btnCancel1_Click(object sender, EventArgs e)
    {
        pnlControlsMaster.Visible = false;
    }

    protected void btnSearch_Click(object sender, EventArgs e)
    {
        txtTerminalID.Text = txtTerminalID.Text.Trim();
        txtCardNo.Text = txtCardNo.Text.Trim();
        txtRRN.Text = txtRRN.Text.Trim();

        pnlControlsChannel.Visible = false;
        pnlControlsMaster.Visible = false;
        pnlResultMaster.Visible = false;
        pnlResultChannel.Visible = false;

        if (dtFrom.date.Length == 0 || dtTo.date.Length == 0 || txtFromTime.Text.Length == 0
                                    || txtToTime.Text.Length == 0)
        {
            lblError.Text = "please complete all date and time fields";
        }
        else
        {
            //if(txtTerminalID.Text.Length == 0 && txtCardNo.Text.Length == 0 && ddlServices.SelectedValue == "001")
            //{
            //    lblError.Text = "please Enter Card Number or Terminal ID";
            //}
            //else
                loadResult(Helper.gridSize(), 1);
        }
    }

    private void loadResult(int pageSize, int pageNumber)
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "TRANSACTIONS_SEARCHER.Search_POS_Tran";

        oracom.Parameters.Add("p_current_uid", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_term_id", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_card_no", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_rrn", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_rc_code", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_srv_code", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_fin_flg", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_tran_date_from", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_tran_date_to", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_tran_time_from", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_tran_time_to", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_ch_b24", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_page_size", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_page_num", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_lang", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_res_code", OracleType.Number).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_res_type", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_res_msg", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_output", OracleType.Cursor).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_total_pages", OracleType.Number).Direction = ParameterDirection.Output;

        if (txtTerminalID.Text.Length != 0)
            oracom.Parameters["p_term_id"].Value = txtTerminalID.Text;
        else
            oracom.Parameters["p_term_id"].Value = OracleString.Null;

        if (txtCardNo.Text.Length != 0)
            oracom.Parameters["p_card_no"].Value = txtCardNo.Text;
        else
            oracom.Parameters["p_card_no"].Value = OracleString.Null;


        if (txtRRN.Text.Length != 0)
            oracom.Parameters["p_rrn"].Value = txtRRN.Text;
        else
            oracom.Parameters["p_rrn"].Value = OracleString.Null;

       
        
        oracom.Parameters["p_rc_code"].Value = ddlChannels.SelectedValue;
        oracom.Parameters["p_srv_code"].Value = ddlServices.SelectedValue;
        oracom.Parameters["p_fin_flg"].Value = ddlFinancial.SelectedValue;

        oracom.Parameters["p_tran_date_from"].Value = dtFrom.date;
        oracom.Parameters["p_tran_date_to"].Value = dtTo.date;
        oracom.Parameters["p_tran_time_from"].Value = txtFromTime.Text;
        oracom.Parameters["p_tran_time_to"].Value = txtToTime.Text;
        if(rdB24.Checked)
            oracom.Parameters["p_ch_b24"].Value = "B24";
        else
            oracom.Parameters["p_ch_b24"].Value = "CH";

        ViewState["type"] = oracom.Parameters["p_ch_b24"].Value;

        oracom.Parameters["p_page_size"].Value = pageSize;
        oracom.Parameters["p_page_num"].Value = pageNumber;
        oracom.Parameters["p_lang"].Value = "EN";
        oracom.Parameters["p_current_uid"].Value = Session["uid"].ToString();

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        int nop = int.Parse(oracom.Parameters["p_total_pages"].Value.ToString());
        oracon.Close();

        string type = ViewState["type"].ToString();
        if (type.Equals("CH"))
        {
            GridView1.DataSource = ds;
            GridView1.DataBind();
            pnlResultChannel.Visible = true;
        }
        else
        {
            GridView2.DataSource = ds;
            GridView2.DataBind();
            pnlResultMaster.Visible = true;
        }

        if (pageNumber == 1)
        {
            ddlPages.Items.Clear();
            ddlPages1.Items.Clear();
            for (int i = 1; i <= nop; i++)
            {
                if (type.Equals("CH"))
                    ddlPages.Items.Add(i.ToString());
                else
                    ddlPages1.Items.Add(i.ToString());
            }
        }
    }
    protected void rdB24_CheckedChanged(object sender, EventArgs e)
    {
        pnlResultChannel.Visible = false;
        pnlResultMaster.Visible = false;
        pnlControlsChannel.Visible = false;
        pnlControlsMaster.Visible = false;
        if(rdB24.Checked)
            ddlChannels.Enabled = false;
    }
    protected void rdCH_CheckedChanged(object sender, EventArgs e)
    {
        pnlResultChannel.Visible = false;
        pnlResultMaster.Visible = false;
        pnlControlsChannel.Visible = false;
        pnlControlsMaster.Visible = false;

        if (rdCH.Checked)
            ddlChannels.Enabled = true;
    }
    protected void btnRep_Click(object sender, EventArgs e)
    {

        txtTerminalID.Text = txtTerminalID.Text.Trim();
        txtCardNo.Text = txtCardNo.Text.Trim();
        txtRRN.Text = txtRRN.Text.Trim();

        pnlControlsChannel.Visible = false;
        pnlControlsMaster.Visible = false;
        pnlResultMaster.Visible = false;
        pnlResultChannel.Visible = false;

        if (dtFrom.date.Length == 0 || dtTo.date.Length == 0 || txtFromTime.Text.Length == 0
                                    || txtToTime.Text.Length == 0)
        {
            lblError.Text = "please complete all date and time fields";
        }
        else
        {
            if (txtTerminalID.Text.Length == 0 && txtCardNo.Text.Length == 0 && ddlServices.SelectedValue == "001")
            {
                lblError.Text = "please Enter Card Number or Terminal ID";
            }
            else
            {
                string terminal = txtTerminalID.Text;
                string card = txtCardNo.Text;
                string rrn = txtRRN.Text;
                string chan = ddlChannels.SelectedValue;
                string serv = ddlServices.SelectedValue;
                string finflag = ddlFinancial.SelectedValue;
                string dateF = dtFrom.date;
                string dateT = dtTo.date;
                string timeF = txtFromTime.Text;
                string timeT = txtToTime.Text;
                string chb24 = "";
                string typename = "";
                if (rdB24.Checked)
                {
                    chb24 = "B24";
                    typename = "Base 24";
                }
                else
                {
                    chb24 = "CH";
                    typename = "Channel";
                }
                string uid = Session["uid"].ToString();
                string perFdate = dtFrom.FormatedDate;
                string perTdate = dtTo.FormatedDate;
                string perFtime = txtFromTime.Text.Substring(0, 2) + ":"
                                 + txtFromTime.Text.Substring(2, 2) + ":" + txtFromTime.Text.Substring(4, 2);
                string perTtime = txtToTime.Text.Substring(0, 2) + ":"
                                 + txtToTime.Text.Substring(2, 2) + ":" + txtToTime.Text.Substring(4, 2);
                string servname = ddlServices.SelectedItem.Text;

                string UrlString = "rpt=500&terminal=" +
                     terminal + "&card=" + card + "&rrn=" + rrn + "&chan=" + chan + "&serv=" + serv + "&finflag=" +
                     finflag + "&dateF=" + dateF + "&dateT=" + dateT + "&timeF=" + timeF +
                     "&timeT=" + timeT + "&chb24=" + chb24 + "&perFdate=" + perFdate +
                     "&perTdate=" + perTdate + "&servname=" + servname + "&typename=" + typename +
                     "&perFtime=" + perFtime + "&perTtime=" + perTtime + "&uid=" + uid;

                ScriptManager.RegisterClientScriptBlock(this, typeof(string), "new window",
                    "window.open('../Reports/Default.aspx?" + UrlString + "','Report')", true);
            }
        }
    }
    protected void ddlChannels_SelectedIndexChanged(object sender, EventArgs e)
    {
        pnlResultChannel.Visible = false;
        pnlResultMaster.Visible = false;
        pnlControlsChannel.Visible = false;
        pnlControlsMaster.Visible = false;
    }
}
