public override void btnSave_Click(object sender, EventArgs e) { try { if (Main.CheckControls(leftpanel).Count == 0) { short Status = cmbStatus.SelectedItem.ToString() == "Available" ? Convert.ToInt16(1) : Convert.ToInt16(0); if (base.edit == 0)//save { FoodMenu.FoodMenuInsert(txtMenuItem.Text, Convert.ToSingle(txtPrice.Text), Convert.ToInt32(cmbCategories.SelectedValue), Status, pbItem.Image); Main.resetDisable(leftpanel); FoodMenu.FoodMenuSelectAll(grvFoodMenu, MenuIDGV, MenuItemGV, PriceGV, StatusGV, CategoryIDGV, CategoryGV, ImageGV); } else if (edit == 1)//update { FoodMenu.FoodMenuUpdate(_menuID, txtMenuItem.Text, Convert.ToSingle(txtPrice.Text), Convert.ToInt32(cmbCategories.SelectedValue), Status, pbItem.Image); Main.resetDisable(leftpanel); FoodMenu.FoodMenuSelectAll(grvFoodMenu, MenuIDGV, MenuItemGV, PriceGV, StatusGV, CategoryIDGV, CategoryGV, ImageGV); } } } catch (Exception ex) { Main.showMessage(ex.Message, "error"); } }
public override void btnView_Click(object sender, EventArgs e) { try { FoodMenu.FoodMenuSelectAll(grvFoodMenu, MenuIDGV, MenuItemGV, PriceGV, StatusGV, CategoryIDGV, CategoryGV, ImageGV); } catch (Exception ex) { Main.showMessage(ex.Message, "error"); } }
public override void btnDelete_Click(object sender, EventArgs e) { try { if (base.delStates == 1) { DialogResult dr = MessageBox.Show("are you sure,you want to delete this record ?", "Question...", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Roles.commonDelete("SP_FoodMenuDelete", "@m_id", 0, _menuID); Main.resetDisable(leftpanel); FoodMenu.FoodMenuSelectAll(grvFoodMenu, MenuIDGV, MenuItemGV, PriceGV, StatusGV, CategoryIDGV, CategoryGV, ImageGV); delStates = 0; } } } catch (Exception ex) { Main.showMessage(ex.Message, "error"); } }