private void frmSelecionarTipo_Load(object sender, EventArgs e) { localhostAmx.Almoxarifado buscaTipo = new localhostAmx.Almoxarifado(); cmbTipo.DisplayMember = "Status"; cmbTipo.ValueMember = "Status"; cmbTipo.DataSource = buscaTipo.RetornaComboTipo(); }
private void CarregarGrid() { localhostAmx.Almoxarifado buscaProduto = new localhostAmx.Almoxarifado(); grdGerenciamento.AutoGenerateColumns = false; grdGerenciamento.DataSource = null; grdGerenciamento.DataSource = buscaProduto.RetornaProduto(); grdGerenciamento.Show(); }
private void CarregarGrid() { localhostAmx.Almoxarifado buscaEstoque = new localhostAmx.Almoxarifado(); string Tipo = BuscarTipo.BuscaTipo.ToString(); grdGerenciamento.AutoGenerateColumns = false; grdGerenciamento.DataSource = null; grdGerenciamento.DataSource = buscaEstoque.RetornaEstoque(Tipo); grdGerenciamento.Show(); txtNumeroProdutos.Text = grdGerenciamento.RowCount.ToString(); }
private void btnGravar_Click(object sender, EventArgs e) { try { if (txtCod.Text == "" || txtNome.Text == "" || txtQtdEst.Text == "" || txtQtdMax.Text == "" || txtQtdMin.Text == "" || txtTipo.Text == "") { MessageBox.Show("OOPS! Tem algum dado faltando!", "Usuário", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { localhostAmx.Almoxarifado cadastroProduto = new localhostAmx.Almoxarifado(); string CodigoProduto = txtCod.Text; string Nome = txtNome.Text; double Preco = Convert.ToDouble(txtPreco.Text.Replace(".", "").Replace(",", ".")); string UnidadeMedida = cmbUM.SelectedItem.ToString(); float QtdMinima = float.Parse(txtQtdMin.Text.Replace(".", "").Replace(",", ".")); float QtdMaxima = float.Parse(txtQtdMax.Text.Replace(".", "").Replace(",", ".")); float QtdEstoque = float.Parse(txtQtdEst.Text.Replace(".", "").Replace(",", ".")); string Tipo = txtTipo.Text; int IdProduto = cadastroProduto.CadastroProduto(CodigoProduto, Nome, Preco, UnidadeMedida, QtdMinima, QtdMaxima, QtdEstoque, Tipo); if (IdProduto > 0) { cadastroProduto.CadastroProdutoEstoque(IdProduto, QtdMinima, QtdMaxima, QtdEstoque); DialogResult dialogResult = MessageBox.Show("Cadastrado com Sucesso!\nDeseja continuar cadastrando?", "Usuário", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dialogResult == DialogResult.Yes) { LimparCampos(); } else { this.Close(); } } else { MessageBox.Show("Erro ao gravar Produto!!!", "Usuário", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGrSolic_Click(object sender, EventArgs e) { try { localhostAmx.Almoxarifado solicitacao = new localhostAmx.Almoxarifado(); double Valor = 0; double ValorTotal = 0; double valor1 = 0; double valor2 = 0; foreach (DataGridViewRow row in grdGerenciamento.Rows) { valor1 = Double.Parse(row.Cells[3].Value.ToString()); valor2 = Double.Parse(row.Cells[7].Value.ToString()); Valor = valor1 * valor2; ValorTotal = ValorTotal + Valor; } txtValor.Text = ValorTotal.ToString("N2"); DialogResult dialogResult = MessageBox.Show("Gerar uma Solicitação de Compra?", "Confirmação", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { string Solicitante = txtSolicitante.Text; string Urgencia = cmbUrgencia.SelectedItem.ToString(); string Motivo = txtMotivo.Text; string Tipo = BuscarTipo.BuscaTipo; bool Gravar = false; bool GravarItem = false; if (Urgencia == "" || Urgencia == null || Motivo == "" || Motivo == null || Solicitante == "" || Solicitante == null) { MessageBox.Show("Algum dado está faltando!", "Confirmação", MessageBoxButtons.OK); } else { int IdPedido = solicitacao.GerarPedido(Solicitante, Urgencia, Motivo, Tipo, ValorTotal); if (IdPedido > 0) { Gravar = true; foreach (DataGridViewRow row in grdGerenciamento.Rows) { var obj = (localhostAmx.Estoque)grdGerenciamento.CurrentRow.DataBoundItem; string Cod = row.Cells[0].Value.ToString(); string Nome = row.Cells[1].Value.ToString(); string UnidadeMedida = row.Cells[2].Value.ToString(); double Preco = Convert.ToDouble(row.Cells[3].Value); double QtdEstoque = Convert.ToDouble(row.Cells[4].Value); double QtdMinima = Convert.ToDouble(row.Cells[5].Value); double QtdMaxima = Convert.ToDouble(row.Cells[6].Value); double Solicitar = Convert.ToDouble(row.Cells[7].Value); if (solicitacao.GerarPedidoItem(Cod, Nome, QtdEstoque, QtdMaxima, QtdMinima, UnidadeMedida, Solicitar, IdPedido)) { GravarItem = true; } } } if (Gravar == true && GravarItem == true) { MessageBox.Show("Pedido de Compra realizado com Sucesso!", "Confirmação", MessageBoxButtons.OK); frmSolicitacaoCompraRelatorio relatorioCompra = new frmSolicitacaoCompraRelatorio(); relatorioCompra.Pedido = IdPedido; relatorioCompra.Show(); this.Close(); } else { MessageBox.Show("Ocorreu um Erro ao gravar o Pedido de Compra!", "Confirmação", MessageBoxButtons.OK); } } } } catch (Exception ex) { MessageBox.Show("Ocorreu um Erro! \nDados do Erro:\n " + ex.ToString(), "Confirmação", MessageBoxButtons.OK); } }