void txtPlato_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { DevExpress.XtraEditors.TextEdit Editor = (DevExpress.XtraEditors.TextEdit)sender; string Texto = Editor.Text; Editor.Text = ""; Plato plato = new Plato(); FrmBuscarEntidades F = new FrmBuscarEntidades(); F.BuscarPlatos(Texto); if (F.registro != null) { plato = (Plato)F.registro; } else { return; } }
void txtPlato_Validating(object sender, CancelEventArgs e) { DevExpress.XtraEditors.TextEdit Editor = (DevExpress.XtraEditors.TextEdit)sender; if (!Editor.IsModified) { return; } Plato plato = new Plato(); string Texto = Editor.Text; Editor.Text = ""; List <Plato> T = FactoryPlatos.getItems(Texto); switch (T.Count) { case 0: return; case 1: plato = T[0]; break; default: FrmBuscarEntidades F = new FrmBuscarEntidades(); F.BuscarPlatos(Texto); if (F.registro != null) { plato = (Plato)F.registro; } else { return; } break; } AgregarItem(plato); }