private void btnUpdatePrice_Click(object sender, EventArgs e) { string validInputRegex = @"^\£?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$"; Match match = Regex.Match(txtMenuPrice.Text, validInputRegex, RegexOptions.IgnoreCase); if (!match.Success) { MessageBox.Show("Incorrect price format!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FoodMenu.UpdateAttribute(Convert.ToInt32(txtMenuId.Text), Convert.ToDecimal(txtMenuPrice.Text)); LoadFoodMenus(); }
private void btnUpdateMenuAttrib_Click(object sender, EventArgs e) { //take the selected stock item and assign it to the menu //i.e change the foreign key of on of the fields in the menu record if (m_SelectedStockItem < 1) { return; } if (FoodMenu.UpdateAttribute(m_MenuId, m_Attribute, m_SelectedStockItem)) { MessageBox.Show("Saved Changes Successfully", "SUCCESS", MessageBoxButtons.OK); CHOOSEN_ITEM_ID = m_SelectedStockItem; } else { MessageBox.Show("Failed to save changes", "ERROR", MessageBoxButtons.OK); } this.Close(); }