private void btnAddProduto_Click(object sender, EventArgs e) { frmAdicionarIngresso tela = new frmAdicionarIngresso(); List <VOCadeiraIngressoCinema> cadeira = new List <VOCadeiraIngressoCinema>(); foreach (var item in this.ingressosAll) { VOCadeiraIngressoCinema dados = new VOCadeiraIngressoCinema(); dados.IdFilme = item.IdSessao; dados.Cadeira = item.NumeroDaCadeira; cadeira.Add(dados); } tela.CadeirasIndex = cadeira; tela.ShowDialog(); DTOIngressoSessao dadosIngresso = tela.Ingresso; if (dadosIngresso != null && dadosIngresso.NumeroDaCadeira > 0) { dadosIngresso.DtCompra = dtpData.Value; dadosIngresso.Cpf = txtCpf.Text; ingressosAll.Add(dadosIngresso); string meiaOuInteira = dadosIngresso.BtMeia == true ? "Meia" : "Inteira"; lstIngressos.Items.Add(dadosIngresso.NomeDoFilme + " -> Assento " + dadosIngresso.NumeroDaCadeira.ToString() + " -> " + meiaOuInteira + " -> R$ " + (meiaOuInteira == "Meia" ? dadosIngresso.AllPreco.Valor / 2 : dadosIngresso.AllPreco.Valor).ToString()); lblPrecoTotal.Text = lblPrecoTotal.Text == "PREÇO TOTAL" ? "0" : lblPrecoTotal.Text; lblPrecoTotal.Text = meiaOuInteira == "Meia"? (decimal.Parse(lblPrecoTotal.Text) + (dadosIngresso.AllPreco.Valor / 2)).ToString() : (decimal.Parse(lblPrecoTotal.Text) + dadosIngresso.AllPreco.Valor).ToString(); lstIngressos.SelectedIndex = 0; } }
public void Carregar() { VendaIngressoBusiness ccadeira = new VendaIngressoBusiness(); foreach (var item in ccadeira.Cadeira(IdSessao)) { VOCadeiraIngressoCinema dados = new VOCadeiraIngressoCinema(); dados.IdFilme = IdSessao; dados.Cadeira = item; this.CadeirasIndex.Add(dados); } foreach (var item in CadeirasIndex) { if (item.IdFilme == IdSessao) { btn1.Enabled = item.Cadeira == 1 || btn1.Enabled == false ? false : true; if (!btn1.Enabled) { btn1.BackColor = Color.Black; } btn2.Enabled = item.Cadeira == 2 || btn2.Enabled == false ? false : true; if (!btn2.Enabled) { btn2.BackColor = Color.Black; } btn3.Enabled = item.Cadeira == 3 || btn3.Enabled == false ? false : true; if (!btn3.Enabled) { btn3.BackColor = Color.Black; } btn4.Enabled = item.Cadeira == 4 || btn4.Enabled == false ? false : true; if (!btn4.Enabled) { btn4.BackColor = Color.Black; } btn5.Enabled = item.Cadeira == 5 || btn5.Enabled == false ? false : true; if (!btn5.Enabled) { btn5.BackColor = Color.Black; } btn6.Enabled = item.Cadeira == 6 || btn6.Enabled == false ? false : true; if (!btn6.Enabled) { btn6.BackColor = Color.Black; } btn7.Enabled = item.Cadeira == 7 || btn7.Enabled == false ? false : true; if (!btn7.Enabled) { btn7.BackColor = Color.Black; } btn8.Enabled = item.Cadeira == 8 || btn8.Enabled == false ? false : true; if (!btn8.Enabled) { btn8.BackColor = Color.Black; } btn9.Enabled = item.Cadeira == 9 || btn9.Enabled == false ? false : true; if (!btn9.Enabled) { btn9.BackColor = Color.Black; } btn10.Enabled = item.Cadeira == 10 || btn10.Enabled == false ? false : true; if (!btn10.Enabled) { btn10.BackColor = Color.Black; } btn11.Enabled = item.Cadeira == 11 || btn11.Enabled == false ? false : true; if (!btn11.Enabled) { btn11.BackColor = Color.Black; } btn12.Enabled = item.Cadeira == 12 || btn12.Enabled == false ? false : true; if (!btn12.Enabled) { btn12.BackColor = Color.Black; } btn13.Enabled = item.Cadeira == 13 || btn13.Enabled == false ? false : true; if (!btn13.Enabled) { btn13.BackColor = Color.Black; } btn14.Enabled = item.Cadeira == 14 || btn14.Enabled == false ? false : true; if (!btn14.Enabled) { btn14.BackColor = Color.Black; } btn15.Enabled = item.Cadeira == 15 || btn15.Enabled == false ? false : true; if (!btn15.Enabled) { btn15.BackColor = Color.Black; } btn16.Enabled = item.Cadeira == 16 || btn16.Enabled == false ? false : true; if (!btn16.Enabled) { btn16.BackColor = Color.Black; } btn17.Enabled = item.Cadeira == 17 || btn17.Enabled == false ? false : true; if (!btn17.Enabled) { btn17.BackColor = Color.Black; } btn18.Enabled = item.Cadeira == 18 || btn18.Enabled == false ? false : true; if (!btn18.Enabled) { btn18.BackColor = Color.Black; } btn19.Enabled = item.Cadeira == 19 || btn19.Enabled == false ? false : true; if (!btn19.Enabled) { btn19.BackColor = Color.Black; } btn20.Enabled = item.Cadeira == 20 || btn20.Enabled == false ? false : true; if (!btn20.Enabled) { btn20.BackColor = Color.Black; } btn21.Enabled = item.Cadeira == 21 || btn21.Enabled == false ? false : true; if (!btn21.Enabled) { btn21.BackColor = Color.Black; } btn22.Enabled = item.Cadeira == 22 || btn22.Enabled == false ? false : true; if (!btn22.Enabled) { btn22.BackColor = Color.Black; } btn23.Enabled = item.Cadeira == 23 || btn23.Enabled == false ? false : true; if (!btn23.Enabled) { btn23.BackColor = Color.Black; } btn24.Enabled = item.Cadeira == 24 || btn24.Enabled == false ? false : true; if (!btn24.Enabled) { btn24.BackColor = Color.Black; } btn25.Enabled = item.Cadeira == 25 || btn25.Enabled == false ? false : true; if (!btn25.Enabled) { btn25.BackColor = Color.Black; } btn26.Enabled = item.Cadeira == 26 || btn26.Enabled == false ? false : true; if (!btn26.Enabled) { btn26.BackColor = Color.Black; } btn27.Enabled = item.Cadeira == 27 || btn27.Enabled == false ? false : true; if (!btn27.Enabled) { btn27.BackColor = Color.Black; } btn28.Enabled = item.Cadeira == 28 || btn28.Enabled == false ? false : true; if (!btn28.Enabled) { btn28.BackColor = Color.Black; } btn29.Enabled = item.Cadeira == 29 || btn29.Enabled == false ? false : true; if (!btn29.Enabled) { btn29.BackColor = Color.Black; } btn30.Enabled = item.Cadeira == 30 || btn30.Enabled == false ? false : true; if (!btn30.Enabled) { btn30.BackColor = Color.Black; } btn31.Enabled = item.Cadeira == 31 || btn31.Enabled == false ? false : true; if (!btn31.Enabled) { btn31.BackColor = Color.Black; } btn32.Enabled = item.Cadeira == 32 || btn32.Enabled == false ? false : true; if (!btn32.Enabled) { btn32.BackColor = Color.Black; } btn33.Enabled = item.Cadeira == 33 || btn33.Enabled == false ? false : true; if (!btn33.Enabled) { btn33.BackColor = Color.Black; } btn34.Enabled = item.Cadeira == 34 || btn34.Enabled == false ? false : true; if (!btn34.Enabled) { btn34.BackColor = Color.Black; } btn35.Enabled = item.Cadeira == 35 || btn35.Enabled == false ? false : true; if (!btn35.Enabled) { btn35.BackColor = Color.Black; } btn36.Enabled = item.Cadeira == 36 || btn36.Enabled == false ? false : true; if (!btn36.Enabled) { btn36.BackColor = Color.Black; } btn37.Enabled = item.Cadeira == 37 || btn37.Enabled == false ? false : true; if (!btn37.Enabled) { btn37.BackColor = Color.Black; } btn38.Enabled = item.Cadeira == 38 || btn38.Enabled == false ? false : true; if (!btn38.Enabled) { btn38.BackColor = Color.Black; } btn39.Enabled = item.Cadeira == 39 || btn39.Enabled == false ? false : true; if (!btn39.Enabled) { btn39.BackColor = Color.Black; } btn40.Enabled = item.Cadeira == 40 || btn40.Enabled == false ? false : true; if (!btn40.Enabled) { btn40.BackColor = Color.Black; } btn41.Enabled = item.Cadeira == 41 || btn41.Enabled == false ? false : true; if (!btn41.Enabled) { btn41.BackColor = Color.Black; } btn42.Enabled = item.Cadeira == 42 || btn42.Enabled == false ? false : true; if (!btn42.Enabled) { btn42.BackColor = Color.Black; } btn43.Enabled = item.Cadeira == 43 || btn43.Enabled == false ? false : true; if (!btn43.Enabled) { btn43.BackColor = Color.Black; } btn44.Enabled = item.Cadeira == 44 || btn44.Enabled == false ? false : true; if (!btn44.Enabled) { btn44.BackColor = Color.Black; } btn45.Enabled = item.Cadeira == 45 || btn45.Enabled == false ? false : true; if (!btn45.Enabled) { btn45.BackColor = Color.Black; } btn46.Enabled = item.Cadeira == 46 || btn46.Enabled == false ? false : true; if (!btn46.Enabled) { btn46.BackColor = Color.Black; } btn47.Enabled = item.Cadeira == 47 || btn47.Enabled == false ? false : true; if (!btn47.Enabled) { btn47.BackColor = Color.Black; } btn48.Enabled = item.Cadeira == 48 || btn48.Enabled == false ? false : true; if (!btn48.Enabled) { btn48.BackColor = Color.Black; } btn49.Enabled = item.Cadeira == 49 || btn49.Enabled == false ? false : true; if (!btn49.Enabled) { btn49.BackColor = Color.Black; } btn50.Enabled = item.Cadeira == 50 || btn50.Enabled == false ? false : true; if (!btn50.Enabled) { btn50.BackColor = Color.Black; } } } }