public OutDocuments GetDocuments() { OutDocuments data = new OutDocuments(); try { DocumentsDAO dao = new DocumentsDAO(); data = dao.GetDocuments(); } catch (Exception ex) { //escribir en el log LogHelper.WriteLog("Models", "ManageDocuments", "GetDocuments", ex, ""); } return(data); }
public OutDocuments GetDocuments() { string connectionString = DataBaseHelper.GetConnectionString("DLG"); OutDocuments response = new OutDocuments(); var ora = new OracleServer(connectionString); Documents document; List <Documents> list = new List <Documents>(); string command = string.Empty; try { command = " SELECT BBS_LIQCOM_PARAM_CARGA_DOCTOS.TIPO_DOCTO, BBS_LIQCOM_PARAM_CARGA_DOCTOS.NOMBRE_DOCTO FROM BBS_LIQCOM_PARAM_CARGA_DOCTOS "; command = command + " WHERE BBS_LIQCOM_PARAM_CARGA_DOCTOS.IND_ACTIVO = 1 order by ORDEN , TIPO_DOCTO "; var rdr = ora.ExecuteCommand(command); while (rdr.Read()) { document = new Documents(); document.documentType = DBNull.Value.Equals(rdr["TIPO_DOCTO"]) ? 0 : int.Parse(rdr["TIPO_DOCTO"].ToString()); document.documentName = DBNull.Value.Equals(rdr["NOMBRE_DOCTO"]) ? string.Empty : rdr["NOMBRE_DOCTO"].ToString(); list.Add(document); } rdr.Close(); response.lstDocuments = list; response.msg = new Response(); response.msg.errorCode = "200"; response.msg.errorMessage = "OK"; } catch (Exception ex) { throw new Exception("DocumentsDAO.GetDocuments", ex); } finally { ora.Dispose(); } return(response); }