private bool EliminarTipoSangre() { try { if (SelectedItem != null) { cTipoSangre tipoSangre = new cTipoSangre(); if (!tipoSangre.Eliminar(SelectedItem.ID_TIPO_SANGRE)) { return(false); } Clave = 0; Descripcion = string.Empty; SelectedEstatus = null; Busqueda = string.Empty; this.GetTipoSangre(); } return(true); } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al eliminar.", ex); return(false); } }
private void GuardarTipoSangre() { try { cTipoSangre sangre = new cTipoSangre(); if (SelectedItem != null) { //Actualizar SelectedItem.ID_TIPO_SANGRE = Clave; SelectedItem.DESCR = Descripcion; SelectedItem.ESTATUS = SelectedEstatus.CLAVE; sangre.Actualizar(new TIPO_SANGRE { ID_TIPO_SANGRE = Clave, DESCR = Descripcion, ESTATUS = SelectedEstatus.CLAVE }); } else { //Agregar sangre.Insertar(new TIPO_SANGRE { ID_TIPO_SANGRE = Clave, DESCR = Descripcion, ESTATUS = SelectedEstatus.CLAVE }); } //Limpiamos las variables Clave = 0; Descripcion = string.Empty; SelectedEstatus = null; Busqueda = string.Empty; //Mostrar Listado this.GetTipoSangre(); } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al guardar.", ex); } }