private int GetComboBoxIndex(PushComboBox comboBox, string p) { for (int i = 0; i < comboBox.Items.Count; i++) { if (comboBox.Items[i].Equals(p)) { return(i); } } return(-1); }
private void comboBoxTaxId_SelectedIndexChanged(object sender, EventArgs e) { if (_haltEvents) { return; } try { PushComboBox pushComboBox = sender as PushComboBox; if (pushComboBox != null) { string taxName = pushComboBox.SelectedItem; Tax tax = Tax.Get(taxName); TaxId = ((tax != null) ? tax.Id : 0); } } catch (Exception ex) { PosDialogWindow.ShowDialog( ex.Message, Strings.ItemEditorInvalidTaxSetting); return; } DoChangedValueEvent(ItemFieldName.Tax); }
private void comboBoxCategory_SelectedIndexChanged(object sender, EventArgs e) { if (_haltEvents) { return; } PushComboBox pushComboBox = sender as PushComboBox; if (pushComboBox == null) { return; } string categoryName = pushComboBox.SelectedItem; Category matchingCategory = Category.Get(categoryName); //Category matchingCategory = // Category.FindByName(Category.GetAll(), categoryName); if (matchingCategory == null) { return; } CategoryId = matchingCategory.Id; DoChangedValueEvent(ItemFieldName.Category); }