Exemplo n.º 1
0
 public ReportType Get(int id, string lang)
 {
     _reportType = dbConnection.GetReportTypeById(id, lang);
     return(_reportType);
 }
Exemplo n.º 2
0
        public ReportType GetReportTypeById(int id, string lang)
        {
            var reportType = new ReportType();
            string commandText = "SELECT DISTINCT REPORT_TYPE_LX_ID, REPORT_TYPE_CODE, ";
            if (lang.Equals("fr"))
            {
                commandText += " FR_DESC as REPORT_TYPE";
            }
            else
            {
                commandText += " EN_DESC as REPORT_TYPE";
            }
            commandText += " FROM CVPONL_OWNER.REPORT_TYPE_LX WHERE REPORT_TYPE_LX_ID = " + id;

            using (

                OracleConnection con = new OracleConnection(DpdDBConnection))
            {
                OracleCommand cmd = new OracleCommand(commandText, con);
                try
                {
                    con.Open();
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        if (dr.HasRows)
                        {
                            while (dr.Read())
                            {
                                var item = new ReportType();
                                item.report_type_id = dr["REPORT_TYPE_LX_ID"] == DBNull.Value ? 0 : Convert.ToInt32(dr["REPORT_TYPE_LX_ID"]);
                                item.report_type_code = dr["REPORT_TYPE_CODE"] == DBNull.Value ? string.Empty : dr["REPORT_TYPE_CODE"].ToString().Trim();
                                item.report_type = dr["REPORT_TYPE"] == DBNull.Value ? string.Empty : dr["REPORT_TYPE"].ToString().Trim();

                                reportType = item;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    string errorMessages = string.Format("DbConnection.cs - GetReportTypeById()");
                    ExceptionHelper.LogException(ex, errorMessages);
                    Console.WriteLine(errorMessages);
                }
                finally
                {
                    if (con.State == ConnectionState.Open)
                        con.Close();
                }
            }
            return reportType;
        }
Exemplo n.º 3
0
 public ReportType Get(int id, string lang)
 {
     _reportType = dbConnection.GetReportTypeById(id, lang);
     return _reportType;
 }