public void Insertar(Comunes.Estructuras.Cartelera pDatos) { try { if (pDatos != null) { vDatos.Insertar(pDatos); } } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public void Actualizar(Comunes.Estructuras.Cartelera pDatos, List <Filtro> pFiltro) { try { if (pFiltro != null && pDatos != null) { vDatos.Actualizar(pDatos, pFiltro); } } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public void Actualizar(Comunes.Estructuras.Cartelera pSala, List <Filtro> pFiltro, List <Comunes.Estructuras.CarteleraDetalle> pDetalle) { Datos.Clases.CarteleraDetalle vDatosAsientos = new Datos.Clases.CarteleraDetalle(); try { if (pSala != null && pDetalle != null) { vDatos.Actualizar(pSala, pFiltro); vDatosAsientos.Eliminar(pFiltro); foreach (Comunes.Estructuras.CarteleraDetalle vItem in pDetalle) { vItem.IdCartelera = pSala.IdSala; vDatosAsientos.Insertar(vItem); } } } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public void Insertar(Comunes.Estructuras.Cartelera pSala, List <Comunes.Estructuras.CarteleraDetalle> pDetalle) { Datos.Clases.CarteleraDetalle vDatosAsientos = new Datos.Clases.CarteleraDetalle(); int vReusltado = 0; try { if (pSala != null && pDetalle != null) { vDatos.Insertar(pSala); vReusltado = vDatos.SelecccionarId(); foreach (Comunes.Estructuras.CarteleraDetalle vItem in pDetalle) { vItem.IdCartelera = vReusltado; vDatosAsientos.Insertar(vItem); } } } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void btnAceptar_Click(object sender, EventArgs e) { Comunes.Estructuras.Cartelera vEstructuraCartelera = new Comunes.Estructuras.Cartelera(); Comunes.Estructuras.CarteleraDetalle vEstructuraDetalle = new Comunes.Estructuras.CarteleraDetalle(); Negocio.Clases.Cartelera vNegocio = new Negocio.Clases.Cartelera(); Negocio.Clases.CarteleraDetalle vNegocioDetalle = new Negocio.Clases.CarteleraDetalle(); List <Comunes.Filtros.Filtro> vFiltros = new List <Comunes.Filtros.Filtro>(); List <Comunes.Estructuras.CarteleraDetalle> vDetalles = new List <Comunes.Estructuras.CarteleraDetalle>(); try { if (ltvDetalle.Items.Count != 0) { vEstructuraCartelera.IdSala = Convert.ToInt32(cboSala.SelectedValue.ToString()); foreach (ListViewItem vItem in ltvDetalle.Items) { vEstructuraDetalle = new Comunes.Estructuras.CarteleraDetalle() { IdPelicula = Convert.ToInt32(vItem.SubItems[0].Text), FechaPelicula = Convert.ToDateTime(vItem.SubItems[1].Text), HoraPelicula = vItem.SubItems[2].Text, FechaEstreno = Convert.ToDateTime(vItem.SubItems[3].Text), FechaFinalizacion = Convert.ToDateTime(vItem.SubItems[4].Text) }; vDetalles.Add(vEstructuraDetalle); } switch (vModo) { case "A": vEstructuraCartelera.IdCartelera = 0; vNegocio.Insertar(vEstructuraCartelera, vDetalles); break; case "M": vEstructuraCartelera.IdCartelera = Convert.ToInt32(lblId.Text); vFiltros.Add(new Comunes.Filtros.Filtro("IdCartelera", "=", Convert.ToInt32(lblId.Text))); vNegocio.Actualizar(vEstructuraCartelera, vFiltros, vDetalles); tbpLista.Parent = tbcInformacion; tbcInformacion.SelectedTab = tbpLista; tspBarraMenu.Visible = true; tbpInformacion.Parent = null; vModo = string.Empty; CargarVista(); break; default: vFiltros.Add(new Comunes.Filtros.Filtro("IdCartelera", "=", Convert.ToInt32(lblId.Text))); vNegocio.Eliminar(vFiltros); vNegocioDetalle.Eliminar(vFiltros); tbpLista.Parent = tbcInformacion; tbcInformacion.SelectedTab = tbpLista; tspBarraMenu.Visible = true; tbpInformacion.Parent = null; vModo = string.Empty; CargarVista(); gboDescripcion.Enabled = true; break; } MessageBox.Show("El proceso a finalizado con éxito", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); CargarVista(); ltvDetalle.Items.Clear(); lblId.Text = string.Empty; cboPelicula.SelectedIndex = 0; cboSala.SelectedIndex = 0; } else { MessageBox.Show("Al menos debe agregar un detalle, por favor verifique", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }