private void ProceedOpen() { if ((dgwResult.Rows.Count > 0) && (dgwResult.CurrentRow.Cells[0].Value != null)) { // Obtener el ID seleccionado string valueID = DataUtil.GetString(dgwResult.CurrentRow.Cells[0].Value); switch (tableNameBrowser) { case "empleado": frmEmployee frmEmployeeEdit = new frmEmployee(); frmEmployeeEdit.adding = false; frmEmployeeEdit.formTitle = "Empleados - Modificar"; frmEmployeeEdit.formId = valueID; frmEmployeeEdit.ShowDialog(); break; case "cliente": frmCustomer frmCustomerEdit = new frmCustomer(); frmCustomerEdit.adding = false; frmCustomerEdit.formTitle = "Clientes - Modificar"; frmCustomerEdit.formId = valueID; frmCustomerEdit.ShowDialog(); break; case "producto": frmProduct frmProductEdit = new frmProduct(); frmProductEdit.adding = false; frmProductEdit.formTitle = "Producto - Modificar"; frmProductEdit.formId = valueID; frmProductEdit.ShowDialog(); break; case "producto_categoria": frmProductCategory frmProductCategoryEdit = new frmProductCategory(); frmProductCategoryEdit.adding = false; frmProductCategoryEdit.formTitle = "Producto Categoria - Modificar"; frmProductCategoryEdit.formId = valueID; frmProductCategoryEdit.ShowDialog(); break; case "producto_sub_categoria": frmProductSubCategory frmProductSubCategoryEdit = new frmProductSubCategory(); frmProductSubCategoryEdit.adding = false; frmProductSubCategoryEdit.formTitle = "Producto Sub Categoria - Modificar"; frmProductSubCategoryEdit.formId = valueID; frmProductSubCategoryEdit.ShowDialog(); break; case "proveedor": frmSupplier frmSupplierEdit = new frmSupplier(); frmSupplierEdit.adding = false; frmSupplierEdit.formTitle = "Proveedor - Modificar"; frmSupplierEdit.formId = valueID; frmSupplierEdit.ShowDialog(); break; case "estacion": frmStation frmStationEdit = new frmStation(); frmStationEdit.adding = false; frmStationEdit.formTitle = "Estacion de Trabajo - Modificar"; frmStationEdit.formId = valueID; frmStationEdit.ShowDialog(); break; case "turno": frmTurn frmTurnEdit = new frmTurn(); frmTurnEdit.adding = false; frmTurnEdit.formTitle = "Turno - Modificar"; frmTurnEdit.formId = valueID; frmTurnEdit.ShowDialog(); break; case "Insumo_grupo_clasificacion": frmInsumoGroupClassification frmInsumoGroupClassificationEdit = new frmInsumoGroupClassification(); frmInsumoGroupClassificationEdit.adding = false; frmInsumoGroupClassificationEdit.formTitle = "Clasificación de grupos de insumos - Modificar"; frmInsumoGroupClassificationEdit.formId = valueID; frmInsumoGroupClassificationEdit.ShowDialog(); break; case "Insumo_grupo": frmInsumoGroup frmInsumoGroupEdit = new frmInsumoGroup(); frmInsumoGroupEdit.adding = false; frmInsumoGroupEdit.formTitle = "Grupos de insumos - Modificar"; frmInsumoGroupEdit.formId = valueID; frmInsumoGroupEdit.ShowDialog(); break; case "Presentacion_Insumo": frmInsumoPresentacion frmInsumoPresentacionEdit = new frmInsumoPresentacion(); frmInsumoPresentacionEdit.adding = false; frmInsumoPresentacionEdit.formTitle = "Presentaciones de insumos - Modificar"; frmInsumoPresentacionEdit.formId = valueID; frmInsumoPresentacionEdit.ShowDialog(); break; } AfterSearch(); } else { MessageBox.Show("No se seleccionó ningún elemento, o no existen elementos a seleccionar!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnAdd_Click(object sender, EventArgs e) { switch (tableNameBrowser) { case "empleado": frmEmployee frmEmployeeAdd = new frmEmployee(); frmEmployeeAdd.adding = true; frmEmployeeAdd.formTitle = "Empleados - Agregar"; frmEmployeeAdd.ShowDialog(); break; case "cliente": frmCustomer frmCustomerAdd = new frmCustomer(); frmCustomerAdd.adding = true; frmCustomerAdd.formTitle = "Clientes - Agregar"; frmCustomerAdd.ShowDialog(); break; case "producto": frmProduct frmProductAdd = new frmProduct(); frmProductAdd.adding = true; frmProductAdd.formTitle = "Producto - Agregar"; frmProductAdd.ShowDialog(); break; case "producto_categoria": frmProductCategory frmProductCategoryAdd = new frmProductCategory(); frmProductCategoryAdd.adding = true; frmProductCategoryAdd.formTitle = "Producto Categoria - Agregar"; frmProductCategoryAdd.ShowDialog(); break; case "producto_sub_categoria": frmProductSubCategory frmProductSubCategoryAdd = new frmProductSubCategory(); frmProductSubCategoryAdd.adding = true; frmProductSubCategoryAdd.formTitle = "Producto Sub Categoria - Agregar"; frmProductSubCategoryAdd.ShowDialog(); break; case "proveedor": frmSupplier frmSupplierAdd = new frmSupplier(); frmSupplierAdd.adding = true; frmSupplierAdd.formTitle = "Proveedor - Agregar"; frmSupplierAdd.ShowDialog(); break; case "estacion": frmStation frmStationAdd = new frmStation(); frmStationAdd.adding = true; frmStationAdd.formTitle = "Estacion de Trabajo - Agregar"; frmStationAdd.ShowDialog(); break; case "turno": frmTurn frmTurnAdd = new frmTurn(); frmTurnAdd.adding = true; frmTurnAdd.formTitle = "Turno - Agregar"; frmTurnAdd.ShowDialog(); break; case "Insumo_grupo_clasificacion": frmInsumoGroupClassification frmInsumoGroupClassificationAdd = new frmInsumoGroupClassification(); frmInsumoGroupClassificationAdd.adding = true; frmInsumoGroupClassificationAdd.formTitle = "Clasificación de grupos de insumos - Agregar"; frmInsumoGroupClassificationAdd.ShowDialog(); break; case "Insumo_grupo": frmInsumoGroup frmInsumoGroupAdd = new frmInsumoGroup(); frmInsumoGroupAdd.adding = true; frmInsumoGroupAdd.formTitle = "Grupos de insumos - Agregar"; frmInsumoGroupAdd.ShowDialog(); break; case "Presentacion_Insumo": frmInsumoPresentacion frmInsumoPresentacionAdd = new frmInsumoPresentacion(); frmInsumoPresentacionAdd.adding = true; frmInsumoPresentacionAdd.formTitle = "Presentaciones de insumos - Agregar"; frmInsumoPresentacionAdd.ShowDialog(); break; } BindDataGrid(); }