private void BtnAddCategory_Click(object sender, EventArgs e) { if (titulo == "catingresos") { string emptyCategory = ""; action = "nuevotipodeingreso"; frmNewCategory FNC = new frmNewCategory(action, emptyCategory, this); FNC.ShowDialog(); } else { string emptyCategory = ""; action = "nuevotipodeegreso"; frmNewCategory FNC = new frmNewCategory(action, emptyCategory, this); FNC.ShowDialog(); } }
private void BtnModifyCategory_Click(object sender, EventArgs e) { selectedCategory = lbCategory.SelectedItem.ToString(); int categoryId = _category.GetCategoryId(selectedCategory); bool IsCategoryInCashMovement = _category.FindCategoryInCashMovement(categoryId); if (IsCategoryInCashMovement == false && titulo == "catingresos") { action = "modifyingresscategory"; frmNewCategory FNC = new frmNewCategory(action, selectedCategory, this); FNC.Show(); } else if (IsCategoryInCashMovement == false && titulo == "categresos") { action = "modifyegresscategory"; frmNewCategory FNC = new frmNewCategory(action, selectedCategory, this); FNC.Show(); } else if (IsCategoryInCashMovement == true) { MessageBox.Show("No se puede modificar la categoría " + "'" + selectedCategory + "'" + " porque está asociada a uno o más movimientos", "Modificar categoría", MessageBoxButtons.OK, MessageBoxIcon.Error); } }