コード例 #1
0
        public void selecionar(object sender, DataGridViewCellEventArgs e)
        {
            if (cmbPorTipo.Text == "Cliente")
            {
                RepositorioCliente repositorioc = new RepositorioCliente();
                TelaCliente        cliente      = new TelaCliente();
                if (e.RowIndex >= 0)
                {
                    cliente.txtNome.Text        = dgvConsulta.Rows[e.RowIndex].Cells[1].Value.ToString();
                    cliente.txtcpfCnpj.Text     = dgvConsulta.Rows[e.RowIndex].Cells[2].Value.ToString();
                    cliente.txtEnd.Text         = dgvConsulta.Rows[e.RowIndex].Cells[3].Value.ToString();
                    cliente.txtCid.Text         = dgvConsulta.Rows[e.RowIndex].Cells[4].Value.ToString();
                    cliente.cboUf.Text          = dgvConsulta.Rows[e.RowIndex].Cells[5].Value.ToString();
                    cliente.txtComplemento.Text = dgvConsulta.Rows[e.RowIndex].Cells[6].Value.ToString();
                    cliente.txtCep.Text         = dgvConsulta.Rows[e.RowIndex].Cells[7].Value.ToString();
                    cliente.txtEmail.Text       = dgvConsulta.Rows[e.RowIndex].Cells[8].Value.ToString();
                    cliente.txtFoneFax.Text     = dgvConsulta.Rows[e.RowIndex].Cells[9].Value.ToString();
                    cliente.ShowDialog();
                }
            }

            if (cmbPorTipo.Text == "Funcionário")
            {
                RepositorioFuncionario repositoriof = new RepositorioFuncionario();
                TelaFuncionario        funcionario  = new TelaFuncionario();
                if (e.RowIndex >= 0)
                {
                    funcionario.txtNome.Text             = dgvConsulta.Rows[e.RowIndex].Cells[1].Value.ToString();
                    funcionario.txtSenha.Text            = dgvConsulta.Rows[e.RowIndex].Cells[2].Value.ToString();
                    funcionario.txtcpfCnpj.Text          = dgvConsulta.Rows[e.RowIndex].Cells[3].Value.ToString();
                    funcionario.txtEnd.Text              = dgvConsulta.Rows[e.RowIndex].Cells[4].Value.ToString();
                    funcionario.txtCid.Text              = dgvConsulta.Rows[e.RowIndex].Cells[5].Value.ToString();
                    funcionario.txtCep.Text              = dgvConsulta.Rows[e.RowIndex].Cells[6].Value.ToString();
                    funcionario.txtEmail.Text            = dgvConsulta.Rows[e.RowIndex].Cells[7].Value.ToString();
                    funcionario.txtFone.Text             = dgvConsulta.Rows[e.RowIndex].Cells[8].Value.ToString();
                    funcionario.cboUf.Text               = dgvConsulta.Rows[e.RowIndex].Cells[9].Value.ToString();
                    funcionario.picUsuario.ImageLocation = dgvConsulta.Rows[e.RowIndex].Cells[10].Value.ToString();
                    funcionario.ShowDialog();
                }
            }

            if (cmbPorTipo.Text == "Serviço")
            {
                RepositorioServico repositorios = new RepositorioServico();
                TelaServico        servico      = new TelaServico();
                if (e.RowIndex >= 0)
                {
                    servico.txtempresa.Text            = dgvConsulta.Rows[e.RowIndex].Cells[1].Value.ToString();
                    servico.txtcpfCnpj.Text            = dgvConsulta.Rows[e.RowIndex].Cells[2].Value.ToString();
                    servico.txtEndereco.Text           = dgvConsulta.Rows[e.RowIndex].Cells[3].Value.ToString();
                    servico.txtCidade.Text             = dgvConsulta.Rows[e.RowIndex].Cells[4].Value.ToString();
                    servico.cmbUf.Text                 = dgvConsulta.Rows[e.RowIndex].Cells[5].Value.ToString();
                    servico.txtCep.Text                = dgvConsulta.Rows[e.RowIndex].Cells[6].Value.ToString();
                    servico.txtdataInicio.Text         = dgvConsulta.Rows[e.RowIndex].Cells[7].Value.ToString();
                    servico.txtdataTermino.Text        = dgvConsulta.Rows[e.RowIndex].Cells[8].Value.ToString();
                    servico.txtValor.Text              = dgvConsulta.Rows[e.RowIndex].Cells[9].Value.ToString();
                    servico.txtdescricaoDoServico.Text = dgvConsulta.Rows[e.RowIndex].Cells[11].Value.ToString();
                    servico.cmbSituacao.Text           = dgvConsulta.Rows[e.RowIndex].Cells[12].Value.ToString();
                    servico.ShowDialog();
                }
            }

            if (cmbPorTipo.Text == "Equipamento")
            {
                RepositorioEquipamento repositorioe = new RepositorioEquipamento();
                TelaEquipamento        equipamento  = new TelaEquipamento();
                if (e.RowIndex >= 0)
                {
                    equipamento.txtMaterial.Text      = dgvConsulta.Rows[e.RowIndex].Cells[1].Value.ToString();
                    equipamento.txtMarca.Text         = dgvConsulta.Rows[e.RowIndex].Cells[2].Value.ToString();
                    equipamento.txtEspecificacao.Text = dgvConsulta.Rows[e.RowIndex].Cells[4].Value.ToString();
                    equipamento.txtPreco.Text         = dgvConsulta.Rows[e.RowIndex].Cells[5].Value.ToString();
                    equipamento.txtQuantidade.Text    = dgvConsulta.Rows[e.RowIndex].Cells[6].Value.ToString();
                    equipamento.ShowDialog();
                }
            }
        }
コード例 #2
0
        /*private void button1_Click(object sender, EventArgs e)
         * {
         *  retornofinalidade(textBox1.Text);
         * }*/

        private void btnAtualizar_Click(object sender, EventArgs e)
        {
            RepositorioEquipamento repositorioe = new RepositorioEquipamento();

            repositorioe.atualizar(equipamento);
        }