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 buttonAdd_Click(object sender, EventArgs e) { if (img != null) { if (string.IsNullOrEmpty(textBoxDescricaoProd.Text)) { FormMessage.ShowMessegeWarning("Informe uma descrição para este prêmio!"); textBoxDescricaoProd.Select(); return; } infoProd = new ProdutoInfo { produtodescricao = textBoxDescricaoProd.Text, produtofoto = ConvertImagem(img), produtovalor = Convert.ToDecimal(textBoxValor.Text) }; negSort = new SorteioNegocio(); negSort.ExecutarProduto(enumCRUD.insert, infoProd); FormMessage.ShowMessegeInfo("Prêmio lançado com sucesso!"); pictureBox1.Image = Properties.Resources.portateis; textBoxDescricaoProd.Clear(); textBoxDescricaoProd.Select(); textBoxValor.Text = "1,00"; FormProduto formProduto = (FormProduto)Application.OpenForms["FormProduto"]; formProduto.PreencherLista(); } else { FormMessage.ShowMessegeWarning("Selecione uma imagem para este prêmio!"); } }
public void PreencherLista() { negSort = new SorteioNegocio(); ProdutoColecao colProd = (ProdutoColecao)negSort.ExecutarProduto(enumCRUD.select); flowLayoutPanel1.Controls.Clear(); if (colProd != null) { foreach (var item in colProd) { UserControlProdDescricao prod = new UserControlProdDescricao { Prod = item }; flowLayoutPanel1.Controls.Add(prod); } } }