public beComentarioLlamada ListarComentariosLlamadas(int ahid) { beComentarioLlamada obeComentarioLlamada = null; using (SqlConnection con = new SqlConnection(Conexion)) { try { con.Open(); daVisor odaVisor = new daVisor(); obeComentarioLlamada = odaVisor.ListarComentariosLlamadas(con, ahid); } catch (SqlException ex) { beLog obeLog; foreach (SqlError err in ex.Errors) { obeLog = new beLog(); obeLog.MensajeError = err.Message; obeLog.DetalleError = ex.StackTrace; ucObjeto.Grabar(obeLog, ArchivoLog); } } catch (Exception ex) { beLog obeLog = new beLog(); obeLog.MensajeError = ex.Message; obeLog.DetalleError = ex.StackTrace; ucObjeto.Grabar(obeLog, ArchivoLog); } } return(obeComentarioLlamada); }
public beComentarioLlamada ListarComentariosLlamadas(SqlConnection con, int ahid) { beComentarioLlamada obeComentarioLlamada = null; SqlCommand cmd = new SqlCommand("Sp_get_comentarios_llamadas", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter param1 = cmd.Parameters.Add("@ahid", SqlDbType.Int); param1.Direction = ParameterDirection.Input; param1.Value = ahid; List <beComentario> lbeComentario = null; List <beLlamada> lbeLlamadas = null; List <beEvento> lbeEvento = null; SqlDataReader drd = cmd.ExecuteReader(); if (drd != null) { int Datetimeoccurred = drd.GetOrdinal("Datetimeoccurred"); int OperatorNote = drd.GetOrdinal("OperatorNote"); int Operator = drd.GetOrdinal("Operator"); obeComentarioLlamada = new beComentarioLlamada(); lbeComentario = new List <beComentario>(); beComentario obeComentario; while (drd.Read()) { obeComentario = new beComentario(); obeComentario.Fecha = drd.GetDateTime(Datetimeoccurred).ToString("dd/MM/yyyy HH:mm:ss"); obeComentario.Comentario = drd.GetString(OperatorNote); obeComentario.Operador = drd.GetString(Operator); lbeComentario.Add(obeComentario); } if (drd.NextResult()) { int Datetimeoccurred2 = drd.GetOrdinal("Datetimeoccurred"); int Observacion = drd.GetOrdinal("Observacion"); int Operator2 = drd.GetOrdinal("Operator"); int NomCategoria = drd.GetOrdinal("Categoria"); lbeLlamadas = new List <beLlamada>(); beLlamada obeLlamada; while (drd.Read()) { obeLlamada = new beLlamada(); obeLlamada.Fecha = drd.GetDateTime(Datetimeoccurred2).ToString("dd/MM/yyyy HH:mm:ss"); obeLlamada.Comentario = drd.GetString(Observacion); obeLlamada.Operador = drd.GetString(Operator2); obeLlamada.NomCategoria = drd.GetString(NomCategoria); lbeLlamadas.Add(obeLlamada); } if (drd.NextResult()) { int Fecha = drd.GetOrdinal("DateTimeOccurred"); int AlarmCode = drd.GetOrdinal("AlarmCode"); int AlarmDesc = drd.GetOrdinal("Description"); lbeEvento = new List <beEvento>(); beEvento obeEvento; while (drd.Read()) { obeEvento = new beEvento(); obeEvento.Fecha = drd.GetDateTime(Fecha).ToString("dd/MM/yyyy HH:mm:ss"); obeEvento.AlarmCode = drd.GetString(AlarmCode); obeEvento.AlarmDesc = drd.GetString(AlarmDesc); lbeEvento.Add(obeEvento); } } } obeComentarioLlamada.lstComentario = lbeComentario; obeComentarioLlamada.lstLlamada = lbeLlamadas; obeComentarioLlamada.lstEvento = lbeEvento; drd.Close(); } return(obeComentarioLlamada); }