static public void ListaTxt() { SerializarNegocios sn = new SerializarNegocios(path); sn.CriarPasta(); SorteioNegocio negSort = new SorteioNegocio(); ConcorrenteNegocio negoConc = new ConcorrenteNegocio(); ConcorrenteColecao colC = (ConcorrenteColecao)negoConc.ExecutarConcorrente(enumCRUD.select, null, true); BilheteColecao colB = (BilheteColecao)negSort.ExecutarBilhete(enumCRUD.select, new BilheteInfo { bilheteidsorteio = new SorteioInfo { sorteioid = 1 }, bilheteidconcorrente = new ConcorrenteInfo(), bilheteidvendedor = new ConcorrenteInfo() }); StringBuilder txt = new StringBuilder(); txt.Append("LISTA DOS CONCORRENTES DO " + colB.First().bilheteidsorteio.sorteiodescricao); txt.AppendLine(); txt.AppendLine("TOTAL DE BILHETES VENDIDOS: " + string.Format("{0:000}", colB.Count) + "\t\tTOTAL EM VENDAS: " + string.Format("{0:C2}", colB.FirstOrDefault().bilheteidsorteio.sorteiobilhetevalor *colB.Count)); txt.AppendLine(); txt.AppendLine(); foreach (var b in colB.OrderBy(o => o.bilhetenum)) { txt.Append("Bilhete: " + string.Format("{0:000}", b.bilhetenum) + "; " + "Concorrente: " + b.bilheteidconcorrente.concorrentenome + "; Vendedor: " + colC.Where(w => w.concorrenteid == b.bilheteidvendedor.concorrenteid).FirstOrDefault().concorrentenome); txt.AppendLine(); } GravarTxt(txt.ToString(), "listaconcorrente.txt"); }
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); }
static public void desSerial() { SerializarNegocios sn = new SerializarNegocios(path); Form1.colC = (ConcorrenteColecao)sn.DesserializarObjeto("colC.lvt"); Form1.colV = (ConcorrenteColecao)sn.DesserializarObjeto("colV.lvt"); Form1.colB = (BilheteColecao)sn.DesserializarObjeto("colB.lvt"); Form1.colP = (ProdutoColecao)sn.DesserializarObjeto("colP.lvt"); Form1.colI = (SorteioItemColecao)sn.DesserializarObjeto("colI.lvt"); }