Esempio n. 1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            String nBomb;

            nBomb = dGVBomb.SelectedRows[0].Cells[5].FormattedValue.ToString();
            FichaBombeiro f = new FichaBombeiro(nBomb);

            f.Show();
        }
Esempio n. 2
0
 private void btnBomb_Click(object sender, EventArgs e)
 {
     if (t.ToUpper() == "B" || t.ToUpper() == "O")
     {
         bool open = false;
         foreach (Form form in Application.OpenForms)
         {
             if (form == f)
             {
                 open = true;
             }
         }
         if (!open)
         {
             f = new FichaBombeiro(numB);
             f.Show();
         }
         else
         {
             f.Focus();
         }
     }
     else
     {
         bool open = false;
         foreach (Form f in Application.OpenForms)
         {
             if (f == vb)
             {
                 open = true;
             }
         }
         if (!open)
         {
             vb = new VerBombeiro();
             vb.Show();
         }
         else
         {
             vb.Focus();
         }
     }
 }
Esempio n. 3
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(connectionString);
            SqlCommand    cmd = con.CreateCommand();
            SqlDataReader reader;

            String user = "", password = "", tipo = "", numeroB = "", login = "";

            user     = txtUser.Text;
            password = txtPass.Text;
            con.Open();

            cmd.CommandText = "SELECT bombeiro_num_bombeiro,tipo,login FROM utilizador WHERE username='******' AND password='******'";
            reader          = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                reader.Read();
                tipo  = reader["tipo"].ToString();
                t     = tipo;
                numB  = numeroB = reader["bombeiro_num_bombeiro"].ToString();
                login = reader["login"].ToString();
            }
            else
            {
                MessageBox.Show("Esse Username ou Password está incorrecto!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            reader.Close();
            if (numeroB != "" && login == "0")
            {
                con.Close();
                FichaBombeiro f = new FichaBombeiro(numeroB, true);
                f.Show();
                this.Hide();
            }



            if (tipo != "")
            {
                btnOc.Show();
                btnAgend.Show();
                btnViat.Show();
                btnInsCodOco.Show();
                btnEquipas.Show();
                btnInsConcFreg.Show();
                btnOc.Show();
                btnViat.Show();
                btnAgend.Show();
                pnlLogin.Visible = false;
                pnlMenu.Visible  = true;
                Text             = "Home";
                txtPass.Text     = "";
                txtUser.Text     = "";
                if (tipo.ToLower() == "b")
                {
                    btnInsCodOco.Visible = false;
                    btnEquipas.Hide();
                    btnInsConcFreg.Hide();
                    btnOc.Hide();
                    btnViat.Hide();
                    btnAgend.Hide();
                    btnFaltas.Hide();
                }
                else if (tipo.ToLower() == "o")
                {
                    btnFaltas.Hide();
                }
            }
            con.Close();
        }