Пример #1
0
        private void dgvConexoes_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {
                DALConexao cx     = new DALConexao(DadosDaConexao.StringDaConexao);
                BLLLog     blllog = new BLLLog(cx);
                blllog.Excluir(idUsuario, dgvConexoes.Rows[e.RowIndex].Cells[0].Value.ToString());

                CaregaDGV();
            }
        }
Пример #2
0
        private void LogoffToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Text = "Soluções DaDo Bier";

            this.BloqueioTela(0);

            lbUsuarioLogado.Text = "Usuario";

            DALConexao cx     = new DALConexao(DadosDaConexao.StringDaConexao);
            BLLUsuario bllu   = new BLLUsuario(cx);
            BLLLog     blllog = new BLLLog(cx);

            blllog.Excluir(Convert.ToInt32(txtId.Text), bllu.IpLocal());

            this.Loga();
        }
Пример #3
0
        private void Loga()
        {
            this.BloqueioTela(Convert.ToInt32(0));
            frmLogin log = new frmLogin();

            log.ShowDialog();
            log.Dispose();


            int idusuario = 0;
            int idunidade = 0;
            int nvusuario = 0;

            try
            {
                idusuario = Convert.ToInt32(log.IdUsuarioLogado);
            }
            catch { }

            try
            {
                idunidade = Convert.ToInt32(log.UnidadeUsuarioLogado);
            }
            catch { }

            try
            {
                nvusuario = Convert.ToInt32(log.NvUsuarioLogado);
            }
            catch { }

            if (idusuario.ToString() != "")
            {
                #region Se Login Adm
                if (log.IdUsuarioLogado == -1)
                {
                    txtId.Text          = idusuario.ToString();
                    txtUsuario.Text     = "Administrador";
                    txtLogin.Text       = "Admin";
                    txtSenha.Text       = "";
                    txtIniciais.Text    = "Adm";
                    txtUnidade.Text     = "99";
                    txtPermissao.Text   = "4";
                    txtEmail.Text       = "";
                    txtNomeUnidade.Text = "Admin";

                    this.PreencheCampos();
                }

                #endregion

                #region Se login normal

                else
                {
                    txtId.Text          = idusuario.ToString();
                    txtUsuario.Text     = log.NomeUsuarioLogado.ToString();
                    txtLogin.Text       = log.LoginUsuarioLogado.ToString();
                    txtSenha.Text       = log.SenhaUsuarioLogado.ToString();
                    txtIniciais.Text    = log.IniciaisUsuarioLogado.ToString();
                    txtUnidade.Text     = idunidade.ToString();
                    txtPermissao.Text   = nvusuario.ToString();
                    txtEmail.Text       = log.EmailUsuarioLogado.ToString();
                    txtNomeUnidade.Text = log.NomeUnidade.ToString();

                    this.PreencheCampos();

                    //Se login automático salva ip
                    DTOLog     dtolog = new DTOLog();
                    DALConexao cx     = new DALConexao(DadosDaConexao.StringDaConexao);
                    BLLLog     blllog = new BLLLog(cx);

                    if (log.LembrarSenha != "")
                    {
                        try
                        {
                            try
                            {
                                blllog.Excluir(Convert.ToInt32(txtId.Text), log.LembrarSenha);
                            }
                            catch
                            {}
                            finally
                            {
                                dtolog.IdUsuario = Convert.ToInt32(txtId.Text);
                                dtolog.CodLog    = log.LembrarSenha;
                                blllog.Incluir(dtolog);
                            }
                        }
                        catch
                        {
                            MessageBox.Show("Erro ao salvar suas credenciais.");
                        }
                    }
                }
                #endregion

                log = null;
            }
        }