public void EjecutarNotificaciones() { try { EscalamientoModel escalamiento = new EscalamientoModel(); List <TicketModel> ticket = notificacionesDataAccess.GetData(); foreach (TicketModel i in ticket) { TicketModel elemento = i; if (elemento.UltimoEscalamiento == 0) { TiempoDeAtencionModel tiempoDeAtencion = CalculaTiempoAtencion(elemento.FechaRecepcion, elemento.HorasAtencion); if (!tiempoDeAtencion.EnTiempo) { PrimerEscalamiento(elemento); escalamiento.TicketId = elemento.TicketId; escalamiento.FechaEscalamiento = DateTime.Now; escalamiento.TipoEscalamiento = 1; notificacionesDataAccess.SetData(escalamiento); } } if (elemento.UltimoEscalamiento == 1) { TiempoDeAtencionModel tiempoDeAtencion = CalculaTiempoAtencion(elemento.FechaRecepcion, elemento.HorasAtencion + elemento.HorasSegundoEscalamiento); if (!tiempoDeAtencion.EnTiempo) // Se verifica que la fecha actual sea mayor a la fecha maxima de entrega de correo { SegundoEscalamiento(elemento); escalamiento.TicketId = elemento.TicketId; escalamiento.FechaEscalamiento = DateTime.Now; escalamiento.TipoEscalamiento = 2; notificacionesDataAccess.SetData(escalamiento); } } } } catch (DataAccessException) { //throw new DataAccessException(e.ToString()); } catch (MailException) { //throw new MailException(e.ToString()); } catch (Exception) { //throw new Exception(e.ToString()); } }
public void SetData(EscalamientoModel escalamiento) { try { dataAccess.OpenConnection(); string queryFinal = ConstQuerys.SetReporte.Replace("{TI}, {FE}, {TE}", escalamiento.TicketId + " , " + "CONVERT(DATETIME,'" + escalamiento.FechaEscalamiento.ToString("yyyy/MM/dd HH:mm:mm.ss") + "', 120)" + " , " + escalamiento.TipoEscalamiento); //UPDATE DE ESCALAMIENTO dataAccess.ExecuteCommand(queryFinal); } catch (DataAccessException dal) { throw new DataAccessException("Error: ", dal); } catch (Exception e) { throw new DataAccessException("Error:::", e); } }