private void btnVender_Click(object sender, EventArgs e) { try { VendaDTO dto = new VendaDTO(); dto.IdUsuario = UserSession.UsuarioLogado.Id; dto.Data = mkbDataCompra.Text; dto.FormaPagto = Convert.ToString(cboTipoPag.SelectedItem); VendaBusiness buss = new VendaBusiness(); buss.Salvar(dto, carrinhoAdd.ToList()); string msg = "Venda efetuada com sucesso!"; frmMessage tela = new frmMessage(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
public void Cadastro() { try { //Vai intanciar o DTO e dps joga um valor nesse DTO classes.Classes.Cliente.DeptoDTO dto = new classes.Classes.Cliente.DeptoDTO(); dto.Nome = txtDepto.Text; dto.Descricao = txtDecricao.Text; //Chama a função de salvar de business que em sua vez grava essas açoes no DTO classes.Classes.Cliente.DeptoBusiness business = new classes.Classes.Cliente.DeptoBusiness(); business.Salvar(dto); //Exibe de uma msg de suceso string msg = "Departamento cadastrado."; frmMessage tela = new frmMessage(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
private void btnCadastrar_Click(object sender, EventArgs e) { try { FornecedorDTO fornecedor = cboFornecedor.SelectedItem as FornecedorDTO; ItemDTO dto = new ItemDTO(); dto.Nome = txtNome.Text; dto.FornecedorId = fornecedor.Id; dto.Descricao = txtDescricao.Text; dto.Preco = Convert.ToDecimal(nudPreco.Value); ItemBusiness buss = new ItemBusiness(); int pk = buss.Salvar(dto); EstoqueDTO estoque = new EstoqueDTO(); estoque.Produto = txtNome.Text; estoque.ItemProdutoId = pk; estoque.QtdEstocado = 0; EstoqueBusiness business = new EstoqueBusiness(); business.Salvar(estoque); frmMessage tela = new frmMessage(); tela.LoadScreen("Produto cadastrado com sucesso."); tela.ShowDialog(); } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
private void btnAdd_Click(object sender, EventArgs e) { try { ItemDTO dto = cboProduto.SelectedItem as ItemDTO; int quantidade = Convert.ToInt32(nudQtd.Value); for (int i = 0; i < quantidade; i++) { itemAdd.Add(dto); } CarregarGrid(); valor.Add(dto.Preco * quantidade); nudValor.Value = Convert.ToDecimal(valor.Sum()); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
private void button1_Click(object sender, EventArgs e) { try { GastosADTO dto = new GastosADTO(); dto.Nome = txtNome.Text; dto.Descricao = txtDescricao.Text; dto.Data = mktData.Text; dto.Valor = nudValor.Value; GastosABusiness buss = new GastosABusiness(); buss.Salvar(dto); string msg = "Gasto adicionado com sucesso."; frmMessage tela = new frmMessage(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
private void btnCalcular_Click(object sender, EventArgs e) { try { FolhaPagto pagto = new FolhaPagto(); pagto.Salario = Convert.ToDecimal(txtSalario.Text); pagto.Faltas = Convert.ToInt32(nudFaltas.Value); pagto.HoraExtra = Convert.ToDateTime(mkbHE.Text); pagto.Atrasos = Convert.ToDateTime(mkbAtraso.Text); pagto.Domingos = Convert.ToInt32(nudDom.Value); pagto.Percentual = Convert.ToInt32(txtPercent.Text); txtINSS.Text = pagto.CalcularINSS().ToString("F2"); txtIR.Text = pagto.CalcularIR().ToString("F2"); txtFGTS.Text = pagto.CalcularFGTS().ToString("F2"); TxtSalFam.Text = pagto.VerificarSalarioFamilia().ToString("F2"); txtValTrans.Text = pagto.CalcularValeTransporte().ToString("F2"); txtSalLiquido.Text = pagto.CalcularSalarioLiquido().ToString("F2"); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
void CarregarTxt() { try { ItemView item = cboItem.SelectedItem as ItemView; if (item.Nome != null) { txtItem.Text = item.Nome; txtValorTotal.Text = Convert.ToString(item.Preco); txtFornecedor.Text = item.Fornecedor; } else { txtItem.Text = "NULL"; } } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
private void btnSalvar_Click(object sender, EventArgs e) { try { GastosDTO dto = new GastosDTO(); dto.Nome = txtNome.Text; dto.Descricao = txtDescricao.Text; dto.Data = mkbData.Text; dto.Valor = nudValor.Value; GastosBusiness buss = new GastosBusiness(); buss.Salvar(dto); string msg = "Gasto salvo com sucesso!"; frmMessage tela = new frmMessage(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
void CarregarCombos() { try { CargoBusiness buss = new CargoBusiness(); List <CargoDTO> lista = buss.Listar(); cboDepto.ValueMember = nameof(CargoDTO.Id); cboDepto.DisplayMember = nameof(CargoDTO.Nome); cboDepto.DataSource = lista; EstadoBusiness bess = new EstadoBusiness(); List <EstadoDTO> li = bess.Listar(); cboEstado.ValueMember = nameof(EstadoDTO.IdEstado); cboEstado.DisplayMember = nameof(EstadoDTO.Estado); cboEstado.DataSource = li; } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
private void btnSalvar_Click(object sender, EventArgs e) { try { FuncionarioDTO funcionario = cboFuncionario.SelectedItem as FuncionarioDTO; FolhaPagamentoDTO dto = new FolhaPagamentoDTO(); dto.HorasExtras = mkbHE.Text; dto.Faltas = Convert.ToInt32(nudFaltas.Value); dto.SalBruto = Convert.ToDecimal(txtSalario.Text); dto.ImpostoRenda = Convert.ToDecimal(txtIR.Text); dto.Fgts = Convert.ToDecimal(txtFGTS.Text); dto.VLTars = Convert.ToDecimal(txtValTrans.Text); dto.IdFuncio = funcionario.Id; dto.SalLiq = Convert.ToDecimal(txtSalLiquido.Text); dto.Inss = Convert.ToDecimal(txtINSS.Text); dto.SalFamilia = Convert.ToDecimal(TxtSalFam.Text); dto.Data = mkbData.Text; FolhaPagamentoBusiness buss = new FolhaPagamentoBusiness(); buss.Salvar(dto); frmMessage tela = new frmMessage(); tela.LoadScreen("Pagamento registrado com sucesso!"); } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
void GerarCredenciais() { try { string nome = cboFuncionario.Text; ViewFuncionario dto = cboFuncionario.SelectedItem as ViewFuncionario; mkbCPF.Text = dto.Cpf; txtSalario.Text = dto.Salario.ToString(); txtDepto.Text = dto.Depto.ToString(); if (dto.Imagem == string.Empty) { pbxImgFuncionario.Image = null; } else { pbxImgFuncionario.Image = ImagemPlugIn.ConverterParaImagem(dto.Imagem); } } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
void GerarCredenciais() { try { string nome = cboFuncionario.Text; FuncionarioView dto = cboFuncionario.SelectedItem as FuncionarioView; mkbCPF.Text = dto.Cpf; txtSalario.Text = dto.Salario.ToString(); txtDepto.Text = dto.Depto.ToString(); if (dto.Imagem == string.Empty) { pbxImgFuncionario.Image = null; } else { pbxImgFuncionario.Image = ImagemPlugIn.ConverterParaImagem(dto.Imagem); } } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
private void btnAlterar_Click(object sender, EventArgs e) { try { if (funcionario == null) { string msg = "Selecione um registro para Altera-lo."; frmAlert tela = new frmAlert(); tela.LoadScreen(msg); tela.ShowDialog(); } else { frmAlterarFuncionarios screen = new frmAlterarFuncionarios(); screen.LoadScreen(funcionario); screen.ShowDialog(); CarregarGrid(); } } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
private void btnCadatrar_Click(object sender, EventArgs e) { try { ProdutoDTO dto = new ProdutoDTO(); dto.Nome = txtNome.Text; dto.Marca = txtMarca.Text; dto.Descricao = txtDesc.Text; dto.Preco = nudPreco.Value; ProdutoBusiness business = new ProdutoBusiness(); int pk = business.Salvar(dto); EstoqueDTO estoque = new EstoqueDTO(); estoque.Produto = txtNome.Text; estoque.ItemProdutoId = pk; estoque.QtdEstocado = 0; EstoqueBusiness buss = new EstoqueBusiness(); buss.Salvar(estoque); frmMessage tela = new frmMessage(); tela.LoadScreen("Produto registrado com sucesso."); tela.ShowDialog(); } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
private void pictureBox1_Click(object sender, EventArgs e) { try { ItemView dto = cboItem.SelectedItem as ItemView; int quantidade = Convert.ToInt32(nudQtd.Value); for (int i = 0; i < quantidade; i++) { carrinhoAdd.Add(dto); } CarregarGrid(); valor.Add(dto.Preco * quantidade); txtValorTotal.Text = Convert.ToString(valor.Sum()); } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
public void LoadScreen(FuncionarioView dto) { try { this.dto = dto; txtCidade.Text = dto.Cidade; txtEmail.Text = dto.Email; txtNome.Text = dto.Nome; nudSalario.Value = dto.Salario; mkbCEP.Text = dto.Cep; txtEndereco.Text = dto.Rua; txtNum.Text = dto.Numero.ToString(); mkbCPF.Text = dto.Cpf; mkbRG.Text = dto.Rg; mkbTelefone.Text = dto.Telefone; cboDepto.SelectedItem = dto.Depto; cboUF.Text = dto.Estado; txtComplemento.Text = dto.Complemento; pbxFoto.Image = ImagemPlugIn.ConverterParaImagem(dto.Imagem); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
private void btnSalvar_Click(object sender, EventArgs e) { try { DeptoDTO depto = cboDepto.SelectedItem as DeptoDTO; EstadoDTO estado = cboUF.SelectedItem as EstadoDTO; FuncionarioDTO dto = new FuncionarioDTO(); dto.Nome = txtNome.Text; dto.Rg = mkbRG.Text; dto.Salario = nudSalario.Value; dto.Cpf = mkbCPF.Text; dto.Telefone = mkbTelefone.Text; dto.Email = txtEmail.Text; dto.IdDepto = depto.Id; dto.Cidade = txtCidade.Text; dto.IdEstado = estado.Id; dto.Cep = mkbCEP.Text; dto.Rua = txtEndereco.Text; dto.Complemento = txtComplemento.Text; dto.Numero = txtNum.Text; dto.Imagem = ImagemPlugIn.ConverterParaString(pbxFoto.Image); FuncionarioBusiness buss = new FuncionarioBusiness(); buss.Salvar(dto); frmMessage tela = new frmMessage(); tela.LoadScreen("Funcionário cadastrado com sucesso!"); tela.ShowDialog(); } catch (MySqlException mex) { if (mex.Number == 1062) { string msg = "Funcionario já está cadastrado. Verifique se o CPF está corretamente preenchido ou se ele já esta no sistema."; frmAlert tela = new frmAlert(); tela.LoadScreen(msg); tela.ShowDialog(); } } catch (ValidacaoException vex) { string msg = vex.Message; frmAlert tela = new frmAlert(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
private void button1_Click(object sender, EventArgs e) { try { EstadoDTO estado = cboEstado.SelectedItem as EstadoDTO; FornecedoresDTO dto = new FornecedoresDTO(); dto.Nome = txtNome.Text; dto.Email = txtEmail.Text; dto.CNPJ = txtCnpj.Text; dto.Cidade = txtCidade.Text; dto.CEP = mkbCep.Text; dto.Telefone = txtTelefone.Text; dto.IdEstado = estado.Id; dto.Rua = txtRua.Text; dto.Numero = txtNumero.Text; FornecedoresBusiness business = new FornecedoresBusiness(); business.Salvar(dto); string msg = "Fornecedor cadastrado com sucesso!"; frmMessage tela = new frmMessage(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (ValidacaoException vex) { string msg = vex.Message; frmAlert tela = new frmAlert(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (MySqlException mex) { if (mex.Number == 1062) { string msg = "Esse fornecedor já está cadastrado. " + "Verifique se o CNPJ está corretamente preenchido ou se ele já está cadastrado no sistema."; frmAlert tela = new frmAlert(); tela.LoadScreen(msg); tela.ShowDialog(); } } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
private void btnSalvar_Click(object sender, EventArgs e) { try { DeptoDTO depto = cboDepto.SelectedItem as DeptoDTO; EstadoDTO estado = cboUF.SelectedItem as EstadoDTO; int funcio = this.dto.Id; FuncionarioDTO dto = new FuncionarioDTO(); dto.Id = funcio; dto.Nome = txtNome.Text; dto.Rg = mkbRG.Text; dto.Salario = nudSalario.Value; dto.Cpf = mkbCPF.Text; dto.Telefone = mkbTelefone.Text; dto.Email = txtEmail.Text; dto.IdDepto = depto.Id; dto.Cidade = txtCidade.Text; dto.IdEstado = estado.Id; dto.Cep = mkbCEP.Text; dto.Rua = txtEndereco.Text; dto.Numero = txtNum.Text; dto.Imagem = ImagemPlugIn.ConverterParaString(pbxFoto.Image); dto.Complemento = txtComplemento.Text; FuncionarioBusiness buss = new FuncionarioBusiness(); buss.Alterar(dto); string msg = "Funcionário alterado com sucesso!"; frmMessage tela = new frmMessage(); tela.LoadScreen(msg); tela.ShowDialog(); this.Close(); } catch (ValidacaoException vex) { string msg = vex.Message; frmAlert tela = new frmAlert(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
private void btnBuscar_Click(object sender, EventArgs e) { try { CarregarGrid(); } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
private void btnProcurar_Click(object sender, EventArgs e) { try { CarregarGrid(); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
void Autocarregar() { try { FornecedorBusiness buss = new FornecedorBusiness(); List <FornecedorView> lista = buss.ListarPraGrid(); dgvFornecedor.DataSource = lista; } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
void AutoCarregar() { try { ItemBusiness buss = new ItemBusiness(); List <ItemView> lista = buss.Listar(); dgvProduto.DataSource = lista; } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
private void btnAlterar_Click(object sender, EventArgs e) { try { EstadoDTO dto = cboUF.SelectedItem as EstadoDTO; ClienteDTO dta = new ClienteDTO(); dta.id = this.cliente.id; dta.Nome = txtNome.Text; dta.Email = txtEmail.Text; dta.DataNascimento = mkbNascimento.Text; dta.Rg = mkbRG.Text; dta.Cpf = mkbCPF.Text; dta.Telefone = mkbTelefone.Text; dta.Cidade = txtCidade.Text; dta.DataCadastro = mkbCadastro.Text; dta.Cep = txtCEP.Text; dta.Rua = txtRua.Text; dta.Numero = txtNumero.Text; dta.EstadoId = Convert.ToInt32(dto.Id); dta.Complemento = txtComplemento.Text; ClienteBusiness business = new ClienteBusiness(); business.Alterar(dta); string msg = "Cliente Cadastrado com sucesso"; frmMessage tela = new frmMessage(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (ValidacaoException vex) { frmAlert tela = new frmAlert(); tela.LoadScreen(vex.Message); tela.ShowDialog(); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
void AutoCarregar() { try { VendaBusiness buss = new VendaBusiness(); List <ProdutoVendasView> lista = buss.Listar(); dgvProduto.AutoGenerateColumns = false; dgvProduto.DataSource = lista; } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
public void AutoCarregar() { try { CargoBusiness buss = new CargoBusiness(); List <CargoDTO> dto = buss.Listar(); dgvDepto.AutoGenerateColumns = false; dgvDepto.DataSource = dto; } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
void AutoCarregar() { try { GastosABusiness buss = new GastosABusiness(); List <GastosADTO> lista = buss.Listar(); dgvGastos.AutoGenerateColumns = false; dgvGastos.DataSource = lista; } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
void AutoCarregarGrid() { try { EstoqueBusiness buss = new EstoqueBusiness(); List <EstoqueDTO> list = buss.Listar(); dgvEstoque.AutoGenerateColumns = false; dgvEstoque.DataSource = list; } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
void AutoCarregar() { try { CompraBusiness bus = new CompraBusiness(); List <ItemComprasView> dto = bus.Listar(); dgvCompra.AutoGenerateColumns = false; dgvCompra.DataSource = dto; } catch (Exception) { frmException tela = new frmException(); tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema."); tela.ShowDialog(); } }
private void button1_Click(object sender, EventArgs e) { try { EstadoDTO estado = cboEstado.SelectedItem as EstadoDTO; FornecedoresDTO dto = new FornecedoresDTO(); dto.Id = this.fornecedor.Id; dto.Nome = txtNome.Text; dto.Email = txtEmail.Text; dto.CNPJ = txtCnpj.Text; dto.Cidade = txtCidade.Text; dto.CEP = mkbCep.Text; dto.Telefone = txtTelefone.Text; dto.IdEstado = estado.Id; dto.Rua = txtRua.Text; dto.Numero = txtNumero.Text; FornecedoresBusiness business = new FornecedoresBusiness(); business.Alterar(dto); string msg = "Fornecedor alterado com sucesso!"; frmMessage tela = new frmMessage(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (ValidacaoException vex) { string msg = vex.Message; frmAlert tela = new frmAlert(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }