private void btnAdd_Click(object sender, EventArgs e) { decimal Parsedvalue; if (decimal.TryParse(txtPrice.Text.ToString(), out Parsedvalue)) { DialogResult dr = new DialogResult(); dr = MessageBox.Show("Are you sure you wan to add this Item Type?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { itemType = new CItemType(); int isValid; isValid = itemType.AddItemType(conn, txtItemType.Text.ToString(), Convert.ToDecimal(txtPrice.Text), txtDesc.Text.ToString()); if (isValid == 1) { MessageBox.Show("Item type successfully added."); LayoutChangeState(); RefreshDataSouce(); } else { MessageBox.Show("Item type already exists.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("The price feild is a numeric only feild.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void PopulateItemTypeCmb() { cmbItemType.Items.Clear(); itemType = new CItemType(); foreach (CItemType type in itemType.GetItemTypes()) { cmbItemType.Items.Add(type.GetTypeName()); } }
void PopulateComboBox() { cmbItemSearch.Items.Clear(); CItemType itemType = new CItemType(); foreach (CItemType type in itemType.GetItemTypes()) { cmbItemSearch.Items.Add(type.GetTypeName()); } }
private void frmItemType_Load(object sender, EventArgs e) { conn = new SqlConnection(); itemType = new CItemType(); this.itemTypeTableAdapter.Fill(this.qrScannerDataSet11.ItemType); txtItemID.Enabled = false; if (dgvItemTypes.Rows.Count > 0) { dgvItemTypes.Rows[0].Selected = true; } }