//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); } } }
//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); } }
//Método Fechar Caixa private void FecharCaixa() { Funcionario dto = new Funcionario(); BllCaixa bll = new BllCaixa(); dto.Operacao = "FecharCaixa"; dto.CaixaId = Convert.ToInt32(lblCaixaNr.Text); dto.FuncionarioId = Convert.ToInt32(_IdGlobal); dto.CaixaFunc = Convert.ToInt32(lblCaixaFunc.Text); string retorno = bll.FecharCaixa(dto); try { int CaixaId = Convert.ToInt32(retorno); FNotificao.AlerForm("Caixa Nº" + CaixaId.ToString() + " Encerrada Com Sucesso", TipoNotificacao.sucesso); this.Close(); } catch { FNotificao.AlerForm("Erro Detalhes: " + retorno, TipoNotificacao.erro); } }