private void buttonSort_Click(object sender, EventArgs e) { negSort = new SorteioNegocio(); SorteioColecao colSort = (SorteioColecao)negSort.ExecutarSorteio(enumCRUD.select); 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) { textBoxIdSort.Text = consult.Selecionado.Cod; textBoxDescricaoSort.Text = consult.Selecionado.Descricao; infoSort = (SorteioInfo)consult.Selecionado.Objeto; ListaBilhete(); } } }
private void buttonSort_Click(object sender, EventArgs e) { negSort = new SorteioNegocio(); SorteioColecao colSort; if (Form1.Online) { colSort = (SorteioColecao)negSort.ExecutarSorteio(enumCRUD.select); } else { if (Form1.colB != null) { colSort = new SorteioColecao { Form1.colB[0].bilheteidsorteio }; } else { colSort = null; } } 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; flowLayoutPanelBilhete.Controls.Clear(); flowLayoutPanelProd.Controls.Clear(); infoSort = (SorteioInfo)consult.Selecionado.Objeto; textBoxDescricaoSort.Text = consult.Selecionado.Descricao; dateTimePicker1.Value = infoSort.sorteiodata; numericUpDown1.Value = infoSort.sorteiobilhetequant; textBoxValor.Text = Convert.ToString(infoSort.sorteiobilhetevalor); ContarItens(); buttonSortear.Enabled = true; this.Cursor = Cursors.Default; } } } }
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; } } } }