private void txtCodigo_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (13)) { this.dataListado.DataSource = NStock.BuscarStockCodigo(this.txtCodigo.Text); this.OcultarColumnas(); lblTotal.Text = "Total de registros: " + Convert.ToString(dataListado.Rows.Count); } }
private void btnSalvar_Click(object sender, EventArgs e) { try { List <StockVestuarioFarda> Lstock = new List <StockVestuarioFarda>(); foreach (DataGridViewRow row in dgvListaItems.Rows) { var farda = new Farda((int)row.Cells["IdFarda"].Value); var serie = new Serie((int)row.Cells["IdSerie"].Value); var numeroVestuario = new NumeroVestuario((int)row.Cells["IdNumero"].Value); int quantidade = (int)row.Cells["Quantidade"].Value; var itens = new StockVestuarioFarda(serie, farda, numeroVestuario, quantidade); Lstock.Add(itens); } MovimentoStock movimento = new MovimentoStock() { Descricao = "Entrada de Ecomenda nº " + txtCodigo.Text, DataMovimento = DateTime.Now, Militar = ElementosEstaticos.Militar, TipoMovimento = EnumList.TipoMovimento.Entrada }; foreach (var item in Lstock) { NStock nStock = new NStock(); string resposta = nStock.Insert(item, movimento); } //Imprimir DGVPrinter printer = new DGVPrinter(); printer.ListColumns = new List <string>() { "Serie", "Farda", "Vestuario", "Numero", "Quantidade" }; printer.Title = "Ecomenda de Vestuário"; printer.SubTitle = string.Format("{0} - {1}", movimento.Descricao, DateTime.Now.ToString("dd-MMMM-yyyy hh:mm")); printer.SubTitleFormatFlags = StringFormatFlags.LineLimit | StringFormatFlags.NoClip; printer.PageNumbers = true; printer.PageNumberInHeader = false; printer.PorportionalColumns = true; printer.HeaderCellAlignment = StringAlignment.Near; printer.Footer = ElementosEstaticos.Unidade.Nome; printer.FooterSpacing = 15; printer.PrintDataGridView(dgvListaItems); Limpar(); } catch (Exception ex) { MessageBox.Show("Um erro impedio a execução da operação.\r\nErro: " + ex.Message, ElementosEstaticos.Unidade.Nome, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void GetStock() { try { NStock stock = new NStock(); var lista = stock.ConsultarStock(); EStockBindingSource.DataSource = lista; } catch (Exception e) { MessageBox.Show(e.Message, "Error - Obtener datos de stock", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.reportViewer1.RefreshReport(); } }
private void BuscarNombre() { this.dataListado.DataSource = NStock.BuscarStockNombre(this.txtBuscar.Text); this.OcultarColumnas(); lblTotal.Text = "Total de registros: " + Convert.ToString(dataListado.Rows.Count); }
//Método mostrar private void Mostrar() { this.dataListado.DataSource = NStock.Mostrar(); this.OcultarColumnas(); lblTotal.Text = "Total de registros: " + Convert.ToString(dataListado.Rows.Count); }