コード例 #1
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgProductos.SelectedRows.Count == 1)
            {
                int      id               = int.Parse(dgProductos.CurrentRow.Cells["ID"].Value.ToString());
                string   nombre           = dgProductos.CurrentRow.Cells["Nombre"].Value.ToString();
                string   descripcion      = dgProductos.CurrentRow.Cells["Descripción"].Value.ToString();
                string   inventario       = dgProductos.CurrentRow.Cells["Precio"].Value.ToString();
                string   precio           = dgProductos.CurrentRow.Cells["Inventario"].Value.ToString();
                string   costo            = dgProductos.CurrentRow.Cells["Costo"].Value.ToString();
                string   unidadesVendidas = dgProductos.CurrentRow.Cells["Unidades Vendidas"].Value.ToString();
                DateTime fechaIngreso     = DateTime.Parse(dgProductos.CurrentRow.Cells["Fecha Ingreso"].Value.ToString());

                var form = new FormCatalogoProductoEmergente(id, nombre, descripcion, inventario, precio, costo, unidadesVendidas, fechaIngreso);
                form.ShowDialog();
                if (form.DialogResult == DialogResult.OK)
                {
                    btnRefrescar.PerformClick();
                }
            }
            else
            {
                MessageBox.Show("Seleccione una fila antes de modificar.", "Productos Para Mascotas", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #2
0
        private void btnAñadir_Click(object sender, EventArgs e)
        {
            var form = new FormCatalogoProductoEmergente();

            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                btnRefrescar.PerformClick();
            }
        }