//Agregar uno de los 3 Items private void BtnNuevaVentana_Click(object sender, RoutedEventArgs e) { if (rbMovie.IsChecked == true) { AgregarGeneral FormaAgregar = new AgregarGeneral(); FormaAgregar.Owner = this; FormaAgregar.txtDuracion.Visibility = Visibility.Visible; FormaAgregar.lblDuracion.Visibility = Visibility.Visible; FormaAgregar.txtCalificacion.Visibility = Visibility.Visible; FormaAgregar.lblCalificacion.Visibility = Visibility.Visible; FormaAgregar.txtCategoria.Visibility = Visibility.Visible; FormaAgregar.lblCategoria.Visibility = Visibility.Visible; FormaAgregar.btnModificar.Visibility = Visibility.Hidden; Movie Pelicula = new Movie("", "", 0, 0, 0, ""); FormaAgregar.DatoAIdentificar = Pelicula; FormaAgregar.Show(); this.Hide(); } else if (rbBook.IsChecked == true) { AgregarGeneral FormaAgregar = new AgregarGeneral(); FormaAgregar.Owner = this; FormaAgregar.txtAutor.Visibility = Visibility.Visible; FormaAgregar.lblAutor.Visibility = Visibility.Visible; FormaAgregar.txtPaginas.Visibility = Visibility.Visible; FormaAgregar.lblPaginas.Visibility = Visibility.Visible; FormaAgregar.txtEditorial.Visibility = Visibility.Visible; FormaAgregar.lblEditorial.Visibility = Visibility.Visible; FormaAgregar.txtTema.Visibility = Visibility.Visible; FormaAgregar.lblTema.Visibility = Visibility.Visible; FormaAgregar.btnModificar.Visibility = Visibility.Hidden; Book Libro = new Book("", "", 0, "", "", "", 0); FormaAgregar.DatoAIdentificar = Libro; FormaAgregar.Show(); this.Hide(); } else if (rbProduct.IsChecked == true) { AgregarGeneral FormaAgregar = new AgregarGeneral(); FormaAgregar.Owner = this; FormaAgregar.txtCantidad.Visibility = Visibility.Visible; FormaAgregar.lblCantidad.Visibility = Visibility.Visible; FormaAgregar.btnModificar.Visibility = Visibility.Hidden; Producto Produc = new Producto("", "", 0, 0); FormaAgregar.DatoAIdentificar = Produc; FormaAgregar.Show(); this.Hide(); } else { MessageBox.Show("Si desea agregar, seleccione una opción"); } }
private void BtnModificar_Click(object sender, RoutedEventArgs e) { int Index = Contenedor.SelectedIndex; object Temporal = ListaArticulos[Index]; if (Temporal.GetType() == typeof(Movie)) { AgregarGeneral FormaAgregar = new AgregarGeneral(); FormaAgregar.Owner = this; FormaAgregar.txtDuracion.Visibility = Visibility.Visible; FormaAgregar.lblDuracion.Visibility = Visibility.Visible; FormaAgregar.txtCalificacion.Visibility = Visibility.Visible; FormaAgregar.lblCalificacion.Visibility = Visibility.Visible; FormaAgregar.txtCategoria.Visibility = Visibility.Visible; FormaAgregar.lblCategoria.Visibility = Visibility.Visible; FormaAgregar.btnModificar.Visibility = Visibility.Visible; FormaAgregar.Agregame.Visibility = Visibility.Hidden; FormaAgregar.txtNombre.Text = (Temporal as Movie).Nombre; FormaAgregar.txtDescripcion.Text = (Temporal as Movie).Descripcion; FormaAgregar.txtPrecio.Text = (Temporal as Movie).Precio.ToString(); FormaAgregar.txtDuracion.Text = (Temporal as Movie).Duracion.ToString(); FormaAgregar.txtCalificacion.Text = (Temporal as Movie).Calificacion.ToString(); FormaAgregar.txtCategoria.Text = (Temporal as Movie).Tipo; Movie Pelicula = new Movie("", "", 0, 0, 0, ""); FormaAgregar.DatoAIdentificar = Pelicula; FormaAgregar.Indice = Index; FormaAgregar.Show(); this.Hide(); } else if (Temporal.GetType() == typeof(Book)) { AgregarGeneral FormaAgregar = new AgregarGeneral(); FormaAgregar.Owner = this; FormaAgregar.txtAutor.Visibility = Visibility.Visible; FormaAgregar.lblAutor.Visibility = Visibility.Visible; FormaAgregar.txtPaginas.Visibility = Visibility.Visible; FormaAgregar.lblPaginas.Visibility = Visibility.Visible; FormaAgregar.txtEditorial.Visibility = Visibility.Visible; FormaAgregar.lblEditorial.Visibility = Visibility.Visible; FormaAgregar.txtTema.Visibility = Visibility.Visible; FormaAgregar.lblTema.Visibility = Visibility.Visible; FormaAgregar.btnModificar.Visibility = Visibility.Visible; FormaAgregar.Agregame.Visibility = Visibility.Hidden; FormaAgregar.txtNombre.Text = (Temporal as Book).Nombre; FormaAgregar.txtDescripcion.Text = (Temporal as Book).Descripcion; FormaAgregar.txtPrecio.Text = (Temporal as Book).Precio.ToString(); FormaAgregar.txtAutor.Text = (Temporal as Book).Autor; FormaAgregar.txtPaginas.Text = (Temporal as Book).Paginas.ToString(); FormaAgregar.txtEditorial.Text = (Temporal as Book).Editorial; FormaAgregar.txtTema.Text = (Temporal as Book).Tema; Book Libro = new Book("", "", 0, "", "", "", 0); FormaAgregar.DatoAIdentificar = Libro; FormaAgregar.Indice = Index; FormaAgregar.Show(); this.Hide(); } else if (Temporal.GetType() == typeof(Producto)) { AgregarGeneral FormaAgregar = new AgregarGeneral(); FormaAgregar.Owner = this; FormaAgregar.txtCantidad.Visibility = Visibility.Visible; FormaAgregar.lblCantidad.Visibility = Visibility.Visible; FormaAgregar.btnModificar.Visibility = Visibility.Visible; FormaAgregar.Agregame.Visibility = Visibility.Hidden; FormaAgregar.txtNombre.Text = (Temporal as Producto).Nombre; FormaAgregar.txtDescripcion.Text = (Temporal as Producto).Descripcion; FormaAgregar.txtPrecio.Text = (Temporal as Producto).Precio.ToString(); FormaAgregar.txtCantidad.Text = (Temporal as Producto).Cantidad.ToString(); Producto Produc = new Producto("", "", 0, 0); FormaAgregar.DatoAIdentificar = Produc; FormaAgregar.Indice = Index; FormaAgregar.Show(); this.Hide(); } }