private void btnSalvar_Click(object sender, EventArgs e) { SessaoBusiness sessao = new SessaoBusiness(); dados.IDSessao = this.id; dados.Nome = txtNome.Text; dados.Descricao = txtTexto.Text; dados.FaixaEtaria = cboFaixaEtaria.SelectedItem == null ? "" : cboFaixaEtaria.SelectedItem.ToString(); dados.InicioFilme = Convert.ToDateTime(dtpInicioFilme.Value.Year.ToString() + "-" + dtpInicioFilme.Value.Month.ToString() + "-" + dtpInicioFilme.Value.Day.ToString() + " " + cboIniHor.SelectedItem.ToString() + ":" + cboIniMin.SelectedItem.ToString() + ":00"); dados.FinalFilme = Convert.ToDateTime(dtpFimFilme.Value.Year.ToString() + "-" + dtpFimFilme.Value.Month.ToString() + "-" + dtpFimFilme.Value.Day.ToString() + " " + cboFimHor.SelectedItem.ToString() + ":" + cboFimMin.SelectedItem.ToString() + ":00"); dados.DataLancamento = Convert.ToDateTime(dtpInicioVendas.Value.Year.ToString() + "-" + dtpInicioVendas.Value.Month.ToString() + "-" + dtpInicioVendas.Value.Day.ToString() + " " + cboVendHor.SelectedItem.ToString() + ":" + cboVendMin.SelectedItem.ToString() + ":00"); dados.NumeroDeCadeiras = lbCadeiras.SelectedItem.ToString() == "NORMAL" || lbCadeiras.SelectedItem == null ? 50 : 40; sessao.AtualizarSessao(dados); indice = lstSessao.SelectedIndex; this.CarregarLista(); }
private void btnDeletar_Click(object sender, EventArgs e) { try { if (id > 0) { SessaoBusiness deletar = new SessaoBusiness(); deletar.DeleteSessao(id); indice = 0; this.CarregarLista(); } else { MessageBox.Show("OPS! VOCÊ NÃO PODE FAZER ISSO. SELECIONE UM ITEM.", "TOPMOVIE - ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception) { MessageBox.Show("OCORREU UM ERRO!", "TOPMOVIE - ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button2_Click(object sender, EventArgs e) { try { SessaoBusiness sessao = new SessaoBusiness(); dados.Nome = txtNome.Text; dados.Descricao = txtTexto.Text; dados.FaixaEtaria = cboFaixaEtaria.SelectedItem == null ? "" : cboFaixaEtaria.SelectedItem.ToString(); dados.InicioFilme = Convert.ToDateTime(dtpInicioFilme.Value.Year.ToString() + "-" + dtpInicioFilme.Value.Month.ToString() + "-" + dtpInicioFilme.Value.Day.ToString() + " " + cboIniHor.SelectedItem.ToString() + ":" + cboIniMin.SelectedItem.ToString() + ":00"); dados.FinalFilme = Convert.ToDateTime(dtpFimFilme.Value.Year.ToString() + "-" + dtpFimFilme.Value.Month.ToString() + "-" + dtpFimFilme.Value.Day.ToString() + " " + cboFimHor.SelectedItem.ToString() + ":" + cboFimMin.SelectedItem.ToString() + ":00"); dados.DataLancamento = Convert.ToDateTime(dtpInicioVendas.Value.Year.ToString() + "-" + dtpInicioVendas.Value.Month.ToString() + "-" + dtpInicioVendas.Value.Day.ToString() + " " + cboVendHor.SelectedItem.ToString() + ":" + cboVendMin.SelectedItem.ToString() + ":00"); dados.NumeroDeCadeiras = lbCadeiras.SelectedItem.ToString() == "3D" ? 40 : 50; sessao.InserirSessao(dados); frmSessao x = new frmSessao(); x.Show(); this.Close(); } catch { MessageBox.Show("PREENCHA OS DADOS CORRETAMENTE.", "TOPMOVIE - ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }