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;
//using NCBEAI.Adapters.Transport;
using System.Xml;

public partial class Business_AddMerchant : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadClientLevel();
            loadLanguage();
            loadBusinessClass();
            loadCity();
            loadProductType();
            loadPostingMethod();
            loadsettlementMethod();
            loadBusinessUnit();
            loadIncomeRange();
            loadRelationOfficer();
            loadDynamicGroups();
            loadStaticGroups();

            loadBUAcc(ddlBusinessUnit.SelectedValue);
            dateRegDate.date = getDayofMonth(DateTime.Now.Day);
            rowParent.Visible = false;
        }
    }

    protected void btnSave_Click(object sender, EventArgs e)

        
    {
        if (txtRetailName.Text.Length == 0 || txtAccNo.Text.Length == 0 || ddlCity.SelectedValue == "-1" || ddlBusinessUnit.SelectedValue == "-1")
            lblError.Text = "please enter Merchant Name  City Name  Business Unit ";
        else
        {
           string error = "", ID = ""; //ID = "35377";
          bool saved = addMerchant(ref ID, ref error);
            if (saved)
           {
               lblError.Text = "Merchant saved";
              Response.Redirect("UpdateMerchant.aspx?clID=" + ID);
           }
           else
            {
                lblError.Text = error;
            }
        }
    }

    protected void ddlClientLevel_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlClientLevel.SelectedValue.Equals("001"))
        {
            rowParent.Visible = false;
            lblMerchantName.Text = "Merchant Name";
            lblMerchantNameAr.Text = "Arabic Merchant Name";
        }
        else
        {
            rowParent.Visible = true;
            lblMerchantName.Text = "Retailer Name";
            lblMerchantNameAr.Text = "Arabic Retailer Name";
        }
    }
    
    private bool addMerchant(ref string ID, ref string error)
    {
        string DBConnection = Helper.dbConnection();

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

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

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "merchant_reg.add_merchant_details";

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

        oracom.Parameters.Add("p_merchant_no", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_client_level", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_retailer_name", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_retailer_name_ar", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_registration_number", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_legal_form", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_client_language", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_business_class", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_city_code", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_street", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_product_type", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_posting_method", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_settlement_method", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_merchant_company", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_relationship_officer", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_parent_retailer_id", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_manual_application_number", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_merchant_contact", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_registration_date", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_income_range", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_account_number", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_rental_percent", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_business_unit", OracleType.VarChar).Direction = ParameterDirection.Input;

        oracom.Parameters.Add("p_DYNAMIC_GROUP_CODE", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_FIXED_GROUP_CODE", OracleType.VarChar).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_client_number", OracleType.VarChar, 250).Direction = ParameterDirection.Output;

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

        oracom.Parameters["p_merchant_no"].Value = OracleNumber.Null;
        oracom.Parameters["p_client_level"].Value = ddlClientLevel.SelectedValue;
        oracom.Parameters["p_retailer_name"].Value = txtRetailName.Text;
        oracom.Parameters["p_retailer_name_ar"].Value = txtRetailNameAr.Text;
        oracom.Parameters["p_registration_number"].Value = txtRegNo.Text;
        oracom.Parameters["p_legal_form"].Value = txtLegalForm.Text;
        oracom.Parameters["p_client_language"].Value = ddlLang.SelectedValue;
        oracom.Parameters["p_business_class"].Value = ddlBusinessClass.SelectedValue;
        oracom.Parameters["p_city_code"].Value = ddlCity.SelectedValue;
        oracom.Parameters["p_street"].Value = txtStreet.Text;
        oracom.Parameters["p_product_type"].Value = ddlProductType.SelectedValue;
        oracom.Parameters["p_posting_method"].Value = ddlPostingMethod.SelectedValue;
        oracom.Parameters["p_settlement_method"].Value = ddlSettlMethod.SelectedValue;
        oracom.Parameters["p_business_unit"].Value = ddlBusinessUnit.SelectedValue;

        oracom.Parameters["p_relationship_officer"].Value = ddlRelationshipOfficer.SelectedValue;
        oracom.Parameters["p_parent_retailer_id"].Value = txtParent.Text;
        if (txtManualAppNo.Text.Length != 0)
            oracom.Parameters["p_manual_application_number"].Value = txtManualAppNo.Text;
        else
            oracom.Parameters["p_manual_application_number"].Value = OracleNumber.Null;
        oracom.Parameters["p_merchant_contact"].Value = txtMerchantContact.Text;
        oracom.Parameters["p_registration_date"].Value = dateRegDate.date;
        oracom.Parameters["p_income_range"].Value = ddlIncomeRange.SelectedValue;
        oracom.Parameters["p_account_number"].Value = txtAccNo.Text;
        oracom.Parameters["p_rental_percent"].Value = OracleNumber.Null;

        if (rdDynamic.Checked)
        {
            oracom.Parameters["p_DYNAMIC_GROUP_CODE"].Value = ddlDynamicG.SelectedValue;
            oracom.Parameters["p_FIXED_GROUP_CODE"].Value = OracleString.Null;//ddlFixedG.SelectedValue;
        }
        else
        {
            oracom.Parameters["p_DYNAMIC_GROUP_CODE"].Value = OracleString.Null;
            oracom.Parameters["p_FIXED_GROUP_CODE"].Value = ddlFixedG.SelectedValue;
        }

        oracom.ExecuteNonQuery();
        oracon.Close();
        string a = oracom.Parameters["p_res_code"].Value.ToString();
        ID = oracom.Parameters["p_client_number"].Value.ToString();
        error = oracom.Parameters["p_res_msg"].Value.ToString();
        if (a == "0")
            return true;
        else
            return false;
    }

    //loading the lookups lists

    private void loadClientLevel()
    {
        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_clientlevel";

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

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

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

        oracon.Close();
    }

    private void loadLanguage()
    {
        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_language";

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

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

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

        oracon.Close();
    }

    private void loadBusinessClass()
    {
        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_Businessclass";

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

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

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

        oracon.Close();
    }

    private void loadCity()
    {
        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_city";

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

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

        ddlCity.DataSource = ds;
        ddlCity.DataBind();
        ddlCity.SelectedValue = "-1";
        oracon.Close();
    }

    private void loadProductType()
    {
        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_Product_type";

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

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

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

        oracon.Close();
    }

    private void loadPostingMethod()
    {
        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_Posting_method";

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

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

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

        oracon.Close();

        ddlPostingMethod.SelectedValue = "001";
        ddlPostingMethod.Enabled = false;
    }

    private void loadsettlementMethod()
    {
        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_Settl_method";

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

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

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

        oracon.Close();

        ddlSettlMethod.SelectedValue = "001";
        ddlSettlMethod.Enabled = false;
    }

    private void loadBusinessUnit()
    {
        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_Business_Units";

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

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

        ddlBusinessUnit.DataSource = ds;
        ddlBusinessUnit.DataBind();
        ddlBusinessUnit.SelectedValue = "-1";
        oracon.Close();
    }

    private void loadIncomeRange()
    {
        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_Income_range";

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

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

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

        oracon.Close();
    }

    private void loadRelationOfficer()
    {
        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_relationship_officer";

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

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

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

        oracon.Close();
    }

    private string getDayofMonth(int pDay)
    {
        string day = "", month = "", year = "";
        if (pDay < 10)
            day = "0" + pDay.ToString();
        else
            day = pDay.ToString();
        if (DateTime.Now.Month < 10)
            month = "0" + DateTime.Now.Month.ToString();
        else
            month = DateTime.Now.Month.ToString();
        year = DateTime.Now.Year.ToString();
        string date = day + "-" + month + "-" + year;
        return date;
    }

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

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

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

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "merchant_reg.Inherit_Parent_Merchant";

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

        oracom.Parameters["p_retailer_id"].Value = ID;

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

        oracon.Close();
        if (ds.Tables[0].Rows.Count > 0)
        {

            //set the data in the controls
            txtRetailName.Text = ds.Tables[0].Rows[0]["retailer_name"].ToString();
            txtRetailNameAr.Text = ds.Tables[0].Rows[0]["retailer_name_ar"].ToString();
            txtRegNo.Text = ds.Tables[0].Rows[0]["registration_number"].ToString();
            txtLegalForm.Text = ds.Tables[0].Rows[0]["legal_form"].ToString();
            txtStreet.Text = ds.Tables[0].Rows[0]["street"].ToString();
            txtManualAppNo.Text = ds.Tables[0].Rows[0]["manual_application_number"].ToString();
            txtMerchantContact.Text = ds.Tables[0].Rows[0]["merchant_contact"].ToString();
            txtAccNo.Text = ds.Tables[0].Rows[0]["acct_number"].ToString();
            try
            {
                ddlLang.SelectedValue = ds.Tables[0].Rows[0]["client_language"].ToString();
                ddlBusinessClass.SelectedValue = ds.Tables[0].Rows[0]["business_class"].ToString();
                ddlCity.SelectedValue = ds.Tables[0].Rows[0]["city_code"].ToString();
                ddlPostingMethod.SelectedValue = ds.Tables[0].Rows[0]["posting_method"].ToString();
                ddlSettlMethod.SelectedValue = ds.Tables[0].Rows[0]["settlement_method"].ToString();
                ddlBusinessUnit.SelectedValue = ds.Tables[0].Rows[0]["business_unit"].ToString();
                loadBUAcc(ddlBusinessUnit.SelectedValue); //mohamed said
                ddlRelationshipOfficer.SelectedValue = ds.Tables[0].Rows[0]["relationship_officer"].ToString();
                ddlIncomeRange.SelectedValue = ds.Tables[0].Rows[0]["income_range"].ToString();
                ddlProductType.SelectedValue = ds.Tables[0].Rows[0]["product_type"].ToString();
            }
            catch (Exception e)
            {
            }
            lblError.Text = "Root name: " + ds.Tables[0].Rows[0]["retailer_name"].ToString();

            if (ds.Tables[0].Rows[0]["dynamic_group_code"].ToString().Length == 0)
            {
                rdFixed.Checked = true;
                ddlFixedG.SelectedValue = ds.Tables[0].Rows[0]["fixed_group_code"].ToString();
            }
            else if (ds.Tables[0].Rows[0]["fixed_group_code"].ToString().Length == 0)
            {
                rdDynamic.Checked = true;
                ddlDynamicG.SelectedValue = ds.Tables[0].Rows[0]["dynamic_group_code"].ToString();
            }
        }
        else
            lblError.Text = "Parent ID not valid...";
    }

    private void loadBUAcc(string ID)
    {
        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_Business_Unit_Acct";

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

        oracom.Parameters["p_bu_code"].Value = ID;

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

        oracon.Close();

        txtBUAcc.Text = ds.Tables[0].Rows[0][0].ToString();

    }

    private void loadDynamicGroups()
    {
        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_Dyn_Fee_Groups";

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

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

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

        oracon.Close();
    }

    private void loadStaticGroups()
    {
        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_Fixed_Fee_Groups";

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

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

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

        oracon.Close();
    }

    protected void btnParentData_Click(object sender, EventArgs e)
    {
        loadMerchant(txtParent.Text);
    }

    protected void ddlBusinessUnit_SelectedIndexChanged(object sender, EventArgs e)
    {
        loadBUAcc(ddlBusinessUnit.SelectedValue);
    }

    protected void btnMW_Click(object sender, EventArgs e)
    {
        if (checkAcc())
        {
            lblError.Text = "Account Verification Done...";
        }
        else
        {
            lblError.Text = ViewState["MESSAGE"].ToString();
        }
    }

    private bool checkAcc()
    {
        //string Directory = ConfigurationSettings.AppSettings["MWCertificate"];
        //string XmlMessage = "";
        //string XmlResponse = "";
        //string TransportVia = "I";
        //string TransportMethod = "Synch";
        //string LangItem = "1";

        //NCBEAI.Adapters.Transport.Message Request = new Message(Directory);

        //XmlMessage = "<AccID>"+txtAccNo.Text+"</AccID>";

        //Request.TCod = "AccountDetails";
        //int finalError = Request.PrepareMessage(XmlMessage, LangItem, Directory, TransportVia, TransportMethod, out XmlResponse);

        //if (XmlResponse.Contains("OK"))
        //{
        //    XmlDocument doc = new XmlDocument();
        //    doc.LoadXml(XmlResponse);
        //    XmlNode node = doc.SelectSingleNode("/OK");
        //    return true;
        //}
        //else if (XmlResponse.Contains("ERR"))
        //{
        //    XmlDocument doc = new XmlDocument();
        //    doc.LoadXml(XmlResponse);
        //    XmlNode node = doc.SelectSingleNode("/ERR");
        //    string temp = node.Attributes["Desc"].InnerText;
        //    string temp1 = node.Attributes["NativeErr"].InnerText;
        //    string temp2 = node.Attributes["NativeDesc"].InnerText;

        //    ViewState["MESSAGE"] = temp + " " + temp1 + " " + temp2;
        //    return false;
        //}

        return true;
    }
}
