예제 #1
0
        private void btnCancelarExcluir_Click(object sender, EventArgs e)
        {
            switch (_switchBotaoCancelarExcluir)
            {
            case EnumBotoesForm.Cancelar:
                InicializeBotoes(EnumTipoDeForm.Detalhamento, ref btnEditarSalvar, ref btnCancelarExcluir, ref _switchBotaoEditarSalvar, ref _switchBotaoCancelarExcluir);
                _tipoDoForm = EnumTipoDeForm.Detalhamento;

                Interacao interacao;
                using (var servicoDeInteracao = new ServicoDeInteracao())
                {
                    interacao = servicoDeInteracao.Consulte(_codigoInteracao);
                }

                CarregueControlesComObjeto(interacao);
                DesabiliteControles();
                break;

            case EnumBotoesForm.Excluir:
                var resultado = MessageBox.Show($"Tem certeza que deseja excluir essa interação?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (resultado == DialogResult.Yes)
                {
                    using (var servicoDeInteracao = new ServicoDeInteracao())
                    {
                        var inconsistencias = servicoDeInteracao.Exclua(_codigoInteracao);

                        if (inconsistencias.Count > 0)
                        {
                            foreach (var inconsitencia in inconsistencias)
                            {
                                MessageBox.Show(inconsitencia.Mensagem);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Interação excluída com sucesso!");
                            this.Close();
                        }
                    }
                }
                break;
            }
        }
예제 #2
0
        private void dgvHistorico_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            var senderGrid = (DataGridView)sender;

            var       codigoInteracao = (int)senderGrid["colunaCodigoInteracao", e.RowIndex].Value;
            Interacao interacao;

            using (var servicoDeInteracao = new ServicoDeInteracao())
            {
                interacao = servicoDeInteracao.Consulte(codigoInteracao);
            }

            if (interacao != null)
            {
                new frmInteracao(interacao).Show();
            }
        }
예제 #3
0
        private void dgvHistorico_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                if (senderGrid.Columns[e.ColumnIndex] == colunaDetalharHist)
                {
                    var       codigoInteracao = (int)senderGrid["colunaCodigoInteracao", e.RowIndex].Value;
                    Interacao interacao;

                    using (var servicoDeInteracao = new ServicoDeInteracao())
                    {
                        interacao = servicoDeInteracao.Consulte(codigoInteracao);
                    }

                    if (interacao != null)
                    {
                        new frmInteracao(interacao).Show();
                    }
                }
            }
        }