示例#1
0
 /// <summary>
 /// Obtiene la lista para mostrar en el grid
 /// </summary>
 private void ObtenerListaProblemaSintoma(int inicio, int limite)
 {
     try
     {
         var problemaSintomaBL       = new ProblemaSintomaBL();
         ProblemaSintomaInfo filtros = ObtenerFiltros();
         if (ucPaginacion.ContextoAnterior != null)
         {
             bool contextosIguales = ucPaginacion.CompararObjetos(Contexto, ucPaginacion.ContextoAnterior);
             if (!contextosIguales)
             {
                 ucPaginacion.Inicio = 1;
                 inicio = 1;
             }
         }
         var pagina = new PaginacionInfo {
             Inicio = inicio, Limite = limite
         };
         ResultadoInfo <ProblemaSintomaInfo> resultadoInfo = problemaSintomaBL.ObtenerPorPagina(pagina, filtros);
         if (resultadoInfo != null && resultadoInfo.Lista != null &&
             resultadoInfo.Lista.Count > 0)
         {
             gridDatos.ItemsSource       = resultadoInfo.Lista;
             ucPaginacion.TotalRegistros = resultadoInfo.TotalRegistros;
         }
         else
         {
             ucPaginacion.TotalRegistros = 0;
             gridDatos.ItemsSource       = new List <ProblemaSintoma>();
         }
     }
     catch (ExcepcionGenerica)
     {
         SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                           Properties.Resources.ProblemaSintoma_ErrorBuscar, MessageBoxButton.OK,
                           MessageImage.Error);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                           Properties.Resources.ProblemaSintoma_ErrorBuscar, MessageBoxButton.OK,
                           MessageImage.Error);
     }
 }
示例#2
0
        /// <summary>
        /// Inicializa el Contexto
        /// </summary>
        private void ObtenerListaSintomas(ProblemaSintomaInfo problemaSintomaSeleccionado)
        {
            var problemaSintomaBL     = new ProblemaSintomaBL();
            var listaProblemasSintoma = problemaSintomaBL.ObtenerProblemasSintomaTodos();
            var sintomas = (from sinto in listaProblemasSintoma
                            where sinto.ProblemaID == problemaSintomaSeleccionado.ProblemaID
                            select new SintomaInfo
            {
                SintomaID = sinto.SintomaID,
                Descripcion = sinto.Sintoma.Descripcion,
                Activo = sinto.Activo,
                ProblemaSintomaID = sinto.ProblemaSintomaID,
                UsuarioCreacionID = sinto.UsuarioCreacionID,
                UsuarioModificacionID = sinto.UsuarioModificacionID
            }).ToList();

            problemaSintomaSeleccionado.ListaSintomas = sintomas;
        }
示例#3
0
        /// <summary>
        /// Método para guardar los valores del contexto
        /// </summary>
        private void Guardar()
        {
            bool guardar = ValidaGuardar();

            if (guardar)
            {
                try
                {
                    int problemaSintomaID = Contexto.ProblemaSintomaID;
                    var problemaSintomaBL = new ProblemaSintomaBL();
                    Contexto.ProblemaID = Contexto.Problema.ProblemaID;
                    //Contexto.SintomaID = Contexto.Sintoma.SintomaID;
                    problemaSintomaBL.Guardar(Contexto);
                    SkMessageBox.Show(this, Properties.Resources.GuardadoConExito, MessageBoxButton.OK,
                                      MessageImage.Correct);
                    gridDatosSintoma.ItemsSource = null;
                    CargarListaProblemasSintomas();
                    if (problemaSintomaID != 0)
                    {
                        confirmaSalir = false;
                        Close();
                    }
                    else
                    {
                        InicializaContexto();
                    }
                }
                catch (ExcepcionGenerica)
                {
                    SkMessageBox.Show(this, Properties.Resources.ProblemaSintoma_ErrorGuardar, MessageBoxButton.OK,
                                      MessageImage.Error);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                    SkMessageBox.Show(this, Properties.Resources.ProblemaSintoma_ErrorGuardar, MessageBoxButton.OK,
                                      MessageImage.Error);
                }
            }
        }
示例#4
0
        private void CargarListaProblemasSintomas()
        {
            var problemaSintomaBL = new ProblemaSintomaBL();

            listaProblemasSintoma = problemaSintomaBL.ObtenerProblemasSintomaTodos();
        }