Exemple #1
0
 private void btnVendedor_Click(object sender, EventArgs e)
 {
     if (FCaixa.StatusCaixa != 3)
     {
         if (FCaixa.StatusCaixa == 1)
         {
             FImportaNumero FImportaNumero = new FImportaNumero();
             FImportaNumero.Text = "Identifica Vendedor";
             FImportaNumero.LabelEntrada.Text = "Informe o codigo do vendedor";
             try
             {
                 if (FImportaNumero.ShowDialog() == DialogResult.OK)
                 {
                     FuncionarioVO Vendedor = new VendedorController().ConsultaVendedor(Convert.ToInt32(FImportaNumero.EditEntrada.Text));
                     if (Vendedor.Id != 0)
                     {
                         FCaixa.VendaCabecalho.IdVendedor = Vendedor.Id;
                     }
                     else
                     {
                         MessageBox.Show("Vendedor: codigo invalido ou inexistente.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     }
                 }
             }
             catch (Exception eError)
             {
                 Log.write(eError.ToString());
             }
         }
         else
         {
             MessageBox.Show("Não existe venda em andamento.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("Terminal em Estado Somente Consulta.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     this.Close();
 }
Exemple #2
0
        private void listaMenuOperacoes_KeyDown(object sender, KeyEventArgs e)
        {
            string RegistraPreVenda = "";

            try
            {
                XmlDocument ArquivoXML = new XmlDocument();
                ArquivoXML.Load(Application.StartupPath + "\\ArquivoAuxiliar.xml");
                RegistraPreVenda = Biblioteca.Desencripta(ArquivoXML.GetElementsByTagName("registraPreVenda").Item(0).InnerText.Trim());
            }
            catch (Exception eError)
            {
                Log.write(eError.ToString());
            }

            if (e.KeyCode == Keys.Escape)
            {
                this.Close();
            }

            if (e.KeyCode == Keys.Enter)
            {
                if (RegistraPreVenda == "REGISTRA")
                {
                    //  carrega pre-venda
                    if (listaMenuOperacoes.SelectedIndex == 0)
                    {
                        if (FCaixa.StatusCaixa == 0)
                        {
                            FImportaNumero FImportaNumero = new FImportaNumero();
                            FImportaNumero.Text = "Carrega Pre-Venda";
                            FImportaNumero.LabelEntrada.Text = "Informe o numero da Pre-Venda";
                            try
                            {
                                if (FImportaNumero.ShowDialog() == DialogResult.OK)
                                {
                                    this.Close();
                                    FCaixa.CarregaPreVenda(FImportaNumero.EditEntrada.Text);
                                }
                            }
                            catch (Exception eError)
                            {
                                Log.write(eError.ToString());
                            }
                        } //  if StatusCaixa = 0 then
                        else
                        {
                            MessageBox.Show("Já existe uma venda em andamento.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }


                    //  mesclar pre-venda
                    if (listaMenuOperacoes.SelectedIndex == 1)
                    {
                        FMesclaPreVenda FMesclaPreVenda = new FMesclaPreVenda();
                        FMesclaPreVenda.ShowDialog();
                        this.Close();
                    }


                    //  cancela pre-venda
                    if (listaMenuOperacoes.SelectedIndex == 2)
                    {
                        FCancelaPreVenda FCancelaPreVenda = new FCancelaPreVenda();
                        FCancelaPreVenda.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show("Sistema não está configurado para operações com Pré-Vendas.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }


                //  carrega dav
                if (listaMenuOperacoes.SelectedIndex == 3)
                {
                    if (FCaixa.StatusCaixa == 0)
                    {
                        FCarregaDAV FCarregaDAV = new FCarregaDAV();
                        try
                        {
                            if (FCarregaDAV.ShowDialog() == DialogResult.OK)
                            {
                                this.Close();
                                FCaixa.CarregaDAV(FCarregaDAV.NumeroSelecionado);
                            }
                        }
                        catch (Exception eError)
                        {
                            Log.write(eError.ToString());
                        }
                    }
                    else
                    {
                        MessageBox.Show("Ja existe uma venda em andamento.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }


                //  mesclar DAVs
                if (listaMenuOperacoes.SelectedIndex == 4)
                {
                    FMesclaDAV FMesclaDAV = new FMesclaDAV();
                    FMesclaDAV.ShowDialog();
                    this.Close();
                }
            }
        }