private void cmbMenuItem_SelectedIndexChanged(object sender, EventArgs e) { int id = 0; try { id = Convert.ToInt32(cmbMenuItem.SelectedValue.ToString()); } catch { id = new BllMenuItem().GetMinimumMenuItemId(); } finally { var MenuItem = new Service.BLL.BllMenuItem().GetById(id); txtPrice.Text = MenuItem.Price.ToString(); } }
private void txtMenuCode_Leave(object sender, EventArgs e) { if (txtMenuCode.Text != "") { int i = new BllMenuItem().GetMenuItemIdByMenuCode(txtMenuCode.Text.Trim()); if (i == 0) { KryptonMessageBox.Show("Please provide valid Menu Code.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMenuCode.Focus(); return; } if ((int)cmbMenuItem.SelectedValue == i) { cmbMenuItem.SelectedIndex = 1; } cmbMenuItem.SelectedValue = i; } }