Exemple #1
0
        private void dgvRoutines_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var row = dgvRoutines.CurrentRow; //Obtiene la fila seleccionada

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

            //Obtiene los datos de la fila seleccioanda y la convierte a objeto de PRODUCTO
            var idRoutine = int.Parse(row.Cells[0].Value.ToString());

            var routine = Routine.GetRoutineById(idRoutine);

            var form = new FrmRoutine(routine, this); //Instancia un nuevo formulario para agregar productos

            form.Show();                              //Abre el formulario
        }
Exemple #2
0
        private void btnAddRoutines_Click(object sender, EventArgs e)
        {
            var childRoutines = new ChildMainRoutines();

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

            form.Show();
        }