Пример #1
0
        private void guardar_Click(object sender, EventArgs e)
        {
            if (this.nombreCategoria.Text == "" || this.descripcionCategoria.Text == "")
            {
                MessageBox.Show("Tiene que completar los campos obligatorios");
            }
            else
            {
                CategoriaProductoDTO categoriaProductoDTO = new CategoriaProductoDTO();
                if (categoriaDTO != null)
                {
                    categoriaProductoDTO.Id = categoriaDTO.Id;
                }
                categoriaProductoDTO.Nombre      = nombreCategoria.Text;
                categoriaProductoDTO.Descripcion = descripcionCategoria.Text;
                if (siVence.Checked)
                {
                    categoriaProductoDTO.Vence = true;
                }
                else
                {
                    categoriaProductoDTO.Vence = false;
                }

                controladorFachada.AgregarModificarCategoria(categoriaProductoDTO);
                if (Ventana == 1)
                {
                    this.Hide();
                    this.Close();
                }
                else
                {
                    this.Hide();
                    VControlCategoria vControlCategoria = new VControlCategoria();
                    vControlCategoria.ShowDialog();
                    this.Close();
                }
            }
        }