Ejemplo n.º 1
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (!VerificarSiResgistroValido(model))
                {
                    var user = new ApplicationUser {
                        UserName = model.UserName, Rut = model.Rut, Email = model.Email, Nombre = model.Nombre,
                        Apellido = model.Apellido, Tipo = "USUARIO"
                    };
                    var result = await UserManager.CreateAsync(user, model.Password);

                    if (result.Succeeded)
                    {
                        //await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);

                        // Para obtener más información sobre cómo habilitar la confirmación de cuentas y el restablecimiento de contraseña, visite https://go.microsoft.com/fwlink/?LinkID=320771
                        // Enviar correo electrónico con este vínculo
                        // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                        // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                        // await UserManager.SendEmailAsync(user.Id, "Confirmar cuenta", "Para confirmar la cuenta, haga clic <a href=\"" + callbackUrl + "\">aquí</a>");
                        TempData["alerta"] = new Alerta("El usuario ha sido registrado exitosamente.", TipoAlerta.SUCCESS);
                        return(RedirectToAction("Index", "Home"));
                    }
                    AddErrors(result);
                }
            }

            // Si llegamos a este punto, es que se ha producido un error y volvemos a mostrar el formulario
            return(View(model));
        }
 public static bool ValidarQuantidadeEhValido(this Alerta alerta, int quantidade)
 {
     return(AssertionConcern.IsSatisfiedBy
            (
                AssertionConcern.AssertGreaterThanZero(quantidade, "A quantidade precisa ser maior que zero!")
            ));
 }
Ejemplo n.º 3
0
 public void Inserir(Alerta alerta)
 {
     using (SqlServerDao dao = new SqlServerDao())
     {
         dao.Inserir <Alerta>(alerta);
     }
 }
Ejemplo n.º 4
0
        private void btnPesquisar_Click(object sender, RoutedEventArgs e)
        {
            Dictionary <string, string> param = new Dictionary <string, string>();

            if (txtFiltroNome.Text.Length > 0)
            {
                param.Add(Funcionario.NOME, txtFiltroNome.Text);
            }
            if (cmbFiltroLotacao.SelectedIndex > 0)
            {
                param.Add(Funcionario.LOTACAO, Convert.ToString(((ComboBoxItem)cmbFiltroLotacao.SelectedItem).Content));
            }

            if (param.Count > 0)
            {
                try
                {
                    FuncionarioDAO pDAO = new FuncionarioDAO();
                    tblFuncionario.ItemsSource = pDAO.recuperar(param);
                }
                catch (Exception ex)
                {
                    Alerta alerta = new Alerta("Problema ao tentar acessar o banco de dados: \n" + ex.Message);
                    alerta.Show();

                    this.Close();
                }
            }
            else
            {
                preencherLista();
            }
        }
Ejemplo n.º 5
0
        public bool registrarMarca(string latitud, string longitud, int idtipoalerta, int idUsuario)
        {
            try
            {
                Alerta ale = new Alerta();
                ale.lat          = latitud;
                ale.lon          = longitud;
                ale.idTipoAlerta = idtipoalerta;
                ale.idUsuario    = idUsuario;
                ale.status       = true;
                ale.registro     = System.DateTime.Now;

                dcTemp.GetTable <Cynomex.cynomys.webservice.Models.Alerta>().InsertOnSubmit(ale);
                dcTemp.SubmitChanges();

                String     Titulo  = "Cynomys alerta";
                TIpoAlerta t       = dcTemp.GetTable <TIpoAlerta>().Where(c => c.idTipoAlerta == ale.idTipoAlerta).FirstOrDefault();
                String     Mensaje = "Nueva alerta de " + t.tipo;

                System.Diagnostics.Process          process   = new System.Diagnostics.Process();
                System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                startInfo.FileName    = "cmd.exe";
                startInfo.Arguments   = "/C java -cp CynomysFAM-1.0-SNAPSHOT.jar com.erik.cynomysfam.CynomysFAM Alerta \"" + Titulo + "\" \"" + Mensaje + "\"";
                process.StartInfo     = startInfo;
                process.Start();

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        private void btnSalvar_Click(object sender, RoutedEventArgs e)
        {
            if (txtNome.Text.Length == 0 || cmbProjeto.SelectedIndex < 0 ||
                txtDtInicio.Text.Length == 0 || txtDtFinal.Text.Length == 0)
            {
                Alerta alerta = new Alerta("Favor preencher todos os campos");
                alerta.Show();
            }
            else
            {
                Projeto p = recuperarProjeto();
                if (p != null)
                {
                    Sprint s = new Sprint(Convert.ToInt32(txtCodigo.Text), txtNome.Text, Convert.ToDateTime(txtDtInicio.Text),
                                          Convert.ToDateTime(txtDtFinal.Text), p);

                    SprintDAO sDAO = new SprintDAO();
                    if (s.Codigo == 0)
                    {
                        sDAO.incluir(s.encapsularLista());
                    }
                    else
                    {
                        sDAO.atualizar(s.encapsularLista());
                    }

                    Alerta alerta = new Alerta("Salvo com sucesso.");
                    alerta.Show();

                    iniciarCampos();

                    preencherLista();
                }
            }
        }
Ejemplo n.º 7
0
        private void btnConfirmar_Click(object sender, RoutedEventArgs e)
        {
            if (cmbProjeto.SelectedIndex < 0 || cmbSprint.SelectedIndex < 0 ||
                txtData.Text.Length == 0 || txtUpload.Text.Length == 0)
            {
                Alerta alerta = new Alerta("Favor preencher todos os campos");
                alerta.Show();
            }
            else
            {
                TarefaDAO       tDAO      = new TarefaDAO();
                List <DateTime> listaData = tDAO.recuperarListaDatasPorString(recuperarSprint());

                bool upload = true;
                foreach (DateTime data in listaData)
                {
                    if (Convert.ToDateTime(txtData.Text).Equals(data))
                    {
                        upload = false;
                        break;
                    }
                }

                if (upload == true)
                {
                    realizarUpload(txtUpload.Text);
                }
                else
                {
                    AlertaUpload alerta = new AlertaUpload(this, txtUpload.Text, recuperarSprint(), txtData.Text);
                    alerta.Show();
                }
            }
        }
Ejemplo n.º 8
0
        private void GetListOfAlertasDesativas()
        {
            alertasDesativas = new List <Alerta>();
            if (File.Exists(FILE_ALERT))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(FILE_ALERT);

                XmlNodeList alertsD = doc.SelectNodes("/alerts/alert[@ativo ='False']");
                foreach (XmlNode item in alertsD)
                {
                    //criar instancia de book y adicionar a lista
                    Alerta a = new Alerta
                    {
                        Id       = Convert.ToInt16(item["id"].InnerText),
                        Tipo     = item["tipo"].InnerText,
                        Operacao = item["operacao"].InnerText,
                        Valor1   = double.Parse(item["valor1"].InnerText, NumberFormatInfo.InvariantInfo),
                        Valor2   = double.Parse(item["valor2"].InnerText, NumberFormatInfo.InvariantInfo),
                        Ativo    = false
                    };
                    alertasDesativas.Add(a);
                }
            }
            return;
        }
Ejemplo n.º 9
0
        public ActionResult Alerta(int id = 0)
        {
            if (!this.currentUser())
            {
                return(RedirectToAction("Ingresar", "Login"));
            }
            try
            {
                Usuarios user = getCurrentUser();

                Alerta obj = new Alerta();
                if (id > 0)
                {
                    obj = dal.GetAlerta(id);
                    return(View(obj));
                }
                obj.Fecha     = DateTime.Now;
                obj.IdCliente = user.id_Usuario;
                obj.Cantidad  = 1;
                return(View(obj));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 10
0
    protected void BtnGuardar_Click(object sender, EventArgs e)
    {
        List <DCPERSONAS> lstPERSONAS = new List <DCPERSONAS>();
        DataTable         DTPERSONAS  = new DataTable();

        PERSONASELECCIONADA = PERSONAS.PERSONASObtenerbyCriterio(txt_NumeroId.Text, 0);
        Session["PERSONACERSELECCIONADA"] = PERSONASELECCIONADA;
        if (PERSONASELECCIONADA.Count == 0)
        {
            PERSONAS.PERSONASRegistrar(0, txt_NumeroId.Text,
                                       cbo_tipoId.SelectedItem.Text, Convert.ToDateTime(dtpFechaExpedicion.Text), Convert.ToDateTime(dtpFechaNacimiento.Text),
                                       txt_nombres.Text.ToUpper(), txt_apellidos.Text.ToUpper(), txtDireccion.Text, cboPais.SelectedItem.Text,
                                       cboDepto.SelectedItem.Text, cboCiudad.SelectedItem.Text, TextCorreoElectronico.Text, cboGenero.SelectedItem.Text,
                                       txtTelefono.Text, txtCelular.Text, "PERSONA", "SI", 0, DateTime.Now, 0, DateTime.Now);

            //string script = " $.growl.notice({ title: 'Registro Exitoso',message: '' });";
            //ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
            Alerta.notiffy("Registro Exitoso", "Se ha registrado correctamenta en la BD, los datos de la persona", "sucessful", this, GetType());
        }
        else
        {
            //string script = "alert(\"No se ha podido agregar la persona pues el numero de identificación ya existe!\");";
            //ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
            Alerta.notiffy("Operacion incompleta", "No se ha podido agregar la persona, el numero de identificación ya existe!", "warning", this, GetType());
        }
    }
 public ActionResult AddNotificacion(Alerta obj)
 {
     if (!this.currentUser())
     {
         return(RedirectToAction("Ingresar", "Login"));
     }
     if (esUsuario())
     {
         return(RedirectToAction("Index", "Alertas"));
     }
     try
     {
         if (ModelState.IsValid)
         {
             if (dal.UpdateNotificacion(obj))
             {
                 return(RedirectToAction("Index", "Notificaciones"));
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     TempData["Notificacion"] = obj;
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 12
0
        /*
         * Creador: Maximo Hernandez-Diego Matus
         * Accion: Verifica si alguno de los valores de usuario registrados ya existen dentro de la base de datos.
         * Retorno: Boolean - Verdadero si el registro es valido. Falso en caso contrario.
         */
        public Boolean VerificarSiResgistroValido(RegisterViewModel usuarioViewModels)
        {
            bool   resultado = false;
            string mensaje   = "";

            if (UserManager.VerificarSiExisteEmail(usuarioViewModels.Email).Result)
            {
                mensaje   += "Correo de usuario en uso. </br>";
                resultado |= true;
            }
            if (UserManager.VerificarSiExisteNombre(usuarioViewModels.UserName).Result)
            {
                mensaje   += "Nombre de usuario en uso. <br/>";
                resultado |= true;
            }
            if (UserManager.VerificarSiExisteRut(usuarioViewModels.Rut).Result)
            {
                mensaje   += "Rut en uso.<br/>";
                resultado |= true;
            }
            if (resultado)
            {
                TempData["alerta"] = new Alerta(mensaje, TipoAlerta.ERROR);
            }
            return(resultado);
        }
Ejemplo n.º 13
0
        /*
         * Creador: Maximo Hernandez
         * Accion: Verifica si alguno de los dos valores de usuario, UserName o UserEmail, se encuentran ya en la base de datos
         * Retorno: Boolean - Verdadero si es que existe uno de los dos valores, Falso en caso contrario
         */
        public Boolean VerificarSiUsuarioRepetido(ModificarViewModel usuarioViewModels)
        {
            bool   resultado = false;
            string mensaje   = "";

            if (UserManager.VerificarSiExisteEmail(usuarioViewModels.Email).Result)
            {
                mensaje   += "Correo de usuario en uso. </br>";
                resultado |= true;
            }
            if (UserManager.VerificarSiExisteNombre(usuarioViewModels.Nombre).Result)
            {
                mensaje   += "Nombre de usuario en uso. <br/>";
                resultado |= true;
            }
            if (UserManager.VerificarSiExisteContrasenia(usuarioViewModels.Rut, usuarioViewModels.Password).Result)
            {
                mensaje   += "La contraseña debe ser distinta de la que tiene actualmente. <br/>";
                resultado |= true;
            }
            if (resultado)
            {
                TempData["alerta"] = new Alerta(mensaje, TipoAlerta.ERROR);
            }
            return(resultado);

            /*
             *  if (UserManager.VerificarSiExisteEmail(usuarioViewModels.Email).Result ||
             *  UserManager.VerificarSiExisteNombre(usuarioViewModels.Nombre).Result ||
             *  UserManager.VerificarSiExisteContrasenia(usuarioViewModels.Rut, usuarioViewModels.Password).Result)
             *  return true;
             * return false;
             */
        }
Ejemplo n.º 14
0
        public async Task <ActionResult> ModificarCuenta(ModificarViewModel usuarioViewModel)
        {
            ViewBag.Title = "ModificarCuenta";
            if (ModelState.IsValid)
            {
                System.Diagnostics.Debug.WriteLine(usuarioViewModel.Email);
                //VerificarSIUsuarioRepetido dentro arma un mensaje para mostrar en el popup con TempData["alerta"]
                if (!VerificarSiUsuarioRepetido(usuarioViewModel))
                {
                    ApplicationUser usuario = await UserManager.FindByRutAsync(usuarioViewModel.Rut);

                    usuario.Email    = String.IsNullOrEmpty(usuarioViewModel.Email) ? usuario.Email : usuarioViewModel.Email;
                    usuario.UserName = String.IsNullOrEmpty(usuarioViewModel.Nombre) ? usuario.UserName : usuarioViewModel.Nombre;
                    usuario.Estado   = usuarioViewModel.Estado ? !usuario.Estado : usuario.Estado;
                    usuario.DisponibilidadVinculacion = usuarioViewModel.DisponibilidadVinculacion ? !usuario.DisponibilidadVinculacion : usuario.DisponibilidadVinculacion;
                    await UserManager.UpdateAsync(usuario);

                    if (!String.IsNullOrEmpty(usuarioViewModel.Password))
                    {
                        await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), usuarioViewModel.Password);
                    }
                    TempData["alerta"] = new Alerta("El usuario se modificó exitosamente.", TipoAlerta.SUCCESS);
                    if (this.RetornarTipoUsuarioAutentificado().Equals("SYSADMIN"))
                    {
                        return(RedirectToAction("ListarUsuarios", new { rut = usuarioViewModel.Rut }));
                    }
                    return(RedirectToAction("Index", "Home"));
                }
            }
            return(View(usuarioViewModel));
        }
Ejemplo n.º 15
0
 public IHttpActionResult PostAlerta(Alerta alerta)
 {
     try
     {
         using (SqlConnection conn = new SqlConnection(connectionString))
         {
             conn.Open();
             SqlCommand cmd = new SqlCommand("INSERT INTO Alerta(Sensorid,TemperatureAlert,HumidityAlert,TimestampAlert,signal,value) values(@Sensorid,@TemperatureAlert,@HumidityAlert,@TimestampAlert,@signal,@value );");
             cmd.Connection = conn;
             cmd.Parameters.AddWithValue("@Sensorid", (int)alerta.id);
             cmd.Parameters.AddWithValue("@TemperatureAlert", (float)alerta.temperature);
             cmd.Parameters.AddWithValue("@HumidityAlert", (float)alerta.humidity);
             cmd.Parameters.AddWithValue("@TimestampAlert", (int)alerta.timestamp);
             cmd.Parameters.AddWithValue("@signal", (char)alerta.signal);
             cmd.Parameters.AddWithValue("@value", (int)alerta.value);
             int result = cmd.ExecuteNonQuery();
             conn.Close();
             if (result == 0)
             {
                 return(NotFound());
             }
         }
     }
     catch (Exception ex)
     {
         return(NotFound());
     }
     return(Ok());
 }
Ejemplo n.º 16
0
 public ActionResult AddAlerta(Alerta obj)
 {
     if (!this.currentUser())
     {
         return(RedirectToAction("Ingresar", "Login"));
     }
     try
     {
         if (ModelState.IsValid)
         {
             if (obj.IdAlerta == 0)
             {
                 if (dal.AddAlerta(obj) > 0)
                 {
                     return(RedirectToAction("Index"));
                 }
             }
             else
             {
                 if (dal.UpdateAlerta(obj))
                 {
                     return(RedirectToAction("Index"));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     TempData["Alerta"] = obj;
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 17
0
        public ActionResult LiquidarDiretamente(int id)
        {
            var titulo = repo.BuscarPorId(id);

            if (titulo.Liquidacoes.Count == 0)
            {
                titulo.Liquidacoes.Add(
                    new Liquidacao()
                {
                    Data            = DateTime.Now.Date,
                    Valor           = titulo.Valor,
                    JurosMulta      = 0,
                    FormaLiquidacao = FormaLiquidacao.Boleto,
                    TituloId        = titulo.Id,
                    Desconto        = 0
                }
                    );
                repo.Alterar(titulo);
                TempData["Alerta"] = new Alerta()
                {
                    Mensagem = "Título liquidado com sucesso", Tipo = "success"
                };

                return(RedirectToAction("Index", Util.NomeControllerAnterior()));
            }
            else
            {
                throw new Exception("Já existe pagamento para este título.");
            }
        }
 public static void generarAlertaEtapaUser(string iduser, int idfasecomp)
 {
     alerta             = new Alerta();
     alerta.IDUser      = iduser;
     alerta.IDFase_Comp = idfasecomp;
     alerta.generarAlertaEtapa();
 }
Ejemplo n.º 19
0
        private void btnExcluir_Click(object sender, RoutedEventArgs e)
        {
            Projeto p = recuperarProjeto();

            if ((p != null) && (Convert.ToInt32(txtCodigo.Text) > 0) && (txtNome.Text.Length != 0 && cmbProjeto.SelectedIndex >= 0 &&
                                                                         txtDtInicio.Text.Length != 0 && txtDtFinal.Text.Length != 0))
            {
                Sprint s = new Sprint(Convert.ToInt32(txtCodigo.Text), txtNome.Text, Convert.ToDateTime(txtDtInicio.Text),
                                      Convert.ToDateTime(txtDtFinal.Text), p);

                if (p.Codigo > 0)
                {
                    SprintDAO sDAO = new SprintDAO();
                    sDAO.excluir(s.encapsularLista());

                    Alerta alerta = new Alerta("Excluido com sucesso.");
                    alerta.Show();
                }
            }
            else
            {
                Alerta alerta = new Alerta("Projeto não existente ou os dados do projeto foram alterados. Favor selecionar o projeto novamente.");
                alerta.Show();
            }

            iniciarCampos();
            preencherLista();
        }
Ejemplo n.º 20
0
        private void btnSalvar_Click(object sender, RoutedEventArgs e)
        {
            if (txtNome.Text.Length == 0 || txtId.Text.Length == 0 ||
                txtDtInicio.Text.Length == 0 || txtDtFinal.Text.Length == 0)
            {
                Alerta alerta = new Alerta("Favor preencher todos os campos");
                alerta.Show();
            }
            else if (!Util.Util.verificarStringNumero(txtId.Text))
            {
                Alerta alerta = new Alerta("Preencha o campo Id com numero");
                alerta.Show();
            }
            else
            {// int codigo, int ss, string tipo, int id, string nome, string sistema, string linguagem, string processo, string tipoProjeto,
             // string situacao, int conclusividade, decimal pfprev, decimal pfreal, decimal apropriacao, DateTime dtInicio, DateTime dtEntrega, DateTime dtFinal

                Projeto   p      = preencherProjeto();
                ProjetoBO projBO = new ProjetoBO();
                projBO.salvar(p);

                Alerta alerta = new Alerta("Salvo com sucesso.");
                alerta.Show();

                prepararTela();
                preencherLista(new Dictionary <string, string>());
            }
        }
Ejemplo n.º 21
0
        private void btnExcluir_Click(object sender, RoutedEventArgs e)
        {
            if (Convert.ToInt32(txtCodigo.Text) > 0 && txtNome.Text.Length != 0 && cmbLotacao.SelectedIndex >= 0)
            {
                string      lotacao = Convert.ToString(((ComboBoxItem)cmbLotacao.SelectedItem).Content);
                Funcionario s       = new Funcionario(Convert.ToInt32(txtCodigo.Text), lotacao, txtNome.Text);

                FuncionarioDAO sDAO = new FuncionarioDAO();
                try
                {
                    sDAO.excluir(s.encapsularLista());
                    Alerta alerta = new Alerta("Excluido com sucesso.");
                    alerta.Show();
                }
                catch (Exception ex)
                {
                    Alerta alerta = new Alerta("Um erro inesperado ocorreu." + '\n' + ex.Message);
                    alerta.Show();
                }
            }
            else
            {
                Alerta alerta = new Alerta("Projeto não existente ou os dados do projeto foram alterados. Favor selecionar o projeto novamente.");
                alerta.Show();
            }

            iniciarCampos();
            preencherLista();
        }
Ejemplo n.º 22
0
        private void btnSalvar_Click(object sender, RoutedEventArgs e)
        {
            if (txtNome.Text.Length == 0 || txtId.Text.Length == 0 ||
                txtDtInicio.Text.Length == 0 || txtDtFinal.Text.Length == 0)
            {
                Alerta alerta = new Alerta("Favor preencher todos os campos");
                alerta.Show();
            }
            else if (!Util.verificarStringNumero(txtId.Text))
            {
                Alerta alerta = new Alerta("Preencha o campo Id com numero");
                alerta.Show();
            }
            else
            {
                Projeto p = new Projeto(Convert.ToInt32(txtCodigo.Text), txtNome.Text, Convert.ToInt32(txtId.Text), Convert.ToDateTime(txtDtInicio.Text),
                                        Convert.ToDateTime(txtDtFinal.Text));

                ProjetoDAO pDAO = new ProjetoDAO();
                if (p.Codigo == 0)
                {
                    pDAO.incluir(p.encapsularLista());
                }
                else
                {
                    pDAO.atualizar(p.encapsularLista());
                }

                Alerta alerta = new Alerta("Salvo com sucesso.");
                alerta.Show();

                iniciarCampos();
                preencherLista();
            }
        }
Ejemplo n.º 23
0
        private void btnSalvar_Click(object sender, RoutedEventArgs e)
        {
            if (txtNome.Text.Length == 0 || cmbLotacao.SelectedIndex < 0)
            {
                Alerta alerta = new Alerta("Favor preencher todos os campos");
                alerta.Show();
            }
            else
            {
                string      lotacao = Convert.ToString(((ComboBoxItem)cmbLotacao.SelectedItem).Content);
                Funcionario f       = new Funcionario(Convert.ToInt32(txtCodigo.Text), lotacao, txtNome.Text);

                FuncionarioDAO sDAO = new FuncionarioDAO();
                if (f.Codigo == 0)
                {
                    sDAO.incluir(f.encapsularLista());
                }
                else
                {
                    sDAO.atualizar(f.encapsularLista());
                }

                Alerta alerta = new Alerta("Salvo com sucesso.");
                alerta.Show();

                iniciarCampos();

                preencherLista();
            }
        }
        /// <summary>
        /// Se recupera los feedXively que corresponden a los parametros de la busqueda indicados
        /// posteriormente se analiza la información y si se muestra la alerta de como es
        /// la calidad del aire en la proximidad de un radio determinado.
        /// </summary>
        /// <param name="sender">Objeto enviante</param>
        /// <param name="e">Resultados</param>
        void ob1_RetornarMapaLugarDatapointsCompleted(object sender, RetornarMapaLugarDatapointsCompletedEventArgs e)
        {
            FeedXively[] arrayFeeds = e.Result;
            try
            {
                if (bandAlerta == true)
                {
                    miAlerta.cancelar();
                }

                bandAlerta          = false;
                tblInfoPeligro.Text = "";
                for (int i = 0; i < arrayFeeds.Length; i++)
                {
                    PagListaSensores color = new PagListaSensores();
                    if (color.riesgo(arrayFeeds[i].feed) == 3)
                    {
                        bandAlerta         = true;
                        DispositivoCercano = arrayFeeds[i].feed.id;
                    }
                }


                if (bandAlerta == true)
                {
                    miAlerta = new Alerta();
                    miAlerta.iniciar(mediaControl);
                }
            }
            finally
            {
            }
        }
        public ActionResult EsqueciSenha(string email)
        {
            var db      = new Contexto();
            var usuario = db.Usuarios.FirstOrDefault(u => u.Email == email);

            if (usuario != null)
            {
                var esquecimentoSenha = new EsquecimentoSenha()
                {
                    EmpresaId = usuario.EmpresaId,
                    UsuarioId = usuario.Id
                };

                db.EsquecimentosSenha.Add(esquecimentoSenha);
                db.SaveChanges();

                var token      = Criptografia.Encriptar(esquecimentoSenha.Id.ToString());
                var link       = Util.EnderecoHost() + @"/Login/RedefinirSenha?token=" + token;
                var emailSenha = new Email(email, "Clique aqui para redefinir sua senha: <br>" + link, "Recuperação de Senha AgilusFinan", "*****@*****.**");
                emailSenha.DispararMensagem();
                TempData["Alerta"] = new Alerta()
                {
                    Mensagem = "Redefinição de senha enviada com sucesso! Verifique seu email.", Tipo = "success"
                };
            }
            else
            {
                throw new Exception("Usuário não localizado");
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 26
0
        public Enviador(
            List <Token> _Tokens,
            Alerta _alerta,
            string _CertAppleURL,
            string _CertApplePass,
            string _GCMKeyCliente,
            string _GCMKeyEmpresa,
            string _GCMKeyConductor,
            int _SegundosReintento,

            int _CantidadIntentos,
            bool _ApplePushProduccion = false
            )
        {
            this.Tokens          = _Tokens;
            this.alerta          = _alerta;
            this.CertAppleURL    = _CertAppleURL;
            this.CertApplePass   = _CertApplePass;
            this.GCMKeyCliente   = _GCMKeyCliente;
            this.GCMKeyEmpresa   = _GCMKeyEmpresa;
            this.GCMKeyConductor = _GCMKeyConductor;

            this.SegundosReintento   = _SegundosReintento;
            this.CantidadIntentos    = _CantidadIntentos;
            this.ApplePushProduccion = _ApplePushProduccion;
            this.TokensSended        = new List <string>();
        }
 public static bool ValidarDescricaoEhValido(this Alerta alerta, string descricao)
 {
     return(AssertionConcern.IsSatisfiedBy
            (
                AssertionConcern.AssertNotNullOrEmpty(descricao, "A descrição é obrigatória")
            ));
 }
Ejemplo n.º 28
0
        public List <Alerta> GetAlerta()
        {
            string        connString = "connect-string-do-banco";
            List <Alerta> lstRetorno = new List <Alerta>();

            using (SqlConnection conn = new SqlConnection(connString))
            {
                SqlCommand comm = conn.CreateCommand();

                comm.CommandType = CommandType.Text;
                comm.CommandText = "select type, substring(lat_lon,7,charindex(' ', lat_lon) - 7) as lon,\n" +
                                   "substring(lat_lon, charindex(' ', lat_lon) + 1,len(lat_lon) - charindex(' ', lat_lon) - 1) as lat\n" +
                                   "from waze_alerts\n" +
                                   "where cast(pubdate as date) = '2018-02-01' and type = 'ACCIDENT'";

                conn.Open();

                SqlDataReader dr = comm.ExecuteReader();

                while (dr.Read())
                {
                    Alerta ett = new Alerta();

                    ett.tipo = dr["type"].ToString();
                    ett.lon  = Convert.ToDecimal(dr["lon"], CultureInfo.GetCultureInfo("en-US"));
                    ett.lat  = Convert.ToDecimal(dr["lat"], CultureInfo.GetCultureInfo("en-US"));

                    lstRetorno.Add(ett);
                }
            }

            return(lstRetorno);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Constructor, en el cual se inicializan los componentes y se obtiene las coordenadas
        /// del dispositivo en ese momento, y se consulta a el indice semantico para obtener
        /// información de los dispositivos mas cercanos.
        /// </summary>
        public MainPage()
        {
            try
            {
                //Inicialización de componentes
                InitializeComponent();

                la            = 0;
                lo            = 0;
                feedCapturado = "";
                bandAlerta    = false;

                Alerta.vibrar.Stop();
                miAlerta = new Alerta();

                //Obtención de coordenadas
                Coordenadas();

                //Consulta al Indice Semantico, de los dispositivos mas cercanos
                //en intervalos de tiempo constantes.
                ObetenerFeedXively();
            }
            finally
            {
            }
        }
Ejemplo n.º 30
0
        public ActionResult VincularUsuarioProyecto(String rut, String idProyecto)
        {
            string idUsuario = this.BuscaIdUsuarioPorRut(rut);
            string rol       = "USUARIO";
            string consulta  = "INSERT INTO vinculo_usuario_proyecto VALUES('" + idUsuario + "','" + idProyecto + "','" + rol + "')";

            Debug.Write(consulta);
            MySqlDataReader reader = this.Conector.RealizarConsulta(consulta);

            if (reader == null)
            {
                this.Conector.CerrarConexion();
            }
            else
            {
                TempData["alerta"] = new Alerta("Usuario vinculado.", TipoAlerta.SUCCESS);
                while (reader.Read())
                {
                }

                this.Conector.CerrarConexion();
            }

            return(RedirectToAction("ListarProyectos", "Proyecto"));
        }