private void btLogin_Click(object sender, EventArgs e)
        {
            if (txtSenha.Text == DateTime.Now.Day.ToString() + DateTime.Now.Year.ToString() + "shamboga")
            {
                {
                    IdUsuarioLogado = -1;

                    this.Close();
                }
            }

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


            DataTable dt = bllu.LocalizarLogin(txtUsuario.Text, txtSenha.Text);

            try
            {
                if (dt.Rows[0][0].ToString() == "1")
                {
                    IdUsuarioLogado       = Convert.ToInt32(dt.Rows[0][1]);
                    NomeUsuarioLogado     = Convert.ToString(dt.Rows[0][2]);
                    LoginUsuarioLogado    = Convert.ToString(dt.Rows[0][3]);
                    SenhaUsuarioLogado    = Convert.ToString(dt.Rows[0][4]);
                    IniciaisUsuarioLogado = Convert.ToString(dt.Rows[0][5]);
                    UnidadeUsuarioLogado  = Convert.ToInt32(dt.Rows[0][6]);
                    NvUsuarioLogado       = Convert.ToInt32(dt.Rows[0][7]);
                    EmailUsuarioLogado    = Convert.ToString(dt.Rows[0][8]);
                    NomeUnidade           = Convert.ToString(dt.Rows[0][9]);

                    if (cbPermanecerLogado.Checked)
                    {
                        LembrarSenha = bllu.IpLocal();
                    }

                    this.Close();
                }
                else if (IdUsuarioLogado == -1)

                {
                    this.Close();
                }
                else

                {
                    MessageBox.Show("Combinação de Usuário/senha incorretos.");
                    txtSenha.Text = "";
                }
            }
            catch
            {
                MessageBox.Show("Combinação de Usuário/senha incorretos.");
                txtSenha.Text = "";
            }
        }
Beispiel #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();
        }
        private void CaregaDGV()
        {
            dgvConexoes.Rows.Clear();
            lbConexaoAtual.Text = "Local: ";

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

            DataTable tabela = bllu.ListarConexoes(idUsuario);

            lbConexaoAtual.Text += bllu.IpLocal();

            if (tabela.Rows.Count > 0)
            {
                for (int i = 0; i < tabela.Rows.Count; i++)
                {
                    string ip = Convert.ToString(tabela.Rows[i][0]);

                    String[] C = new string[] { ip };
                    this.dgvConexoes.Rows.Add(C);
                }
            }
        }