Ejemplo n.º 1
0
 private void btnAtender_Click(object sender, EventArgs e)
 {
     Controller.AgendaController ac = new Controller.AgendaController();
     Entidades.Agenda            a  = listaAgendamentos.ElementAt(dgvAgendamento.CurrentRow.Index);
     a.Status = "Confirmado";
     ac.atualizaStatus(a);
     listaAgendamentos.ElementAt(dgvAgendamento.CurrentRow.Index).Status = "Confirmado";
 }
Ejemplo n.º 2
0
 private void btnNComprareceu_Click(object sender, EventArgs e)
 {
     Controller.AgendaController   ac = new Controller.AgendaController();
     Controller.ComissaoController cc = new Controller.ComissaoController();
     Entidades.Agenda a = listaAgendamentos.ElementAt(dgvAgendamento.CurrentRow.Index);
     a.Status = "Não Compareceu";
     cc.excluiComissao(a.Comissao);
     a.Comissao = new Entidades.Comissao();
     ac.atualizaStatus(a);
     listaAgendamentos.ElementAt(dgvAgendamento.CurrentRow.Index).Status = "Não Compareceu";
 }
Ejemplo n.º 3
0
 private void btnCancelar_Click(object sender, EventArgs e)
 {
     try
     {
         Controller.AgendaController   ac = new Controller.AgendaController();
         Controller.ComissaoController cc = new Controller.ComissaoController();
         Entidades.Agenda a = listaAgendamentos.ElementAt(dgvAgendamento.CurrentRow.Index);
         a.Status = "Cancelado";
         Entidades.Comissao com = new Entidades.Comissao();
         com.CodigoComissao = ac.retornaComissao(a);
         cc.excluiComissao(com);
         a.Comissao = new Entidades.Comissao();
         ac.atualizaStatus(a);
         listaAgendamentos.ElementAt(dgvAgendamento.CurrentRow.Index).Status = "Cancelado";
     }
     catch (Exception ex)
     {
         MessageBox.Show("Selecione um cliente para cancelar agendamento");
     }
 }
        private void btnFecharVenda_Click(object sender, EventArgs e)
        {
            Controller.AgendaController        ac  = new Controller.AgendaController();
            Controller.VendaController         vc  = new Controller.VendaController();
            Controller.ContasReceberController crc = new Controller.ContasReceberController();

            if (listapag != null && listapag.Count > 0)
            {
                string status = "";
                double rec    = Convert.ToDouble(mskRecebido.Text.ToString());
                double tot    = Convert.ToDouble(mskTotal.Text.ToString());
                if (tot > rec)
                {
                    status = "aberta";
                }
                else
                {
                    status = "fechada";
                }
                int i = 0;
                if (status.Equals("fechada"))
                {
                    if (this.codFechamento > 0)
                    {
                        if (crc.verificaParcelas(this.codConta))
                        {
                            if (listaAgenda != null && listaAgenda.Count > 0)
                            {
                                bool teste = false;
                                while (i < listaAgenda.Count && !teste)
                                {
                                    listaAgenda.ElementAt(i).Status = status;
                                    int rest = ac.atualizaStatus(listaAgenda.ElementAt(i));
                                    if (rest > 0)
                                    {
                                        i++;
                                    }
                                    else
                                    {
                                        teste = true;
                                    }
                                }
                            }
                            if (i < listaAgenda.Count)
                            {
                                MessageBox.Show("Erro ao atualizar serviços!");
                            }
                            else
                            {
                                this.parct.DataPagamento = DateTime.Now;
                                if (tot > rec)
                                {
                                    this.parct.ValorPago = rec;
                                }
                                else
                                {
                                    this.parct.ValorPago = tot;
                                }
                                this.parct.Forma = listapag.ElementAt(0).Forma;
                                int ver = crc.realizarRecebimento(this.parct, this.codConta);
                                if (ver <= 0)
                                {
                                    MessageBox.Show("Erro ao receber parcela");
                                }
                                else
                                {
                                    //int per = crc.atualizaStatus(this.codConta, status);

                                    if (crc.verificaParcelas(this.codConta))
                                    {
                                        int per = crc.atualizaStatus(this.codConta, status);
                                        if (per > 0)
                                        {
                                            int tes = vc.atualizaStatus(this.codVenda, status);
                                            if (tes > 0)
                                            {
                                                MessageBox.Show("Conta recebida com sucesso!");
                                                limpatela();
                                            }
                                            else
                                            {
                                                MessageBox.Show("Erro ao receber conta!!!");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (listaAgenda != null && listaAgenda.Count > 0)
                        {
                            bool teste = false;
                            while (i < listaAgenda.Count && !teste)
                            {
                                listaAgenda.ElementAt(i).Status = status;
                                int rest = ac.atualizaStatus(listaAgenda.ElementAt(i));
                                if (rest > 0)
                                {
                                    i++;
                                }
                                else
                                {
                                    teste = true;
                                }
                            }
                        }
                        if (i < listaAgenda.Count)
                        {
                            MessageBox.Show("Erro ao atualizar serviços!");
                        }
                        else
                        {
                            this.parct.DataPagamento = DateTime.Now;
                            if (tot > rec)
                            {
                                this.parct.ValorPago = rec;
                            }
                            else
                            {
                                this.parct.ValorPago = tot;
                            }
                            this.parct.Forma = listapag.ElementAt(0).Forma;
                            int ver = crc.realizarRecebimento(this.parct, this.codConta);
                            if (ver <= 0)
                            {
                                MessageBox.Show("Erro ao receber parcela");
                            }
                            else
                            {
                                //int per = crc.atualizaStatus(this.codConta, status);

                                if (crc.verificaParcelas(this.codConta))
                                {
                                    int per = crc.atualizaStatus(this.codConta, status);
                                    if (per > 0)
                                    {
                                        int tes = vc.atualizaStatus(this.codVenda, status);
                                        if (tes > 0)
                                        {
                                            MessageBox.Show("Conta recebida com sucesso!");
                                            limpatela();
                                        }
                                        else
                                        {
                                            MessageBox.Show("Erro ao receber conta!!!");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    this.parct.DataPagamento = DateTime.Now;
                    if (tot > rec)
                    {
                        this.parct.ValorPago = rec;
                    }
                    else
                    {
                        this.parct.ValorPago = tot;
                    }
                    this.parct.Forma = listapag.ElementAt(0).Forma;
                    int ver = crc.realizarRecebimento(this.parct, this.codConta);
                    if (ver <= 0)
                    {
                        MessageBox.Show("Erro ao receber parcela");
                    }
                    else
                    {
                        int per = crc.atualizaStatus(this.codConta, status);
                        if (per > 0)
                        {
                            MessageBox.Show("Conta recebida com sucesso!");
                        }
                        else
                        {
                            MessageBox.Show("Erro ao receber Conta!");
                        }
                    }
                }

                MessageBox.Show("Fechamento realizado com sucesso!");
                limpatela();
                Close();
            }
        }