public OutChannelType GetChannelType() { OutChannelType data = new OutChannelType(); try { ParametersDAO dao = new ParametersDAO(); data = dao.GetChannelType(); } catch (Exception ex) { //escribir en el log LogHelper.WriteLog("Models", "ManagerParameters", "GetChannelType", ex, ""); } return(data); }
public OutChannelType GetChannelType() { string connectionString = DataBaseHelper.GetConnectionString("DLG"); OutChannelType response = new OutChannelType(); var ora = new OracleServer(connectionString); ChannelType channelType; List <ChannelType> list = new List <ChannelType>(); string command = string.Empty; try { command = " SELECT cod_cnl_vta, nom_cnl_vta FROM BBS_LIQCOM_V_TIPO_CANAL"; var rdr = ora.ExecuteCommand(command); while (rdr.Read()) { channelType = new ChannelType(); channelType.Code = DBNull.Value.Equals(rdr["cod_cnl_vta"]) ? 0 : double.Parse(rdr["cod_cnl_vta"].ToString()); channelType.Name = DBNull.Value.Equals(rdr["nom_cnl_vta"]) ? string.Empty : rdr["nom_cnl_vta"].ToString(); list.Add(channelType); } rdr.Close(); response.lstChannelType = list; response.msg = new Response(); response.msg.errorCode = "200"; response.msg.errorMessage = "OK"; } catch (Exception ex) { throw new Exception("ParametersDAO.GetChannelType", ex); } finally { ora.Dispose(); } return(response); }