Example #1
0
        private bool Cancelar(string funcionario, List <String> Lista, string dataagenda)
        {
            if (funcionario == null || funcionario == "")
            {
                return(false);
            }

            DateTime diaagendado  = Convert.ToDateTime(dataagenda);
            string   funcioanario = funcionario.ToString().Substring(0, 3);
            int      codigo       = Convert.ToInt32((funcioanario.Replace("-", "")));

            for (int i = 0; i < Lista.Count; i++)
            {
                String[] substrings = Lista[i].Split('|');

                int linhaAGENDAMENTO  = Convert.ToInt32(substrings[1]);
                int colunaAGENDAMENTO = Convert.ToInt32(substrings[2]);

                AgendamentoBLL bll = new AgendamentoBLL();
                bll.Cancelar(codigo, linhaAGENDAMENTO, colunaAGENDAMENTO, diaagendado);

                // agenda.codigoSERVICO = codigo;
                bll = null;
            }

            return(true);
        }
Example #2
0
        private bool ConfirmaAgendamento(string funcionario, List <String> Lista, string dataagenda)
        {
            if (funcionario == null || funcionario == "")
            {
                return(false);
            }

            DateTime diaagendado  = Convert.ToDateTime(dataagenda);
            string   funcioanario = funcionario.ToString().Substring(0, 3);
            int      codigo       = Convert.ToInt32((funcioanario.Replace("-", "")));


            // Tela de forma de pgto
            frmPagto frmPagto = new frmPagto();

            frmPagto.ShowDialog();

            // Verificar se foi cancelado em tela de ptgo
            int cancelado = frmPagto.Canceldo;

            if (cancelado == 1)
            {
                return(false);
            }


            //Retorna a forma de pgto
            Enum TipoPgto = frmPagto.RetornaTipoPagto();

            var tipoPagto = frmPagto.RetornaTipoPagto().ToString() == "DINHEIRO" ? 0 : 1;


            if (TipoPgto.ToString() == "" || TipoPgto.ToString() == null)
            {
                MessageBox.Show("Por favor escolha forma de pagamento !!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            for (int i = 0; i < Lista.Count; i++)
            {
                String[] substrings = Lista[i].Split('|');

                int linhaAGENDAMENTO  = Convert.ToInt32(substrings[1]);
                int colunaAGENDAMENTO = Convert.ToInt32(substrings[2]);

                AgendamentoBLL bll = new AgendamentoBLL();

                // ATENÇÃO - RECUPERAR A FORMA DE PGTO EM NUMERO PARA COLOCAR ABAIXO NA FUNÇÃO.
                bll.ConfirmaAgendamento(codigo, linhaAGENDAMENTO, colunaAGENDAMENTO, diaagendado, tipoPagto);

                bll = null;
            }

            return(true);
        }
Example #3
0
        private void btIncuir_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtProfissional.Text == "")
                {
                    MessageBox.Show("Selecione o dia de cancelamento na Agenda !!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (dgvServico.RowCount == 0)
                {
                    MessageBox.Show("Por favor incluir o serviço prestado !!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }


                Agendamento    agenda    = new Agendamento();
                AgendamentoBLL bllPedido = new AgendamentoBLL();

                string funcioanario = txtProfissional.Text.Substring(0, 3);
                agenda.funcionarioAGENDAMENTO = Convert.ToInt32((funcioanario.Replace("-", "")));

                agenda.observacaoAGENDAMENTO  = txtDetalhe.Text;
                agenda.codigoCliente          = 4;//Convert.ToInt32(cbo_Cliente.SelectedValue); esta fixo com o cliente padrao por enquanto...
                agenda.nomeclienteAGENDAMENTO = txtCliente.Text;
                agenda.codigoSERVICO          = Convert.ToInt32(cbo_servico.SelectedValue);
                agenda.diaAGENDAMENTO         = Convert.ToDateTime(strdiaAgendamento);
                agenda.fone_celular           = txtFone1.Text;



                List <Servico> lista = new List <Servico>();
                if (dgvServico.RowCount > 0)
                {
                    for (int i = 0; i < dgvServico.RowCount; i++)
                    {
                        lista.Add(new Servico()
                        {
                            Id           = Convert.ToInt32(dgvServico.Rows[i].Cells[0].Value.ToString()),
                            PrecoSERVICO = Convert.ToDecimal(dgvServico.Rows[i].Cells[2].Value.ToString()),
                        });
                    }
                }

                // motivo: nao estou usando o cadastro de cliente, estou guardando o nome do cliente

                long Pedido = bllPedido.GeraPedido(Convert.ToInt32((funcioanario.Replace("-", ""))), 4, lista);
                bllPedido = null;
                if (Pedido == 0)
                {
                    return;
                }

                for (int i = 0; i < ListaAgendamento.Count; i++)
                {
                    String[] substrings = ListaAgendamento[i].Split('|');

                    agenda.linhaAGENDAMENTO  = Convert.ToInt32(substrings[1]);
                    agenda.colunaAGENDAMENTO = Convert.ToInt32(substrings[2]);

                    AgendamentoBLL bll        = new AgendamentoBLL();
                    var            ObjHorario = bll.RetornaCodigoServico(substrings[0]);

                    //Retirando a duplicidade  dos horarios
                    var hora     = ObjHorario;
                    var Horarios = from a in hora
                                   group a.codigoHORARIO by a.codigoHORARIO;

                    foreach (var horario in Horarios)
                    {
                        var codigo = horario.Key;
                        agenda.codigoHorario = codigo;
                    }

                    agenda.relacaoPEDIDO = Pedido;

                    string mensagem = bll.CadastrarAgendamento(agenda);
                    bll = null;
                    this.Close();
                    Dispose();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }