public OutCancellationCausal GetCancellationCausal() { OutCancellationCausal data = new OutCancellationCausal(); try { ParametersDAO dao = new ParametersDAO(); data = dao.GetCancellationCausal(); } catch (Exception ex) { //escribir en el log LogHelper.WriteLog("Models", "ManagerParameters", "GetCausalCancelacion", ex, ""); } return(data); }
public OutCancellationCausal GetCancellationCausal() { string connectionString = DataBaseHelper.GetConnectionString("DLG"); OutCancellationCausal response = new OutCancellationCausal(); var ora = new OracleServer(connectionString); CancellationCausal cancellationCausal; List <CancellationCausal> list = new List <CancellationCausal>(); string command = string.Empty; try { command = " SELECT CODIGO, NOMBRE FROM BBS_LIQCOM_V_CAUSAL_CANCELA "; var rdr = ora.ExecuteCommand(command); while (rdr.Read()) { cancellationCausal = new CancellationCausal(); cancellationCausal.Code = DBNull.Value.Equals(rdr["CODIGO"]) ? "0" :rdr["CODIGO"].ToString(); cancellationCausal.Name = DBNull.Value.Equals(rdr["NOMBRE"]) ? string.Empty : rdr["NOMBRE"].ToString(); list.Add(cancellationCausal); } rdr.Close(); response.lstCancellationCausal = list; response.msg = new Response(); response.msg.errorCode = "200"; response.msg.errorMessage = "OK"; } catch (Exception ex) { throw new Exception("ParametersDAO.GetCausalCancelacion", ex); } finally { ora.Dispose(); } return(response); }