public OutCategories GetCategory() { OutCategories data = new OutCategories(); try { ParametersDAO dao = new ParametersDAO(); data = dao.GetCategory(); } catch (Exception ex) { //escribir en el log LogHelper.WriteLog("Models", "ManagerParameters", "GetCategory", ex, ""); } return(data); }
public OutCategories GetCategory() { string connectionString = DataBaseHelper.GetConnectionString("DLG"); OutCategories response = new OutCategories(); var ora = new OracleServer(connectionString); Category category; List <Category> list = new List <Category>(); string command = string.Empty; try { command = " SELECT CODIGO_CATEGORIA, NOMBRE_CATEGORIA FROM BBS_LIQCOM_V_CATEGORIA "; var rdr = ora.ExecuteCommand(command); while (rdr.Read()) { category = new Category(); category.Code = DBNull.Value.Equals(rdr["CODIGO_CATEGORIA"]) ? string.Empty : rdr["CODIGO_CATEGORIA"].ToString(); category.Name = DBNull.Value.Equals(rdr["NOMBRE_CATEGORIA"]) ? string.Empty : rdr["NOMBRE_CATEGORIA"].ToString(); list.Add(category); } rdr.Close(); response.lstCategory = list; response.msg = new Response(); response.msg.errorCode = "200"; response.msg.errorMessage = "OK"; } catch (Exception ex) { throw new Exception("ParametersDAO.GetCategory", ex); } finally { ora.Dispose(); } return(response); }