private void RequisicaoForm_Load(object sender, EventArgs e) { txtIDSetor.Enabled = false; txtNomeProduto.Enabled = false; txtIDProduto.Enabled = false; txtQuantidadeProduto.Enabled = false; txtData.Enabled = false; gpbPesquisa.Visible = false; CAMADAS.BLL.Setor bllSetor = new CAMADAS.BLL.Setor(); cbSetor.DisplayMember = "nome"; cbSetor.ValueMember = "id"; cbSetor.DataSource = bllSetor.Select(); CAMADAS.BLL.Almoxarifado bllAlmoxarifado = new CAMADAS.BLL.Almoxarifado(); dgvProdutos.DataSource = ""; dgvProdutos.DataSource = bllAlmoxarifado.Select(); CAMADAS.BLL.Requisicao bllRequisicao = new CAMADAS.BLL.Requisicao(); dgvRequisicoes.DataSource = ""; dgvRequisicoes.DataSource = bllRequisicao.Select(); habilitaControles(false); }
private void btnRemover_Click(object sender, EventArgs e) { CAMADAS.BLL.Almoxarifado bllAlmo = new CAMADAS.BLL.Almoxarifado(); string msg = "Não há dados selecionado para remover"; string titBox = "Erro"; if (lblID.Text != "") { msg = "Deseja Remover o Item: " + txtItem.Text; DialogResult resposta = MessageBox.Show(msg, titBox, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (resposta == DialogResult.Yes) { int id = Convert.ToInt32(lblID.Text); bllAlmo.Delete(id); } } else { MessageBox.Show(msg, titBox, MessageBoxButtons.OK, MessageBoxIcon.Warning); } limpaControles(); dgvItens.DataSource = bllAlmo.Select(); }
private void AlmoxarifadoForm_Load(object sender, EventArgs e) { CAMADAS.BLL.Fornecedor bllFornecedor = new CAMADAS.BLL.Fornecedor(); cbFornecedor.DisplayMember = "nome"; cbFornecedor.ValueMember = "id"; cbFornecedor.DataSource = bllFornecedor.Select(); CAMADAS.BLL.Almoxarifado bllAlmo = new CAMADAS.BLL.Almoxarifado(); dgvItens.DataSource = ""; dgvItens.DataSource = bllAlmo.Select(); habilitaControles(false); }
private void btnGravar_Click(object sender, EventArgs e) { CAMADAS.BLL.Almoxarifado bllAlmo = new CAMADAS.BLL.Almoxarifado(); string msg = ""; string titMsg = ""; if (lblID.Text == "-1") { msg = "Deseja Inserir novo Item?"; titMsg = "Inserir"; } else { msg = "Deseja Alterar o Item?"; titMsg = "Atualizar"; } DialogResult resposta = MessageBox.Show(msg, titMsg, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (resposta == DialogResult.Yes) { CAMADAS.MODEL.Almoxarifado almoxarifado = new CAMADAS.MODEL.Almoxarifado(); almoxarifado.id = Convert.ToInt32(lblID.Text); almoxarifado.fornecedorID = Convert.ToInt32(txtFornecedor.Text); almoxarifado.nome = txtItem.Text; almoxarifado.quantidade = Convert.ToInt32(txtQuantidade.Text); if (lblID.Text == "-1") { bllAlmo.Insert(almoxarifado); } else { bllAlmo.Update(almoxarifado); } } limpaControles(); habilitaControles(false); dgvItens.DataSource = bllAlmo.Select(); }
public static void gerarReqAlmoxarifado() { CAMADAS.BLL.Almoxarifado bllAlmo = new CAMADAS.BLL.Almoxarifado(); List <CAMADAS.MODEL.Almoxarifado> lstAlmoxarifado = new List <CAMADAS.MODEL.Almoxarifado>(); lstAlmoxarifado = bllAlmo.Select(); string pasta = Funcao.diretorioPasta(); string arquivo = pasta + @"\RelatorioAlmoxarifado.html"; StreamWriter sw = new StreamWriter(arquivo); using (sw) { sw.WriteLine("<html lang='pt-br'>"); sw.WriteLine("<head>"); sw.WriteLine("<meta charset='UTF - 8'>"); sw.WriteLine("<meta name='viewport' content='width = device - width, initial - scale = 1.0'>"); sw.WriteLine("<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css' integrity='sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk' crossorigin='anonymous'>"); sw.WriteLine("<title>Relatorio Almoxarifado</title>"); sw.WriteLine("</head>"); sw.WriteLine("<body>"); sw.WriteLine("<br><hr border='5px' />"); sw.WriteLine("<h1> Relatório do Almoxarifado </h1>"); sw.WriteLine("<hr border='5px' /><br>"); sw.WriteLine("<table class='table'>"); sw.WriteLine("<thead class='thead-dark'>"); sw.WriteLine("<tr align='center'>"); sw.WriteLine("<th>ID</th>"); sw.WriteLine("<th>FORNECEDOR</th>"); sw.WriteLine("<th>PRODUTO</th>"); sw.WriteLine("<th>QUANTIDADE</th>"); sw.WriteLine("</thead class='thead-dark'>"); sw.WriteLine("</tr>"); int cont = 0; foreach (CAMADAS.MODEL.Almoxarifado almoxarifado in lstAlmoxarifado) { sw.WriteLine("<tr align='center'>"); sw.WriteLine("<th scope='row'>" + almoxarifado.id + "</th>"); sw.WriteLine("<td>" + almoxarifado.fornecedor + "</td>"); sw.WriteLine("<td>" + almoxarifado.nome + "</td>"); sw.WriteLine("<td>" + almoxarifado.quantidade + "</td>"); sw.WriteLine("</tr>"); cont++; } sw.WriteLine("</table>"); sw.WriteLine("<h5> Quantidade de Itens no Almoxarifado: " + cont + "</h5>"); sw.WriteLine(""); sw.WriteLine("</body>"); sw.WriteLine("</html>"); } System.Diagnostics.Process.Start(arquivo); }