Exemplo n.º 1
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (advBandedGridView1.RowCount > 1)
            {
                advBandedGridView1.FocusedRowHandle = 0;
                advBandedGridView1.SelectRow(0);
                advBandedGridView1.ActiveFilter.Clear();
                gridControl1.Enabled = false;
                for (int i = 0; i < advBandedGridView1.RowCount; i++)

                {
                    m_comissoes.empresa              = advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[0]).ToString();
                    m_comissoes.venda                = advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[1]).ToString();
                    m_comissoes.obra                 = advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[2]).ToString();
                    m_comissoes.corretor_pf          = advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[3]).ToString();
                    m_comissoes.NomeCliente          = advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[4]).ToString();
                    m_comissoes.quadra               = advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[5]).ToString();
                    m_comissoes.lote                 = advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[6]).ToString();
                    m_comissoes.statusvenda          = advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[7]).ToString();
                    m_comissoes.DataVenda            = (DateTime)advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[8]);
                    m_comissoes.datacadvenda         = (DateTime)advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[9]);
                    m_comissoes.valorvenda           = Convert.ToDecimal(advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[10]));
                    m_comissoes.tipoparcela          = advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[11]).ToString();
                    m_comissoes.parcelacomissao      = Convert.ToInt32(advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[12]));
                    m_comissoes.totalparcelacomissao = Convert.ToInt32(advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[13]));
                    m_comissoes.vencimentoparcela    = (DateTime)advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[14]);
                    m_comissoes.valorparcela         = Convert.ToDecimal(advBandedGridView1.GetRowCellValue(advBandedGridView1.GetSelectedRows()[0], advBandedGridView1.Columns[15]));
                    m_comissoes.usuariocad           = _UsuarioCad;
                    m_comissoes.datacadcomissao      = DateTime.Now;
                    m_comissoes.statuscomissao       = (int)e_StatusComissao.Nao_Liberada;
                    c_comissoes.NovasComissoes(m_comissoes);
                    advBandedGridView1.MoveNext();
                }
                MessageBox.Show("Comissão(s) inserida(s) com sucesso!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }
Exemplo n.º 2
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            gbxDadosDaVenda.Enabled   = false;
            gbxEmpreendimento.Enabled = false;
            gbxParcelas.Enabled       = false;
            splashScreenManagerN.ShowWaitForm();

            if (txtCliente.Text != string.Empty && txtLote.Text != string.Empty && txtQuadra.Text != string.Empty && txtValorParcela.Text != string.Empty &&
                txtValorVenda.Text != string.Empty && txtVenda.Text != string.Empty && cbxCorretor.Text != string.Empty && cbxLoteamento.Text != string.Empty &&
                cbxParcelaTipo.Text != string.Empty && cbxStatusVenda.Text != string.Empty && nudQtdParcelas.Value > 0)
            {
                m_comissoes.usuariocad   = _UsuarioCad;
                m_comissoes.corretor_pf  = cbxCorretor.Text;
                m_comissoes.DataVenda    = dtpDataVenda.Value;
                m_comissoes.datacadvenda = dtpDataCadastro.Value;
                m_comissoes.quadra       = txtQuadra.Text;
                m_comissoes.lote         = txtLote.Text;
                m_comissoes.NomeCliente  = txtCliente.Text;
                m_comissoes.statusvenda  = cbxStatusVenda.Text;
                m_comissoes.tipoparcela  = cbxParcelaTipo.Text;
                m_comissoes.valorvenda   = Convert.ToDecimal(txtValorVenda.Text.Replace("R$", ""));
                m_comissoes.valorparcela = Convert.ToDecimal(txtValorParcela.Text.Replace("R$", ""));
                m_comissoes.venda        = txtVenda.Text;

                m_loteamento.idloteamento = Convert.ToInt32(cbxLoteamento.EditValue);
                m_comissoes.obra          = c_loteamento.CarregarObra(m_loteamento);
                m_loteamento.empresa      = c_loteamento.CarregarEmpresa(m_loteamento);
                m_comissoes.empresa       = c_loteamento.CarregarEmpresa(m_loteamento);


                if (_AlteraCad == false)
                {
                    m_comissoes.datacadcomissao = DateTime.Now;
                    if (nudQtdParcelas.Value > 1)
                    {
                        for (int i = 1; i <= nudQtdParcelas.Value; i++)
                        {
                            m_comissoes.parcelacomissao      = i;
                            m_comissoes.totalparcelacomissao = Convert.ToInt32(nudQtdParcelas.Value);
                            if (i == 1)
                            {
                                m_comissoes.vencimentoparcela = dtpDataVencimento.Value;
                            }
                            else
                            {
                                dtpDataVencimento.Value       = dtpDataVencimento.Value.AddMonths(1);
                                m_comissoes.vencimentoparcela = dtpDataVencimento.Value;
                            }
                            c_Comissoes.NovasComissoes(m_comissoes);
                        }
                        splashScreenManagerN.CloseWaitForm();
                        MessageBox.Show("Comissões adicionadas com sucesso!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        AtualizarGrid();
                        this.Close();
                    }
                    else
                    {
                        m_comissoes.parcelacomissao      = 1;
                        m_comissoes.totalparcelacomissao = 1;
                        m_comissoes.vencimentoparcela    = dtpDataVencimento.Value;
                        c_Comissoes.NovasComissoes(m_comissoes);
                        splashScreenManagerN.CloseWaitForm();
                        MessageBox.Show("Comissão adicionada com sucesso!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        AtualizarGrid();
                        this.Close();
                    }
                }
                else if (_AlteraCad == true)
                {
                }
            }
            else
            {
                MessageBox.Show("Preencha todos os campos corretamente!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                splashScreenManagerN.CloseWaitForm();
                gbxDadosDaVenda.Enabled   = true;
                gbxEmpreendimento.Enabled = true;
                gbxParcelas.Enabled       = true;
            }
        }