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 Business_RECONS : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadChannels();
            loadEvents();
            //this.Button1.Enabled = false;
        }
    }

    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 = "LOOKUP_GETTER.Get_Recon_Job_Channels";

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

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

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

        ddlChannels.Items.Insert(0, "------ Channels ------");
        oracon.Close();
    }

    private void loadEvents()
    {
        ddlEvents.Items.Clear();
        if (ddlChannels.SelectedIndex > 0)
        {
            string DBConnection = Helper.dbConnection();

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

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

            oracom.CommandType = CommandType.StoredProcedure;
            oracom.CommandText = "LOOKUP_GETTER.Get_Recon_Channel_Events";

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

            oracom.Parameters["p_rc_code"].Value = ddlChannels.SelectedValue;

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

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

            oracon.Close();
        }
        ddlEvents.Items.Insert(0, "------ Events ------");
    }

    private void loadResult(string channelID, string eventID,string eventType, string date, 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 = "RECON_SUMMARY_INQUIRER.Search_Recon_Summary";

        oracom.Parameters.Add("p_current_uid", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_channel", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_re_code", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_re_type", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_settle_date", 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;

        oracom.Parameters["p_re_code"].IsNullable = true;


        if (channelID.Length != 0)
            oracom.Parameters["p_channel"].Value = channelID;
        else
            oracom.Parameters["p_channel"].Value = OracleNumber.Null;
        if (eventID.Length != 0)
            oracom.Parameters["p_re_code"].Value = eventID;
        else
            oracom.Parameters["p_re_code"].Value = OracleNumber.Null;
        if (eventType.Length != 0)
            oracom.Parameters["p_re_type"].Value = eventType;
        else
            oracom.Parameters["p_re_type"].Value = OracleString.Null;
        oracom.Parameters["p_settle_date"].Value = date;
        oracom.Parameters["p_page_size"].Value = pageSize;
        oracom.Parameters["p_page_num"].Value = pageNumber;
        oracom.Parameters["p_current_uid"].Value = Session["uid"].ToString();
        oracom.Parameters["p_lang"].Value = "EN";

        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();

        GridView1.DataSource = ds;
        GridView1.DataBind();
        if (pageNumber == 1)
        {
            ddlPages.Items.Clear();
            for (int i = 1; i <= nop; i++)
            {
                ddlPages.Items.Add(i.ToString());
            }
        }

        //GridView1.Columns[8].Visible = false;
    }

    private void loadFinacleFileDetails(string fileNumber, int eventId)
    {
        int resCode;

        string DBConnection = Helper.dbConnection();

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

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

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "recon_summary_inquirer.GET_FINACLE_FILE_DETAILS";

        oracom.Parameters.Add("p_current_uid", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_lang", OracleType.VarChar).Direction = ParameterDirection.Input;

        oracom.Parameters.Add("p_file_id", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_event_id", OracleType.Number).Direction = ParameterDirection.Input;

        oracom.Parameters.Add("p_FILE_NO", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_RECON_TYPE", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_rc_code", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_CHANNEL", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_re_code", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_EVENT", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NUMBER_OF_MATCH", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_RECON", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_TRANSACTION", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_MATCHED_AMOUNT", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCHED_RECON_AMOUNT", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_TRAN_AMOUNT", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_DUPLICATE_NUMBER", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_DUPLICATE_AMOUNT", OracleType.VarChar, 250).Direction = ParameterDirection.Output;

        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["p_current_uid"].Value = Session["uid"].ToString(); ;
        oracom.Parameters["p_lang"].Value = "EN";
        oracom.Parameters["p_file_id"].Value = fileNumber;
        oracom.Parameters["p_event_id"].Value = eventId;
        
        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        oracon.Close();

        resCode = int.Parse(oracom.Parameters["p_res_code"].Value.ToString());

        if (resCode == 0)
        {
            this.lbl_fileNumber_finacle.Text = oracom.Parameters["p_file_id"].Value.ToString();
            this.lbl_reconType_finacle.Text = oracom.Parameters["p_RECON_TYPE"].Value.ToString();
            ViewState["channel"] = oracom.Parameters["p_rc_code"].Value.ToString();
            this.lbl_channel_finacle.Text = oracom.Parameters["p_CHANNEL"].Value.ToString();
            ViewState["event"] = oracom.Parameters["p_re_code"].Value.ToString();
            this.lbl_event_finacle.Text = oracom.Parameters["p_EVENT"].Value.ToString();
            this.lbl_matchCount_finacle.Text = oracom.Parameters["p_NUMBER_OF_MATCH"].Value.ToString();
            this.lbl_matchAmount_finacle.Text = oracom.Parameters["p_MATCHED_AMOUNT"].Value.ToString();
            this.link_nonMatchReconCount_finacle.Text = oracom.Parameters["p_NON_MATCH_RECON"].Value.ToString();
            this.lbl_nonMatchReconAmount_finacle.Text = oracom.Parameters["p_NON_MATCHED_RECON_AMOUNT"].Value.ToString();
            this.lnk_nonMatchTrxnCount_finacle.Text = oracom.Parameters["p_NON_MATCH_TRANSACTION"].Value.ToString();
            this.lbl_nonMatchTrxnAmount_finacle.Text = oracom.Parameters["p_NON_MATCH_TRAN_AMOUNT"].Value.ToString();
            this.lbl_duplicateNumber_finacle.Text = oracom.Parameters["p_DUPLICATE_NUMBER"].Value.ToString();
            this.lbl_duplicateAmount_finacle.Text = oracom.Parameters["p_DUPLICATE_AMOUNT"].Value.ToString();
        }
    }

    private void loadGeneralsFilesDetails(string fileNumber, int eventId)
    {
        int resCode;

        string DBConnection = Helper.dbConnection();

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

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

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "recon_summary_inquirer.GET_GENERAL_FILES_DETAILS";

        oracom.Parameters.Add("p_current_uid", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_lang", OracleType.VarChar).Direction = ParameterDirection.Input;

        oracom.Parameters.Add("p_file_id", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_event_id", OracleType.Number).Direction = ParameterDirection.Input;

        oracom.Parameters.Add("p_FILE_NO", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_RECON_TYPE", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_rc_code", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_CHANNEL", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_re_code", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_EVENT", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NUMBER_OF_MATCH", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_RECON", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_TRANSACTION", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_MATCHED_AMOUNT", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCHED_RECON_AMOUNT", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_TRAN_AMOUNT", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_DUPLICATE_NUMBER", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_DUPLICATE_AMOUNT", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_RECON_CR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_TRANSACTION_CR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_DUPLICATE_NUMBER_CR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCHED_RECON_AMOUNT_CR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_TRAN_AMOUNT_CR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_DUPLICATE_AMOUNT_CR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_RECON_DR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_TRANSACTION_DR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_DUPLICATE_NUMBER_DR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCHED_RECON_AMOUNT_DR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_NON_MATCH_TRAN_AMOUNT_DR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_DUPLICATE_AMOUNT_DR", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        
        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["p_current_uid"].Value = Session["uid"].ToString(); 
        oracom.Parameters["p_lang"].Value = "EN";
        oracom.Parameters["p_file_id"].Value = fileNumber;
        oracom.Parameters["p_event_id"].Value = eventId;

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

        oracon.Close();

        resCode = int.Parse(oracom.Parameters["p_res_code"].Value.ToString());

        if (resCode == 0)
        {

            this.lbl_fileNumber.Text = oracom.Parameters["p_file_id"].Value.ToString();
            this.lbl_reconType.Text = oracom.Parameters["p_RECON_TYPE"].Value.ToString();
            ViewState["channel"] = oracom.Parameters["p_rc_code"].Value.ToString();
            this.lbl_channel.Text = oracom.Parameters["p_CHANNEL"].Value.ToString();
            ViewState["event"] = oracom.Parameters["p_re_code"].Value.ToString();
            this.lbl_event.Text = oracom.Parameters["p_EVENT"].Value.ToString();
            this.lbl_matchCount.Text = oracom.Parameters["p_NUMBER_OF_MATCH"].Value.ToString();
            this.lbl_matchAmount.Text = oracom.Parameters["p_MATCHED_AMOUNT"].Value.ToString();
            //this.lbl_nonMatchReconCount.Text = oracom.Parameters["p_NON_MATCH_RECON"].Value.ToString();
            this.link_nonMatchReconCount.Text = oracom.Parameters["p_NON_MATCH_RECON"].Value.ToString();
            if (int.Parse(oracom.Parameters["p_NON_MATCH_RECON"].Value.ToString()) > 0)
                link_nonMatchReconCount.Font.Underline  = true;
            else
                link_nonMatchReconCount.Font.Underline = false;
            this.lbl_nonMatchReconAmount.Text = oracom.Parameters["p_NON_MATCHED_RECON_AMOUNT"].Value.ToString();
            //this.lbl_nonMatchTrxnCount.Text = oracom.Parameters["p_NON_MATCH_TRANSACTION"].Value.ToString();
            this.lnk_nonMatchTrxnCount.Text = oracom.Parameters["p_NON_MATCH_TRANSACTION"].Value.ToString();
            if (lnk_nonMatchTrxnCount.Text != "")
            {
                if (int.Parse(oracom.Parameters["p_NON_MATCH_TRANSACTION"].Value.ToString()) > 0)
                    lnk_nonMatchTrxnCount.Font.Underline = true;
                else
                    lnk_nonMatchTrxnCount.Font.Underline = false;
            }
            this.lbl_nonMatchTrxnAmount.Text = oracom.Parameters["p_NON_MATCH_TRAN_AMOUNT"].Value.ToString();
            this.lbl_duplicateNumber.Text = oracom.Parameters["p_DUPLICATE_NUMBER"].Value.ToString();
            this.lbl_duplicateAmount.Text = oracom.Parameters["p_DUPLICATE_AMOUNT"].Value.ToString();

            this.lbl_nonMatchReconCountCr.Text = oracom.Parameters["p_NON_MATCH_RECON_CR"].Value.ToString();
            this.lbl_nonMatchReconAmountCr.Text = oracom.Parameters["p_NON_MATCHED_RECON_AMOUNT_CR"].Value.ToString();
            this.lbl_nonMatchReconCountDr.Text = oracom.Parameters["p_NON_MATCH_RECON_DR"].Value.ToString();
            this.lbl_nonMatchReconAmountDr.Text = oracom.Parameters["p_NON_MATCHED_RECON_AMOUNT_DR"].Value.ToString();
            this.lbl_nonMatchTrxnCountCr.Text = oracom.Parameters["p_NON_MATCH_TRANSACTION_CR"].Value.ToString();
            this.lbl_nonMatchTrxnAmountCr.Text = oracom.Parameters["p_NON_MATCH_TRAN_AMOUNT_CR"].Value.ToString();
            this.lbl_nonMatchTrxnCountDr.Text = oracom.Parameters["p_NON_MATCH_TRANSACTION_DR"].Value.ToString();
            this.lbl_nonMatchTrxnAmountDr.Text = oracom.Parameters["p_NON_MATCH_TRAN_AMOUNT_DR"].Value.ToString();
            this.lbl_duplicateNumberCr.Text = oracom.Parameters["p_DUPLICATE_NUMBER_CR"].Value.ToString();
            this.lbl_duplicateAmounCr.Text = oracom.Parameters["p_DUPLICATE_AMOUNT_CR"].Value.ToString();
            this.lbl_duplicateNumberDr.Text = oracom.Parameters["p_DUPLICATE_NUMBER_DR"].Value.ToString();
            this.lbl_duplicateAmounDr.Text = oracom.Parameters["p_DUPLICATE_AMOUNT_DR"].Value.ToString();
        }

    }
    
    protected void Button1_Click(object sender, EventArgs e)
    {
        string channelID = "", EventID = "", EventType = "";

        this.pnl_finacleDetails.Visible = false;
        this.pnl_generalDetails.Visible = false;

        if (ddlChannels.SelectedIndex > 0)
            channelID = ddlChannels.SelectedValue;
        if (ddlEvents.SelectedIndex > 0)
            EventID = ddlEvents.SelectedValue;
        if (ddlEventTypes.SelectedIndex > 0)
            EventType = ddlEventTypes.SelectedValue;
         
            
        pnlResult.Visible = true;
        GridView1.Columns[0].Visible = true;
        loadResult(channelID, EventID, EventType, DatePicker1.date, Helper.gridSize(), 1);
        GridView1.Columns[0].Visible = false;
    }
    
    protected void ddlPages_SelectedIndexChanged(object sender, EventArgs e)
    {
        string channelID = "", EventID = "", EventType = "";

        this.pnl_generalDetails.Visible = false;
        this.pnl_finacleDetails.Visible = false;

        if (ddlChannels.SelectedIndex > 0)
            channelID = ddlChannels.SelectedValue;
        if (ddlEvents.SelectedIndex > 0)
            EventID = ddlEvents.SelectedValue;
        if (ddlEventTypes.SelectedIndex > 0)
            EventType = ddlEventTypes.SelectedValue;
        loadResult(channelID, EventID, EventType, DatePicker1.date, Helper.gridSize(), int.Parse(ddlPages.SelectedValue));
    }
    
    protected void ddlChannels_SelectedIndexChanged(object sender, EventArgs e)
    {
        this.pnlResult.Visible = false;
        this.pnl_finacleDetails.Visible = false;
        this.pnl_generalDetails.Visible = false;
        //this.Button1.Enabled = false;
        loadEvents();
    }
        
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string command = e.CommandName.ToString();

        int selectedIndex = int.Parse(e.CommandArgument.ToString());
        //int selectedChannelId = int.Parse(this.ddlChannels.SelectedValue.ToString());//By Irfan 
        // Take Channel Value from cell

        var selectedChannelItem = ddlChannels.Items.FindByText(this.GridView1.Rows[selectedIndex].Cells[4].Text.ToString());
        int selectedChannelId = int.Parse(selectedChannelItem.Value.ToString());

        string selectedFileNumber = this.GridView1.DataKeys[selectedIndex].Value.ToString();
       // int selectedEventId = int.Parse(this.ddlEvents.SelectedValue.ToString());
        GridView1.Columns[0].Visible = true;
        var selectedEventItem = ddlEvents.Items.FindByText(this.GridView1.Rows[selectedIndex].Cells[5].Text.ToString());
        int selectedEventId = int.Parse(selectedEventItem.Value.ToString());
        //int selectedEventId = int.Parse(this.GridView1.Rows[selectedIndex].Cells[0].Text.ToString());
        GridView1.Columns[0].Visible = false;
        //ViewState["SettlDate"] = DatePicker1.FormatedDate;
        if (command.Equals("v"))
        {
            int index = int.Parse(e.CommandArgument.ToString());
            GridViewRow row = GridView1.Rows[index];
            ViewState["SettlDate"] = row.Cells[1].Text;

            if (selectedChannelId == 6)
            {
                this.pnl_finacleDetails.Visible = true;
                this.loadFinacleFileDetails(selectedFileNumber, selectedEventId);
            }
            else
            {
                this.pnl_generalDetails.Visible = true;
                this.loadGeneralsFilesDetails(selectedFileNumber, selectedEventId);
            }
        }

    }
    
    protected void ddlEvents_SelectedIndexChanged(object sender, EventArgs e)
    {
        this.pnlResult.Visible = false;
        this.pnl_finacleDetails.Visible = false;
        this.pnl_generalDetails.Visible = false;

        //if (this.ddlEvents.SelectedIndex > 0)
        //{
        //    this.Button1.Enabled = true;
        //}
        //else
        //{
        //    this.Button1.Enabled = false;
        //}

        if (ddlChannels.SelectedValue == "6")
        {
            if (ddlEvents.SelectedValue == "44")
            {
                link_nonMatchReconCount_finacle.ToolTip = "Exist in A12 Not in Switch C6E 002";
                lnk_nonMatchTrxnCount_finacle.ToolTip = "Exist in Switch C6E 002 Not in A12";
            }
            else if (ddlEvents.SelectedValue == "44")
            {
                link_nonMatchReconCount_finacle.ToolTip = "Exist in A12 Not in Virgin Txn 003";
                lnk_nonMatchTrxnCount_finacle.ToolTip = "Exist in Virgin Txn 003 Not in A12";
            }
        }
        else
        {
            link_nonMatchReconCount_finacle.ToolTip = "Exist in Master Not in Switch";
            lnk_nonMatchTrxnCount_finacle.ToolTip = "Exist in Switch Not in Master";
        }

    }
    protected void ddlEventTypes_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void imgRecon_Click(object sender, ImageClickEventArgs e)
    {
        ScriptManager.RegisterClientScriptBlock(this, typeof(string), "new window",
                             "window.open('ReconResult.aspx?channel=" + ViewState["channel"] + "&event=" + ViewState["event"] + "&filedate=" + ViewState["SettlDate"] + "&Type=1&eventType="+ddlEventTypes .SelectedIndex+" ','Redirect')", true);


    }
    protected void imgTran_Click(object sender, ImageClickEventArgs e)
    {
        ScriptManager.RegisterClientScriptBlock(this, typeof(string), "new window",
                             "window.open('ReconResult.aspx?channel=" + ViewState["channel"] + "&event=" + ViewState["event"] + "&filedate=" + ViewState["SettlDate"] + "&Type=2&eventType=" + ddlEventTypes.SelectedIndex + "  ','Redirect')", true);
    }

    protected void link_nonMatchReconCount_Click(object sender, EventArgs e)
    {
        if (int.Parse(link_nonMatchReconCount.Text) > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, typeof(string), "new window",
                                 "window.open('ReconResult.aspx?channel=" + ViewState["channel"] + "&event=" + ViewState["event"] + "&filedate=" + ViewState["SettlDate"] + "&Type=1&eventType=" + ddlEventTypes.SelectedIndex + " ','popWindow','toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=810,height=1000,left=300,top=75')", true);
        }
        
    }
    protected void lnk_nonMatchTrxnCount_Click(object sender, EventArgs e)
    {
        if (int.Parse(lnk_nonMatchTrxnCount.Text) > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, typeof(string), "new window",
                             "window.open('ReconResult.aspx?channel=" + ViewState["channel"] + "&event=" + ViewState["event"] + "&filedate=" + ViewState["SettlDate"] + "&Type=2&eventType=" + ddlEventTypes.SelectedIndex + "  ','popWindow','toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=1000,height=1000,left=350,top=75')", true);
        }
    }

    protected void link_nonMatchReconCount_finacle_Click(object sender, EventArgs e)
    {
        if (int.Parse(link_nonMatchReconCount_finacle.Text) > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, typeof(string), "new window",
                                 "window.open('ReconResult.aspx?channel=" + ViewState["channel"] + "&event=" + ViewState["event"] + "&filedate=" + ViewState["SettlDate"] + "&Type=1&eventType=" + ddlEventTypes.SelectedIndex + " ','popWindow','toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=810,height=1000,left=300,top=75')", true);
        }

    }
    protected void lnk_nonMatchTrxnCount_finacle_Click(object sender, EventArgs e)
    {
        if (int.Parse(lnk_nonMatchTrxnCount_finacle.Text) > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, typeof(string), "new window",
                             "window.open('ReconResult.aspx?channel=" + ViewState["channel"] + "&event=" + ViewState["event"] + "&filedate=" + ViewState["SettlDate"] + "&Type=2&eventType=" + ddlEventTypes.SelectedIndex + "  ','popWindow','toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=1000,height=1000,left=350,top=75')", true);
        }
    }
}
