示例#1
0
        private void btnAddFamily_Click(object sender, EventArgs e)
        {
            var childFamilies = new ChildMainFamily();

            if (pnlDashboard.Controls.Count > 0)                                   //Si el panel principal contiene un Formulario hijo
            {
                if (pnlDashboard.Controls[0].GetType() != typeof(ChildMainFamily)) //Si el tipo de formulario es diferente a ChildMenuProducts
                {
                    OpenChildForm(childFamilies);                                  //Agrega un nuevo formulario de childMenuProducts
                }
                else
                {
                    childFamilies = (ChildMainFamily)pnlDashboard.Controls[0];
                }
            }
            else
            {
                OpenChildForm(childFamilies);
            }
            var form = new FrmFamily(childFamilies);

            form.Show();
        }
示例#2
0
        private void dgvFamilies_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var row = dgvFamilies.CurrentRow;

            if (row == null || row.Index == -1 || e.RowIndex == -1)
            {
                return;
            }

            var idFamily    = (int)row.Cells[0].Value;
            var nameFamily  = (string)row.Cells[1].Value;
            var pointsValue = (int)row.Cells[2].Value;

            var product = new Family()
            {
                IdFamily   = idFamily,
                NameFamily = nameFamily,
                Points     = pointsValue,
            };

            var form = new FrmFamily(product, this);

            form.Show();
        }