Esempio n. 1
0
        public ActionResult DeleteConfirmed(decimal id)
        {
            ALERTAS aLERTAS = db.ALERTAS.Find(id);

            db.ALERTAS.Remove(aLERTAS);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        /// <summary>
        /// Metodo que sirve para Enviar una Alerta
        /// </summary>
        /// <param name="pAlerta"></param>
        /// <returns></returns>
        public RespuestaAlertaEntidad EnviarAlerta <T>(ALERTAS alerta, T Object)
        {
            AlertaEntidadLogicaNegocio        bl    = new AlertaEntidadLogicaNegocio();
            MessageTokenProviderLogicaNegocio tkn   = new MessageTokenProviderLogicaNegocio();
            CuentaEmailLogicaNegocio          ctabl = new CuentaEmailLogicaNegocio();
            string CorreoDestino = "";
            string NombreDestino = "";
            var    tokens        = new List <Token>();
            var    respuesta     = new RespuestaAlertaEntidad();

            try
            {
                respuesta = bl.ObtenerAlertaEntidad(new AlertaEntidad()
                {
                    CodigoAlerta = alerta.ToString()
                });
                CuentaEmail cta = ctabl.ObtenerCuentaEmail(new CuentaEmail()
                {
                    Id = respuesta.AlertaEntidad.IdCuenta
                }).CuentaEmail;
                switch (alerta)
                {
                /***********************************************************************************************/
                /********************            Alertas de Usuario                *****************************/
                /***********************************************************************************************/
                case ALERTAS.NewPassUser:
                case ALERTAS.ForgoutPass:
                case ALERTAS.LockedUser:
                case ALERTAS.WrongPass:
                    Usuario usuario = (Usuario)Convert.ChangeType(Object, typeof(Usuario));

                    UsuarioLogicaNegocio ubl = new UsuarioLogicaNegocio();
                    usuario       = ubl.ObtenerUsuario(usuario).Usuario;
                    tokens        = tkn.AddUsuarioTokens(tokens, usuario);
                    CorreoDestino = usuario.CorreoElectronico;
                    NombreDestino = usuario.Nombre;
                    break;
                }
                string subject = Tokenizador(respuesta.AlertaEntidad.Titulo, tokens, false);
                string body    = Tokenizador(respuesta.AlertaEntidad.HtmlContent, tokens, true);

                SendEmail(cta, subject, body, cta.CorreoElectronico, cta.Alias,
                          CorreoDestino, NombreDestino, null, null, null, null, null, null, 0, null);

                return(respuesta);
            }
            catch (Exception ex)
            {
                ControlExcepciones.ControlExcepciones.ManejoExcepciones(ex, alerta);

                BitacoraLogicaNegocios.RegistrarBitacora(MENSAJES_SISTEMA.ErrorExcepcion,
                                                         TraceData.Utilities.Enums.TypeTrace.Exception, ex, MethodBase.GetCurrentMethod().Name);

                return(new RespuestaAlertaEntidad {
                    Respuesta = new Respuesta(TipoRespuesta.Excepcion, ex.Message, Respuesta.CodNoValido)
                });
            }
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "ID_ALERTA,SONIDO_ALERTA,COLOR_ALERTA,MAIL_ALERTA")] ALERTAS aLERTAS)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aLERTAS).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aLERTAS));
 }
Esempio n. 4
0
        public ActionResult Create([Bind(Include = "ID_ALERTA,SONIDO_ALERTA,COLOR_ALERTA,MAIL_ALERTA")] ALERTAS aLERTAS)
        {
            if (ModelState.IsValid)
            {
                db.ALERTAS.Add(aLERTAS);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aLERTAS));
        }
Esempio n. 5
0
        // GET: ALERTAS/Delete/5
        public ActionResult Delete(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ALERTAS aLERTAS = db.ALERTAS.Find(id);

            if (aLERTAS == null)
            {
                return(HttpNotFound());
            }
            return(View(aLERTAS));
        }