Example #1
0
        private void smiArticuloAlta_Click(object sender, EventArgs e)
        {
            try
            {
                bool isAltaArticuloOpen = false;

                for (int i = 0; i < Application.OpenForms.Count; i++)
                {
                    if (Application.OpenForms[i].GetType() == typeof(frmAltaArticulos))
                    {
                        isAltaArticuloOpen = true;
                    }
                }

                if (!isAltaArticuloOpen)
                {
                    frmAltaArticulos altaArticulo = new frmAltaArticulos();
                    altaArticulo.MdiParent = this;
                    altaArticulo.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvResultados.RowCount > 0)
                {
                    bool isModificarArticuloOpen = false;
                    for (int i = 0; i < Application.OpenForms.Count; i++)
                    {
                        if (Application.OpenForms[i].GetType() == typeof(frmAltaArticulos))
                        {
                            isModificarArticuloOpen = true;
                        }
                    }

                    if (!isModificarArticuloOpen && dgvResultados.RowCount > 0)
                    {
                        frmAltaArticulos frmModificar = new frmAltaArticulos((Articulo)dgvResultados.CurrentRow.DataBoundItem, dgvResultados);
                        for (int i = 0; i < Application.OpenForms.Count; i++)
                        {
                            if (Application.OpenForms[i].GetType() == typeof(frmMain))
                            {
                                frmModificar.MdiParent = Application.OpenForms[i];
                            }
                        }
                        frmModificar.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }