コード例 #1
0
        private void CarregarAssociado(int codigo)
        {
            try
            {
                SqlConnection con = new SqlConnection(conexao.RecuperaCNN());
                SqlCommand    cmd = new SqlCommand(preparasql.ConsultaAssociado(codigo), con);

                con.Open();
                using (SqlDataReader leitor = cmd.ExecuteReader())
                {
                    while (leitor.Read())
                    {
                        txtNome.Text = leitor["nomeASS"].ToString();
                        mskCPF.Text  = leitor["cpfASS"].ToString();
                        mskRG.Text   = leitor["rgASS"].ToString();
                        lblFoto.Text = leitor["imgASS"].ToString();

                        if (lblFoto.Text != "Foto")
                        {
                            pictureFoto.Image = Image.FromFile(lblFoto.Text);
                        }
                    }
                    leitor.Close();
                }

                con.Close();
            }



            catch
            {
                MessageBox.Show("Erro ao carregar o associado", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        public void CarregarPerfil()
        {
            try
            {
                cmbLogin.Items.Clear();
                RecuperaConexao conexao = new RecuperaConexao();
                PreparaSQL      usuario = new PreparaSQL();

                SqlConnection con = new SqlConnection(conexao.RecuperaCNN());
                SqlCommand    cmd = new SqlCommand(usuario.ConsultaUsuFUNC(), con);

                con.Open();
                using (SqlDataReader leitor = cmd.ExecuteReader())
                {
                    while (leitor.Read())
                    {
                        cmbLogin.Items.Add(leitor["PerfilUsu"].ToString());
                    }
                    leitor.Close();
                }

                con.Close();
            }
            catch
            {
                MessageBox.Show("Erro ao carregar os usuários", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        private void cmbLogin_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                cmbLogin.Items.Clear();
                SqlConnection con = new SqlConnection(conexao.RecuperaCNN());
                SqlCommand    cmd = new SqlCommand(usuario.ConsultaUsuario(), con);

                con.Open();
                using (SqlDataReader leitor = cmd.ExecuteReader())
                {
                    while (leitor.Read())
                    {
                        cmbLogin.Items.Add(leitor["loginUSU"].ToString());
                    }
                    leitor.Close();
                }

                con.Close();
            }
            catch
            {
                MessageBox.Show("Erro ao conectar à base de dados", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
ファイル: FrmOBS.cs プロジェクト: EDockhorn/ONGIR
        private bool RecarregaINFO()
        {
            try
            {
                SqlConnection con = new SqlConnection(conexao.RecuperaCNN());
                SqlCommand    cmd = new SqlCommand(preparasql.ConsultaINFOR(ID, perfil), con);



                con.Open();
                using (SqlDataReader leitor = cmd.ExecuteReader())
                {
                    while (leitor.Read())
                    {
                        txtOBS.Text = leitor["infoSER"].ToString();
                        tem         = true;
                    }
                    leitor.Close();
                }
                con.Close();
                return(tem);
            }
            catch
            {
                MessageBox.Show("Erro ao conectar à base de dados", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(tem);
            }
        }
コード例 #5
0
        public void CarregarReservas(int IDReserva)
        {
            try
            {
                SqlConnection con = new SqlConnection(conexao.RecuperaCNN());
                SqlCommand    cmd = new SqlCommand(preparasql.ConsultaInfoRESERVAS(IDReserva), con);

                con.Open();
                using (SqlDataReader leitor = cmd.ExecuteReader())
                {
                    while (leitor.Read())
                    {
                        // cliRES,veicRES,funcRES,imgVEIC
                        // dataRES,datadevolucaoRES,valordiariaRES,protocoloRES
                        intReserva   = int.Parse(leitor["codRES"].ToString());
                        intCli       = int.Parse(leitor["cliRES"].ToString());
                        intVeic      = int.Parse(leitor["veicRES"].ToString());
                        intFunc      = int.Parse(leitor["funcRES"].ToString());
                        lblFoto.Text = leitor["imgVEIC"].ToString();

                        mskDataReserva.Text = leitor["dataRES"].ToString();
                        mskDataDevolu.Text  = leitor["datadevolucaoRES"].ToString();
                        txtValorDiaria.Text = leitor["valordiariaRES"].ToString();
                        txtProtoloco.Text   = leitor["protocoloRES"].ToString();

                        txtFuncionario.Text = "admin";
                        if (lblFoto.Text != "Foto")
                        {
                            pictureFoto.Image = Image.FromFile(lblFoto.Text);
                        }
                    }
                    leitor.Close();
                }

                con.Close();
            }
            catch
            {
                MessageBox.Show("Erro ao carregar a reserva", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #6
0
        public void CarregarCliente(int ID)
        {
            SqlConnection con = new SqlConnection(conexao.RecuperaCNN());

            try
            {
                SqlCommand cmd = new SqlCommand(preparasql.ConsultaCliente(ID), con);
                con.Open();



                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        txtNome.Text       = reader["nomeCLI"].ToString();
                        mskRG.Text         = reader["rgCLI"].ToString();
                        mskCPF.Text        = reader["cpfCLI"].ToString();
                        mskCNH.Text        = reader["CNHCLI"].ToString();
                        mskDataNas.Text    = reader["datanascCLI"].ToString();
                        mskTelComer.Text   = reader["telefonefixoCLI"].ToString();
                        mskCelular.Text    = reader["telefonecelularCLI"].ToString();
                        txtEmail.Text      = reader["emailCLI"].ToString();
                        mskCEP.Text        = reader["cepCLI"].ToString();
                        txtLogradouro.Text = reader["enderCLI"].ToString();
                        txtCidade.Text     = reader["cidadeCLI"].ToString();
                        txtUF.Text         = reader["estadoCLI"].ToString();
                        txtBairro.Text     = reader["bairroCLI"].ToString();
                        txtnum.Text        = reader["numcasaCLI"].ToString();
                    }
                }

                /*nomeCLI,rgCLI,cpfCLI,CNHCLI,
                 * datanascCLI,telefonefixoCLI,telefonecelularCLI,emailCLI,
                 * cepCLI,enderCLI,cidadeCLI,estadoCLI,
                 * bairroCLI,numcasaCLI
                 */
            }
            catch (Exception ex)
            {
                string err = ex.Message;
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }
コード例 #7
0
        private void CarregarVeiculo(int ID)
        {
            SqlConnection con = new SqlConnection(conexao.RecuperaCNN());

            try
            {

                SqlCommand cmd = new SqlCommand(preparasql.ConsultaVeiculo(ID), con);
                con.Open();

                using (SqlDataReader reader = cmd.ExecuteReader())
                {

                    while (reader.Read())
                    {
                        txtChassis.Text = reader["chasVEIC"].ToString();
                        txtFabricante.Text = reader["fabricanteVEIC"].ToString();
                        txtPlaca.Text = reader["placaVEIC"].ToString();
                        txtMarca.Text = reader["marcaVEIC"].ToString();
                        txtCor.Text = reader["corVEIC"].ToString();
                        txtKM.Text = reader["kmVEIC"].ToString();
                        mskDataFabr.Text = reader["datafabrVEIC"].ToString();
                        mskDataCompr.Text = reader["datacompraVEIC"].ToString();
                        mskDataUltimaRev.Text = reader["ultimarevisaoVEIC"].ToString();
                        lblFoto.Text = reader["imgVEIC"].ToString();
                        txtObs.Text = reader["descVEIC"].ToString();

                        if (lblFoto.Text != "Foto")
                        {
                            pictureFoto.Image = Image.FromFile(lblFoto.Text);
                        }
                    }
                }


            }
            catch (Exception ex)
            {
                string err = ex.Message;
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }
コード例 #8
0
        public void CarregarFunc(int ID)
        {
            SqlConnection con = new SqlConnection(conexao.RecuperaCNN());

            try
            {
                SqlCommand cmd = new SqlCommand(preparasql.ConsultaFunc(ID), con);
                con.Open();

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        txtNome.Text       = reader["nomeFUNC"].ToString();
                        mskRG.Text         = reader["rgFUNC"].ToString();
                        mskCPF.Text        = reader["cpfFUNC"].ToString();
                        mskDataAd.Text     = reader["dataadmiss"].ToString();
                        mskDataNasc.Text   = reader["datanascFUNC"].ToString();
                        mskDataDemi.Text   = reader["datademiss"].ToString();
                        mskTelefone.Text   = reader["telefoneFUNC"].ToString();
                        mskCEP.Text        = reader["cepFUNC"].ToString();
                        txtLogradouro.Text = reader["enderFUNC"].ToString();
                        txtCidade.Text     = reader["cidadeFUNC"].ToString();
                        txtUF.Text         = reader["estadoFUNC"].ToString();
                        txtBairro.Text     = reader["bairroFUNC"].ToString();
                        txtnum.Text        = reader["numcasaFUNC"].ToString();
                        cmbLogin.Text      = reader["perfilusuFUNC"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                string err = ex.Message;
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }