public FormNumSorteio(SorteioInfo sort, SorteioItemColecao item, BilheteColecao bilhete) { Inicializar(); infoSort = sort; colItens = item; colBilhete = bilhete; }
static public void Serial() { SerializarNegocios sn = new SerializarNegocios(path); SorteioNegocio negSort = new SorteioNegocio(); ConcorrenteNegocio negoConc = new ConcorrenteNegocio(); ConcorrenteColecao colC = (ConcorrenteColecao)negoConc.ExecutarConcorrente(enumCRUD.select); sn.SerializarObjeto(colC, "colC.lvt", true); ConcorrenteColecao colV = (ConcorrenteColecao)negoConc.ExecutarConcorrente(enumCRUD.select, null, true); sn.SerializarObjeto(colV, "colV.lvt", true); BilheteColecao colB = (BilheteColecao)negSort.ExecutarBilhete(enumCRUD.select, new BilheteInfo { bilheteidsorteio = new SorteioInfo { sorteioid = 1 }, bilheteidconcorrente = new ConcorrenteInfo(), bilheteidvendedor = new ConcorrenteInfo() }); sn.SerializarObjeto(colB, "colB.lvt", true); ProdutoColecao colP = (ProdutoColecao)negSort.ExecutarProduto(enumCRUD.select); sn.SerializarObjeto(colP, "colP.lvt", true); SorteioItemColecao colI = (SorteioItemColecao)negSort.ExecutarSorteioItem(enumCRUD.select, new SorteioItemInfo { Sort = new SorteioInfo { sorteioid = 1 }, Prod = new ProdutoInfo() }); sn.SerializarObjeto(colI, "colI.lvt", true); }
private void ContarItens() { flowLayoutPanelProd.Controls.Clear(); SorteioItemInfo i = new SorteioItemInfo { Sort = infoSort, Prod = new ProdutoInfo() }; if (Form1.Online) { colItem = (SorteioItemColecao)negSort.ExecutarSorteioItem(enumCRUD.select, i); } else { colItem = Form1.colI; } if (colItem != null) { foreach (var item in colItem) { UserControlProd prod = new UserControlProd(true) { Produto = item.Prod, Quant = item.Quant }; flowLayoutPanelProd.Controls.Add(prod); } } int totalQuant = 0; decimal totalValorProd = 0; foreach (var item in flowLayoutPanelProd.Controls) { UserControlProd prod = (UserControlProd)item; totalQuant += prod.Quant; totalValorProd += (prod.Produto.produtovalor * prod.Quant); } labelTotalQuant.Text = "Total de PrĂªmios: " + string.Format("{0:000}", totalQuant); labelTotalValorProd.Text = "Valor Total de PrĂªmios: " + string.Format("{0:C2}", totalValorProd); labelTotalValorBilhete.Text = "Valor Total de Bilhetes: " + string.Format("{0:C2}", infoSort != null ? infoSort.sorteiobilhetequant * infoSort.sorteiobilhetevalor : 0); ListaBilhete(); }
private SorteioItemColecao PreencherSorteioItemColecao(DataTable dataTable) { var colecao = new SorteioItemColecao(); foreach (DataRow row in dataTable.Rows) { var sort = new SorteioItemInfo { ID = Convert.ToInt32(row["itemid"]), Prod = PreencherProdutoInfo(row), Sort = PreencherSorteioInfo(row), Quant = Convert.ToInt32(row["itemprodquant"]), }; colecao.Add(sort); } return(colecao); }
private void buttonSort_Click(object sender, EventArgs e) { negSort = new SorteioNegocio(); SorteioColecao colSort = (SorteioColecao)negSort.ExecutarSorteio(enumCRUD.select); if (colSort != null) { var colecao = new Form_ConsultarColecao(); foreach (var item in colSort) { Form_Consultar form = new Form_Consultar { Cod = string.Format("{0:00000}", item.sorteioid), Descricao = item.sorteiodescricao, Objeto = item, }; colecao.Add(form); } using (FormConsultar_Cod_Descricao consult = new FormConsultar_Cod_Descricao(colecao, "SORTEIO")) { if (consult.ShowDialog(this) == DialogResult.Yes) { this.Cursor = Cursors.WaitCursor; infoSort = (SorteioInfo)consult.Selecionado.Objeto; textBoxDescricaoSort.Text = consult.Selecionado.Descricao; dateTimePicker1.Value = infoSort.sorteiodata; numericUpDown1.Value = infoSort.sorteiobilhetequant; textBoxValor.Text = Convert.ToString(infoSort.sorteiobilhetevalor); flowLayoutPanelProd.Controls.Clear(); SorteioItemInfo i = new SorteioItemInfo { Sort = infoSort, Prod = new ProdutoInfo() }; SorteioItemColecao colItem = (SorteioItemColecao)negSort.ExecutarSorteioItem(enumCRUD.select, i); if (colItem != null) { foreach (var item in colItem) { UserControlProd prod = new UserControlProd { Produto = item.Prod, Quant = item.Quant }; flowLayoutPanelProd.Controls.Add(prod); } ContarItens(); } PreencherTree(); buttonSalvar.Enabled = true; buttonRemover.Enabled = true; this.Cursor = Cursors.Default; } } } }