Esempio n. 1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtCod.Text == string.Empty)
     {
         errorP.SetError(txtCod, "!");
         FNotificao.AlerForm("Informe o Código do Fármaco", TipoNotificacao.aviso);
     }
     else if (txtQtd.Text == string.Empty)
     {
         errorP.SetError(txtQtd, "!");
         FNotificao.AlerForm("Informe a Quantidade desejada", TipoNotificacao.aviso);
     }
     else if (int.Parse(txtQtd.Text) > int.Parse(txtEstok.Text))
     {
         errorP.SetError(txtEstok, "!");
         FNotificao.AlerForm("Estoque disponível Insuficiente", TipoNotificacao.aviso);
     }
     else
     {
         ReservarEstoque();
         SomarTotal();
         SomarItens();
         LimparCampos();
     }
 }
Esempio n. 2
0
        //Método Editar
        private void Editar()
        {
            Produto    dto = new Produto();
            BllProduto bll = new BllProduto();

            dto.Operacao      = "Editar";
            dto.ProdutoId     = Convert.ToInt32(txtCodigo.Text);
            dto.NomeProduto   = txtProduto.Text;
            dto.TipoFarmacoId = Convert.ToInt32(cbTipoFarmco.SelectedValue);
            dto.CategoriaId   = Convert.ToInt32(cbCateg.SelectedValue);
            dto.Medida        = 1;
            dto.PaisOrigem    = Convert.ToInt32(cbPais.SelectedValue);
            dto.UrlImg        = SalvarImg(open.FileName);

            try
            {
                string retorno = bll.Cadastrar(dto);
                FNotificao.AlerForm(retorno, TipoNotificacao.sucesso);
                this.DialogResult = DialogResult.Yes;
                LimparCampos();
            }
            catch (Exception ex)
            {
                FNotificao.AlerForm(ex.Message, TipoNotificacao.erro);
                this.DialogResult = DialogResult.No;
            }
        }
Esempio n. 3
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgv.RowCount == 0)
            {
                FNotificao.AlerForm(" Nenhum Selecionado", TipoNotificacao.aviso);
            }
            else
            {
                string resultado = FNotificao.AlertConfirm("Deseja Editar os Dados do Cliente #" + dgv.CurrentRow.Cells["NomeCompleto"].Value.ToString() + "# ?", TipoNotificacao.pergunta);
                if (resultado == "1")
                {
                    FFCliente frm = new FFCliente(AcaoNaTela.Editar);
                    frm.txtCodigo.Text   = dgv.CurrentRow.Cells["ClienteId"].Value.ToString();
                    frm.txtNome.Text     = dgv.CurrentRow.Cells["NomeCompleto"].Value.ToString();
                    frm.txtTelf.Text     = dgv.CurrentRow.Cells["Telf"].Value.ToString();
                    frm.txtEmail.Text    = dgv.CurrentRow.Cells["Email"].Value.ToString();
                    frm.txtEndereco.Text = dgv.CurrentRow.Cells["Endereco"].Value.ToString();
                    if (dgv.CurrentRow.Cells["Estad"].Value.ToString() == "Activo")
                    {
                        frm.cbEstado.SelectedIndex = 1;
                    }
                    else
                    {
                        frm.cbEstado.SelectedIndex = 2;
                    }

                    DialogResult dialogResult = frm.ShowDialog();
                    if (dialogResult == DialogResult.Yes)
                    {
                        ListarCliente();
                    }
                }
            }
        }
Esempio n. 4
0
        //Método para Cadastrar
        private void Cadastrar()
        {
            Fornecedor    dto = new Fornecedor();
            BllFornecedor bll = new BllFornecedor();

            dto.Operacao       = "Cadastrar";
            dto.NomeFornecedor = txtNome.Text;
            dto.Endereco       = txtEndereco.Text;
            dto.Telf           = txtTelf.Text;
            dto.Email          = txtEmail.Text;
            string retorno = bll.Cadastrar(dto);

            try
            {
                int id = Convert.ToInt32(retorno);
                FNotificao.AlerForm("Fornecedor Cadastrado Com Sucesso", TipoNotificacao.sucesso);
                this.DialogResult = DialogResult.Yes;
                LimparCampos();
            }
            catch
            {
                FNotificao.AlerForm(retorno, TipoNotificacao.aviso);
                //this.DialogResult = DialogResult.No;
            }
        }
Esempio n. 5
0
        private void CadastrarVenda()
        {
            Venda    dto = new Venda();
            BllVenda bll = new BllVenda();

            dto.Operacao      = "Venda";
            dto.CaixaFunc     = Convert.ToInt32(lblCaixaFunc.Text);
            dto.ClienteId     = 1;
            dto.TipoPagamento = 2;
            dto.ValorTotal    = Convert.ToDecimal(lblValor.Text);

            string retorno = bll.Cadastrar(dto);

            try
            {
                int id = Convert.ToInt32(retorno);

                if (id > 0)
                {
                    CadastrarPedido();
                }
            }
            catch
            {
                FNotificao.AlerForm("Erro Ao Registrar a Venda " + retorno.ToString(), TipoNotificacao.erro);
            }
        }
Esempio n. 6
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgv.Rows.Count == 0)
            {
                FNotificao.AlerForm("Nenhum Item Selecionado", TipoNotificacao.aviso);
            }
            else
            {
                FFFornecedor frm = new FFFornecedor(AcaoNaTela.Editar);

                string resultado = FNotificao.AlertConfirm("Deseja Editar os dados do Fornecedor "
                                                           + dgv.CurrentRow.Cells["NomeFornecedor"].Value.ToString() + "?", TipoNotificacao.pergunta);

                if (resultado.Equals("1"))
                {
                    frm.txtCodigo.Text   = dgv.CurrentRow.Cells["FornecedorId"].Value.ToString();
                    frm.txtNome.Text     = dgv.CurrentRow.Cells["NomeFornecedor"].Value.ToString();
                    frm.txtEndereco.Text = dgv.CurrentRow.Cells["Endereco"].Value.ToString();
                    frm.txtTelf.Text     = dgv.CurrentRow.Cells["Telf"].Value.ToString();
                    frm.txtEmail.Text    = dgv.CurrentRow.Cells["Email"].Value.ToString();

                    DialogResult dialogResult = frm.ShowDialog();;
                }
            }
        }
Esempio n. 7
0
        //Método Pesquisar Cliente
        private void ProcurarCliente()
        {
            BllCliente bll = new BllCliente();
            Cliente    dto = new Cliente();

            dto.ClienteId = Convert.ToInt32(txtCodigo.Text);
            dto.Operacao  = "ListarPor";
            DataTable dt = bll.ListarPorCodigo(dto);

            try
            {
                if (dt.Rows.Count != 0)
                {
                    txtCliente.Text = dt.Rows[0]["NomeCompleto"].ToString();
                }
                else
                {
                    FNotificao.AlerForm("Cliente não encontrado", TipoNotificacao.info);
                    txtCodigo.Text = "";
                }
            }
            catch (Exception ex)
            {
                FNotificao.AlerForm(ex.Message, TipoNotificacao.erro);
            }
        }
Esempio n. 8
0
        public static string AlertConfirm(string msg, TipoNotificacao tipo)
        {
            FNotificao frm = new FNotificao(msg, tipo);

            frm.ShowDialog();
            return(Button_id);
        }
Esempio n. 9
0
        //Método para Cadastrar
        private void Cadastrar()
        {
            Cliente    dto = new Cliente();
            BllCliente bll = new BllCliente();

            dto.Operacao     = "Cadastrar";
            dto.NomeCompleto = txtNome.Text;
            dto.Endereco     = txtEndereco.Text;
            dto.Telf         = txtTelf.Text;
            dto.Email        = txtEmail.Text;
            if (cbEstado.SelectedIndex == 1)
            {
                dto.Estado = true;
            }
            else
            {
                dto.Estado = false;
            }
            string retorno = bll.Cadastrar(dto);

            try
            {
                int id = Convert.ToInt32(retorno);
                FNotificao.AlerForm("Cliente Cadastrado Com Sucesso", TipoNotificacao.sucesso);
                this.DialogResult = DialogResult.Yes;
            }
            catch
            {
                FNotificao.AlerForm(retorno, TipoNotificacao.erro);
                this.DialogResult = DialogResult.No;
            }
        }
Esempio n. 10
0
 private void btnCadastrar_Click(object sender, EventArgs e)
 {
     if (btnCadastrar.Text == "Cadastrar")
     {
         if (txtNome.Text == string.Empty)
         {
             errorP.SetError(txtNome, "!");
             FNotificao.AlerForm("Campo Obrigatório", TipoNotificacao.aviso);
         }
         else if (txtNome.TextLength < 3)
         {
             errorP.SetError(txtNome, "!");
             FNotificao.AlerForm("No mínino 3 caracteres e no máximo 50 caracteres", TipoNotificacao.aviso);
         }
         else if (txtEndereco.Text == string.Empty)
         {
             errorP.SetError(txtEndereco, "!");
             FNotificao.AlerForm("Campo Obrigatório", TipoNotificacao.aviso);
         }
         else if (txtEndereco.TextLength < 3)
         {
             errorP.SetError(txtEndereco, "!");
             FNotificao.AlerForm("No mínino 3 caracteres e no máximo 50 caracteres", TipoNotificacao.aviso);
         }
         else if (txtTelf.Text == string.Empty)
         {
             errorP.SetError(txtTelf, "!");
             FNotificao.AlerForm("Campo Obrigatório", TipoNotificacao.aviso);
         }
         else if (txtTelf.TextLength < 8)
         {
             errorP.SetError(txtTelf, "!");
             FNotificao.AlerForm("No mínino 9 caracteres e no máximo 20 caracteres", TipoNotificacao.aviso);
         }
         else if (txtEmail.Text == string.Empty)
         {
             errorP.SetError(txtEmail, "!");
             FNotificao.AlerForm("Campo Obrigatório", TipoNotificacao.aviso);
         }
         else if (txtEmail.TextLength < 6)
         {
             errorP.SetError(txtEmail, "!");
             FNotificao.AlerForm("No mínino 9 caracteres e no máximo 20 caracteres", TipoNotificacao.aviso);
         }
         //else if (cbEstado.SelectedIndex == 0)
         //{
         //    errorP.SetError(cbEstado, "!");
         //    FNotificao.AlerForm("Selecionar o Estado", TipoNotificacao.aviso);
         //}
         else
         {
             Cadastrar();
         }
     }
 }
Esempio n. 11
0
        //Método para Logar
        private void AbrirCaixa()
        {
            if (txtSaldo.Text == string.Empty)
            {
                errorP.SetError(txtSaldo, "Campo Obrigatório");
            }
            else if (txtSenha.Text == string.Empty)
            {
                errorP.SetError(txtSenha, "Campo Obrigatório");
            }
            else if (_SenhaGlobal != txtSenha.Text)
            {
                errorP.SetError(txtSenha, "Senha Errada");
            }
            else
            {
                BllCaixa    bll = new BllCaixa();
                Funcionario dto = new Funcionario();
                dto.Operacao      = "AbrirCaixa";
                dto.CaixaId       = Convert.ToInt32(cbCaixa.SelectedValue);
                dto.SaldoInicial  = Convert.ToDecimal(txtSaldo.Text);
                dto.FuncionarioId = Convert.ToInt32(_IdGlobal);

                DataTable dt = bll.AbrirCaixa(dto);

                try
                {
                    if (dt.Rows.Count != 0)
                    {
                        FNotificao.AlerForm("Caixa Nº " + dto.CaixaId.ToString() + " Aberta Com Sucesso", TipoNotificacao.sucesso);
                        dto = new Funcionario();
                        dto.FuncionarioId = Convert.ToInt32(_IdGlobal);
                        dto.Cargo         = _CargoGlobal;
                        dto.NomeCompleto  = _NomeGlobal;
                        dto.CaixaId       = Convert.ToInt32(cbCaixa.SelectedValue);
                        dto.CaixaFunc     = Convert.ToInt32(dt.Rows[0]["CaixaFuncionarioId"]);
                        dto.Abertura      = dt.Rows[0]["Abertura"].ToString();
                        this.Hide();
                        Estoque es = new Estoque();
                        FVenda  f  = FVenda.getInstancia(dto);
                        f.ShowDialog();
                    }
                    else
                    {
                        FNotificao.AlerForm("Erro Detalhes: " /*+ dt.Rows[0]["Retorno"].ToString()*/, TipoNotificacao.erro);
                    }
                }
                catch
                {
                    //FNotificao.AlerForm("Erro Detalhes: " /*+ dt.Rows[0]["Retorno"].ToString()*/, TipoNotificacao.erro);
                }
            }
        }
Esempio n. 12
0
        private void btnEncerrar_Click(object sender, EventArgs e)
        {
            string resultado = FNotificao.AlertConfirm("Deseja Encerrar Aplicação?", TipoNotificacao.pergunta);

            if (resultado.Equals("2"))
            {
                return;
            }
            else
            {
                Application.Exit();
            }
        }
Esempio n. 13
0
 private void txtEntregou_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != ','))
     {
         e.Handled = true;
         FNotificao.AlerForm("este campo aceita somente numero e virgula", TipoNotificacao.info);
     }
     if ((e.KeyChar == ',') && ((sender as TextBox).Text.IndexOf('.') > -1))
     {
         e.Handled = true;
         FNotificao.AlerForm("este campo aceita somente uma virgula", TipoNotificacao.info);
     }
 }
Esempio n. 14
0
        //Método para Cadastrar
        private void Cadastrar()
        {
            BllFuncionario bll = new BllFuncionario();
            Funcionario    dto = new Funcionario();

            dto.Operacao     = "Cadastrar";
            dto.NomeCompleto = txtNome.Text;
            dto.NomeUsuario  = txtUsername.Text;
            dto.Senha        = txtSenha.Text;

            dto.Endereco = txtEndereco.Text;
            dto.Telf     = txtTelf.Text;
            dto.Email    = txtEmail.Text;

            if (cbCargo.SelectedIndex == 1)
            {
                dto.CargoId = 1;
            }
            else
            {
                dto.CargoId = 2;
            }
            if (cbEstado.SelectedIndex == 1)
            {
                dto.Estado = true;
            }
            else
            {
                dto.Estado = false;
            }

            string retorno = bll.Cadastrar(dto);

            try
            {
                int id = Convert.ToInt32(retorno);

                //if (id > 0)
                //{
                FNotificao.AlerForm("Funcionário Cadastrado Com Sucesso", TipoNotificacao.sucesso);
                this.DialogResult = DialogResult.Yes;
                //}
            }
            catch
            {
                FNotificao.AlerForm(retorno, TipoNotificacao.aviso);

                //this.DialogResult = DialogResult.No;
            }
        }
Esempio n. 15
0
 //Método para calcular troco
 private void CalcularTroco()
 {
     try
     {
         decimal T, E;
         E             = Convert.ToDecimal(txtEntregou.Text);
         T             = E - Convert.ToDecimal(_ValorTotal);
         txtTroco.Text = T.ToString("C");
     }
     catch (Exception ex)
     {
         FNotificao.AlerForm(ex.Message, TipoNotificacao.erro);
     }
 }
Esempio n. 16
0
        private void btnSelecionar_Click(object sender, EventArgs e)
        {
            if (dgv.RowCount == 0)
            {
                FNotificao.AlerForm("Não Nenhum Fármaco Selecionado", TipoNotificacao.info);
            }
            else
            {
                if (dgv.CurrentRow.Cells[13].Value.ToString() == "Disponível")
                {
                    Estoque es = new Estoque();

                    // txtPrijs textbox está Invisível no Formulario Venda
                    //f.txtPrijs.Text = dgv.CurrentRow.Cells[10].Value.ToString();
                    if (dgv.CurrentRow.Cells[11].Value.ToString() == "")
                    {
                        es.Descricao = "Sem Descrição";
                    }
                    else
                    {
                        es.Descricao = dgv.CurrentRow.Cells[11].Value.ToString();
                    }
                    Funcionario dto = new Funcionario();
                    FVenda      f   = FVenda.getInstancia(dto);
                    f.txtCod.Text    = dgv.CurrentRow.Cells[4].Value.ToString();
                    f.txtDescri.Text = dgv.CurrentRow.Cells[11].Value.ToString();
                    f.txtPreco.Text  = dgv.CurrentRow.Cells[10].Value.ToString();
                    f.txtPrijs.Text  = dgv.CurrentRow.Cells[10].Value.ToString();
                    f.txtEstok.Text  = dgv.CurrentRow.Cells[5].Value.ToString();
                    f.txtProd.Text   = dgv.CurrentRow.Cells[3].Value.ToString();
                    if (dgv.CurrentRow.Cells[12].Value.ToString() == "")
                    {
                        f.picBox.Image = new Bitmap(Application.StartupPath + "\\Imagens\\image_100px.png");
                    }
                    else
                    {
                        f.picBox.Image    = new Bitmap(Application.StartupPath + "\\Imagens\\" + dgv.CurrentRow.Cells[12].Value.ToString());
                        f.picBox.SizeMode = PictureBoxSizeMode.StretchImage;
                    }

                    f.Show();
                    Listar();
                }
                else
                {
                    FNotificao.AlerForm("O Fármaco Selecionaro Não Encontra-se DISPONÍVEL", TipoNotificacao.aviso);
                }
            }
        }
Esempio n. 17
0
        private void btnSair_Click(object sender, EventArgs e)
        {
            string resultado = FNotificao.AlertConfirm("Deseja Encerrar a Caixa?", TipoNotificacao.pergunta);

            if (resultado.Equals("1"))
            {
                FecharCaixa();
                MEstoqueOpera m = new MEstoqueOpera();
                m.FecharMEstoque();  //fechar o formulario M-Estoque
            }
            else
            {
                return;
            }
        }
Esempio n. 18
0
        private void btnFinalizar_Click(object sender, EventArgs e)
        {
            if (dgv.Rows.Count > 0)
            {
                _CaixaId    = lblCaixaFunc.Text; // CaixaFuncionarioId Capturado
                _ValorTotal = lblValor.Text;     // Valor Total Capturado

                FFinalizar frm = new FFinalizar(_CaixaId, _ValorTotal);
                frm.ShowDialog();
            }
            else
            {
                FNotificao.AlerForm("Nenhum Item na Tela de Venda", TipoNotificacao.aviso);
            }
        }
Esempio n. 19
0
        //Método para Editar
        private void Editar()
        {
            BllFuncionario bll = new BllFuncionario();
            Funcionario    dto = new Funcionario();

            dto.Operacao      = "Editar";
            dto.FuncionarioId = Convert.ToInt32(txtCodigo.Text);
            dto.NomeCompleto  = txtNome.Text;
            dto.NomeUsuario   = txtUsername.Text;
            dto.Senha         = txtSenha.Text;

            dto.Endereco = txtEndereco.Text;
            dto.Telf     = txtTelf.Text;
            dto.Email    = txtEmail.Text;

            if (cbCargo.SelectedIndex == 1)
            {
                dto.CargoId = 1;
            }
            else
            {
                dto.CargoId = 2;
            }
            if (cbEstado.SelectedIndex == 1)
            {
                dto.Estado = true;
            }
            else
            {
                dto.Estado = false;
            }

            string retorno = bll.Editar(dto);

            try
            {
                int id = Convert.ToInt32(retorno);

                FNotificao.AlerForm("Dados do Funcionário Editar Com Sucesso", TipoNotificacao.sucesso);
                this.DialogResult = DialogResult.Yes;
            }
            catch
            {
                FNotificao.AlerForm(retorno, TipoNotificacao.erro);
                this.DialogResult = DialogResult.No;
            }
        }
Esempio n. 20
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgv.RowCount == 0)
            {
                FNotificao.AlerForm(" Nenhum Selecionado", TipoNotificacao.aviso);
            }
            else
            {
                string result = FNotificao.AlertConfirm("Deseja Editar os dados do Funcionário #" +
                                                        dgv.CurrentRow.Cells["NomeCompleto"].Value.ToString() + "# ?", TipoNotificacao.pergunta);
                if (result.Equals("1"))
                {
                    FFFuncionario frm = new FFFuncionario(AcaoNaTela.Editar);
                    frm.txtCodigo.Text   = dgv.CurrentRow.Cells["FuncionarioId"].Value.ToString();
                    frm.txtNome.Text     = dgv.CurrentRow.Cells["NomeCompleto"].Value.ToString();
                    frm.txtUsername.Text = dgv.CurrentRow.Cells["NomeUsuario"].Value.ToString();
                    frm.txtTelf.Text     = dgv.CurrentRow.Cells["Telf"].Value.ToString();
                    frm.txtEmail.Text    = dgv.CurrentRow.Cells["Email"].Value.ToString();
                    frm.txtEndereco.Text = dgv.CurrentRow.Cells["Endereco"].Value.ToString();

                    if (dgv.CurrentRow.Cells["Cargo"].Value.ToString() == "Gerente")
                    {
                        frm.cbCargo.SelectedIndex = 1;
                    }
                    else
                    {
                        frm.cbCargo.SelectedIndex = 2;
                    }

                    if (dgv.CurrentRow.Cells["Estado"].Value.ToString() == "Activo")
                    {
                        frm.cbEstado.SelectedIndex = 1;
                    }
                    else
                    {
                        frm.cbEstado.SelectedIndex = 2;
                    }

                    DialogResult DialogResult = frm.ShowDialog();
                    if (DialogResult == DialogResult.Yes)
                    {
                        ListarFuncionario();
                    }
                }
            }
        }
Esempio n. 21
0
        private void btnAtualizar_Click(object sender, EventArgs e)
        {
            if (dgv.RowCount == 0)
            {
                FNotificao.AlerForm("Não Nenhum Farmaco Selecionado", TipoNotificacao.aviso);
            }
            else
            {
                string resultado = FNotificao.AlertConfirm("Deseja Adicionar Estoque do Fármaco #" + dgv.CurrentRow.Cells[3].Value.ToString() + "# ?", TipoNotificacao.pergunta);

                if (resultado == "1")
                {
                    FEstoque frm = new FEstoque(_NomeGlobal, _IdGlobal, _CargoGlobal, AcaoNaTela.Atualizar);
                    frm.IdGlobal       = _IdGlobal;
                    frm.txtCodigo.Text = dgv.CurrentRow.Cells["EstoqueId"].Value.ToString();
                    frm.txtDescr.Text  = dgv.CurrentRow.Cells[2].Value.ToString();

                    frm.txtPrecoCompra.Text = dgv.CurrentRow.Cells[9].Value.ToString();
                    frm.txtPrecoVenda.Text  = dgv.CurrentRow.Cells[10].Value.ToString();
                    frm.txtLote.Text        = dgv.CurrentRow.Cells[8].Value.ToString();
                    //frm.txtEstoq.Text = dgv.CurrentRow.Cells[5].Value.ToString();
                    frm.dataProducao.Text = dgv.CurrentRow.Cells[6].Value.ToString();
                    frm.dataExp.Text      = dgv.CurrentRow.Cells[7].Value.ToString();


                    frm.txtFarmaco.Text     = dgv.CurrentRow.Cells[3].Value.ToString();
                    frm.txtTipoFarmaco.Text = dgv.CurrentRow.Cells[1].Value.ToString();
                    frm.txtDescricao.Text   = dgv.CurrentRow.Cells[11].Value.ToString();

                    if (dgv.CurrentRow.Cells[13].Value.ToString() == "Disponível")
                    {
                        frm.ckActivo.Checked = true;
                    }
                    else
                    {
                        frm.ckActivo.Checked = false;
                    }
                    DialogResult DialogResult = frm.ShowDialog();

                    if (DialogResult == DialogResult.Yes)
                    {
                        Listar();
                    }
                }
            }
        }
Esempio n. 22
0
        //Método para Cadastrar Venda
        private void CadastrarVenda()
        {
            Venda    dto = new Venda();
            BllVenda bll = new BllVenda();

            dto.Operacao   = "Venda";
            dto.CaixaFunc  = Convert.ToInt32(_CaixaId);
            dto.ClienteId  = Convert.ToInt32(txtCodigo.Text);
            dto.ValorTotal = Convert.ToDecimal(ValorTotal);
            if (cbTipoPagam.SelectedIndex == 1)
            {
                dto.TipoPagamento = 1;
            }
            else if (cbTipoPagam.SelectedIndex == 2)
            {
                dto.TipoPagamento = 2;
            }
            else if (cbTipoPagam.SelectedIndex == 3)
            {
                dto.TipoPagamento = 3;
                dataPagam.Enabled = true;
            }
            else
            {
                FNotificao.AlerForm("Tipo de Pagamento Inválido", TipoNotificacao.aviso);
            }


            string retorno = bll.Cadastrar(dto);

            try
            {
                int id = Convert.ToInt32(retorno);
                FNotificao.AlerForm("Venda Efetuada Com Sucesso!!!", TipoNotificacao.sucesso);
                FVenda f = FVenda.getInstancia(null);
                f.CadastrarPedido();
                LimparCampos();
                this.Close();
            }
            catch
            {
                FNotificao.AlerForm("Erro Ao Registrar a Venda " + retorno.ToString(), TipoNotificacao.erro);
            }
        }
Esempio n. 23
0
 private void btnFinalizar_Click(object sender, EventArgs e)
 {
     if (cbTipoPagam.SelectedIndex == 0)
     {
         FNotificao.AlerForm("Selecionar o tipo de Pagamento", TipoNotificacao.aviso);
     }
     else
     {
         if (txtCodigo.Text == string.Empty)
         {
             errorP.SetError(txtCodigo, "Informe o Código do Cliente");
             //txtCodigo.BorderStyle = Color.FromArgb(191, 205, 219);
         }
         else
         {
             CadastrarVenda();
         }
     }
 }
Esempio n. 24
0
        //Método Listar Fornecedor
        private void Listar()
        {
            Fornecedor    dto = new Fornecedor();
            BllFornecedor bll = new BllFornecedor();

            dto.Operacao = "ListarFornecedor";
            try
            {
                DataTable dt = bll.Listar(dto);
                bsGrid.DataSource = dt;
                dgv.DataSource    = bsGrid;
                dgv.Update();
                dgv.Refresh();
            }
            catch (Exception ex)
            {
                FNotificao.AlerForm(ex.Message, TipoNotificacao.erro);
            }
        }
Esempio n. 25
0
        private void btnRemover_Click(object sender, EventArgs e)
        {
            if (dgv.RowCount == 0)
            {
                FNotificao.AlerForm("Não Existe Nenhum Fármaco na Tela", TipoNotificacao.info);
            }
            else
            {
                string resultado = FNotificao.AlertConfirm("Deseja Eliminar o Fármaco Selecionado?", TipoNotificacao.pergunta);

                if (resultado == "1")
                {
                    RetornoEstoque();
                    SomarTotal();
                    SomarItens();
                    LimparCampos();
                }
            }
        }
Esempio n. 26
0
        // Método para Contar o Nr de Venda feita po Caixa
        private void NrVenda()
        {
            Venda    dto = new Venda();
            BllVenda bll = new BllVenda();

            dto.Operacao  = "IdVenda";
            dto.CaixaFunc = Convert.ToInt32(lblCaixaFunc.Text);
            string NrVenda = bll.GerarNrVenda(dto);

            try
            {
                int NrV = Convert.ToInt32(NrVenda);

                lblVenda.Text = NrV.ToString();
            }
            catch
            {
                FNotificao.AlerForm("Erro Ao Gerar Nr de Venda", TipoNotificacao.erro);
            }
        }
Esempio n. 27
0
 private void btnAbrir_Click(object sender, EventArgs e)
 {
     if (Logado == false)
     {
         if (cbCaixa.SelectedIndex != 0)
         {
             AbrirCaixa();
         }
         else
         {
             errorP.SetError(cbCaixa, "!");
             FNotificao.AlerForm("Selecionar o Caixa", TipoNotificacao.aviso);
         }
     }
     else
     {
         FVenda f = FVenda.getInstancia(null);
         f.Show();
     }
 }
Esempio n. 28
0
        // Metodo ReserverPedido
        private void ReservarEstoque()
        {
            if (Convert.ToInt32(txtEstok.Text) < 1)
            {
                errorP.SetError(txtEstok, "Estoque Insuficiente");
            }
            else
            {
                if ((txtQtd.Text != string.Empty) && Convert.ToInt32(txtEstok.Text) < 1)
                {
                    errorP.SetError(txtEstok, "Estoque Insuficiente");
                }
                else
                {
                    BllEstoque bll = new BllEstoque();
                    Estoque    dto = new Estoque();

                    dto.Operacao      = "ReservarEstoque";
                    dto.Quantidade    = Convert.ToInt32(txtQtd.Text);
                    dto.EstoqueId     = Convert.ToInt32(txtCod.Text);
                    dto.FuncionarioId = Convert.ToInt32(_IdGlobal); //ID do funcionário

                    string retorno = bll.Atualizar(dto);
                    try
                    {
                        int id = Convert.ToInt32(retorno);
                        if ((id > 0) && (dto.FuncionarioId > 0))
                        {
                            AddCarrinho();
                            MEstoque      f = new MEstoque(null, null, null, AcaoNaTela.Pesquisar);
                            MEstoqueOpera m = new MEstoqueOpera(); //
                            m.Lis();
                        }
                    }
                    catch
                    {
                        FNotificao.AlerForm(" Erro Ao Adicionar o Fármaco Nº: " + retorno.ToString(), TipoNotificacao.erro);
                    }
                }
            }
        }
Esempio n. 29
0
        //Método Para Carrgar Combo Caixa
        private void CarregarcbCaixa()
        {
            Caixa    dto = new Caixa();
            BllCaixa bll = new BllCaixa();

            dto.Operacao = "Listar";
            try
            {
                DataTable dt      = bll.Listar(dto);
                DataRow   topItem = dt.NewRow();
                topItem[0] = 0;
                topItem[1] = "-- Selecionar Caixa --";
                dt.Rows.InsertAt(topItem, 0);
                cbCaixa.DisplayMember = "Descricao";
                cbCaixa.ValueMember   = "CaixaId";
                cbCaixa.DataSource    = dt;
            }
            catch (Exception ex)
            {
                FNotificao.AlerForm(ex.Message, TipoNotificacao.erro);
            }
        }
Esempio n. 30
0
        //Método para Cadastrar, Editar e Atualizar Estoque
        private void Cadastrar()
        {
            Estoque    dto = new Estoque();
            BllEstoque bll = new BllEstoque();


            dto.Operacao      = "Cadastrar";
            dto.ProdutoId     = Convert.ToInt32(txtCodigo.Text);
            dto.FuncionarioId = Convert.ToInt32(_IdGlobal);
            dto.DataExp       = dataExp.Value;
            dto.DataFabrico   = dataProducao.Value;
            dto.Quantidade    = Convert.ToInt32(txtEstoq.Text);
            dto.Descricao     = txtDescricao.Text;
            dto.Lote          = txtLote.Text;
            dto.PrecoCompra   = Convert.ToDecimal(txtPrecoCompra.Text);
            dto.PrecoVenda    = Convert.ToDecimal(txtPrecoVenda.Text);

            if (ckActivo.Checked == true)
            {
                dto.Estado = true;
            }
            else
            {
                dto.Estado = false;
            }

            try
            {
                string retorno = bll.Cadastrar(dto);
                FNotificao.AlerForm(retorno, TipoNotificacao.sucesso);
                this.DialogResult = DialogResult.Yes;
                LimparCampos();
            }
            catch (Exception ex)
            {
                FNotificao.AlerForm(ex.Message, TipoNotificacao.erro);
                this.DialogResult = DialogResult.No;
            }
        }