private void cboEwo_SelectedIndexChanged(object sender, EventArgs e) { int selVal = cboEwo.SelectedValue == null ? 0 : int.Parse(cboEwo.SelectedValue.ToString()); if (selVal > 0) { ewos ew = daoEwo.GetEwoById(selVal); txtTiempoAverias.Text = ew.tiempo_total.ToString() + " Mins"; txtCantidad.Text = "2 Técnicos"; } }
public int AddEwo(ewos ewo) { int regs = 0; try { using (var context = new MttoAppEntities()) { context.ewos.Add(ewo); regs = context.SaveChanges(); } } catch (Exception e) { MessageBox.Show("Excepción al agregar ewo: " + e.ToString(), "Atención", MessageBoxButton.OK, MessageBoxImage.Error); } return(regs); }
public ewos GetEwoById(int id) { ewos data = new ewos(); try { using (var context = new MttoAppEntities()) { // Query for all blogs with names starting with B var als = from b in context.ewos where b.Id == id select b; data = als.ToList().Count > 0 ? als.ToList()[0] : null; } } catch (Exception e) { MessageBox.Show("Excepción al consultar ewo por id: " + e, "Atención", MessageBoxButton.OK, MessageBoxImage.Error); } return(data); }