using System;
using System.Data;
using System.Configuration;
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.Text;
using System.IO;
using System.Globalization;
using System.Data.OracleClient;
using System.Runtime.InteropServices;


/// <summary>
/// Summary description for system_param_editor
/// </summary>
public class SystemParam
{
	public SystemParam()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public static string GetParamByID(string ID)
    {
        string DBConnection = "";
        try
        {
            DBConnection = Helper.dbConnectionLive();

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

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

            oracom.CommandType = CommandType.StoredProcedure;
            oracom.CommandText = "SYSTEM_PARAM_EDITOR.get_parameter_by_id";

            oracom.Parameters.Add("p_current_uid", OracleType.Number).Direction = ParameterDirection.Input;
            oracom.Parameters.Add("p_param_id", 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["p_param_id"].Value = ID;
            oracom.Parameters["p_lang"].Value = "EN";
            oracom.Parameters["p_current_uid"].Value = "1";

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

            string temp = ds.Tables[0].Rows[0][2].ToString();
            oracon.Close();

            return temp;
        }
        catch (Exception ex)
        {

            ExceptionUtility.LogException(ex, "SYSTEM_PARAM_EDITOR.get_parameter_by_id", "", "getParamByID", "ID :" + ID + DBConnection + "");
            return null;
        }
    }

}