Ejemplo n.º 1
0
 public static bool UpdateCandidato(PI_BA_Candidato objCandidato)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             dbContext.UpdateCandidato(objCandidato.cveCandidato,
                                       objCandidato.Password,
                                       objCandidato.Nombre,
                                       objCandidato.Apellido,
                                       objCandidato.Confirmado,
                                       objCandidato.Correo,
                                       objCandidato.CodigoConfirmacion,
                                       objCandidato.Telefono,
                                       objCandidato.Nacionalidad,
                                       objCandidato.RFC,
                                       objCandidato.Direccion,
                                       objCandidato.NombreImagen,
                                       objCandidato.FechaPrivacidadDatos);
             dbContext.SaveChanges();
             return(true);
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(false);
         }
     }
 }
Ejemplo n.º 2
0
        public static void RemovePregunta(String idForma, String idPregunta)
        {
            using (var dbContext = new wPremiosInstitucionalesdbEntities())
            {
                try
                {
                    var query = (from pregunta in dbContext.PI_BA_PreguntasPorForma
                                 where pregunta.cveForma.Equals(idForma) && pregunta.cvePregunta.Equals(idPregunta)
                                 select pregunta).FirstOrDefault();
                    dbContext.PI_BA_PreguntasPorForma.Remove(query);

                    dbContext.SaveChanges();

                    var query2 = (from pregunta in dbContext.PI_BA_Pregunta
                                  where pregunta.cvePregunta.Equals(idPregunta)
                                  select pregunta).FirstOrDefault();
                    dbContext.PI_BA_Pregunta.Remove(query2);
                    dbContext.SaveChanges();
                }
                catch (Exception Ex)
                {
                    Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
                }
            }
        }
Ejemplo n.º 3
0
 public static void InsertaPregunta(String idForma, String valor, int orden)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             PI_BA_Pregunta pregunta = new PI_BA_Pregunta();
             pregunta.cvePregunta = Guid.NewGuid().ToString();
             pregunta.Orden       = orden;
             pregunta.Texto       = valor;
             dbContext.PI_BA_Pregunta.Add(pregunta);
             dbContext.SaveChanges();
             PI_BA_PreguntasPorForma pregForma = new PI_BA_PreguntasPorForma();
             pregForma.cvePreguntaPorForma = Guid.NewGuid().ToString();
             pregForma.cveForma            = idForma;
             pregForma.cvePregunta         = pregunta.cvePregunta;
             dbContext.PI_BA_PreguntasPorForma.Add(pregForma);
             dbContext.SaveChanges();
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
         }
     }
 }
Ejemplo n.º 4
0
        public static bool CambiaImagen(string sUserId, string sCorreo, string sNombreImagen)
        {
            using (var dbContext = new wPremiosInstitucionalesdbEntities())
            {
                try
                {
                    if (sUserId != null)
                    {
                        var juez = GetJuezById(sUserId);
                        juez.NombreImagen = sNombreImagen;
                        UpdateJuez(juez);
                        return(true);
                    }
                    else if (sCorreo != null)
                    {
                        var juez = GetJuezByCorreo(sCorreo);
                        juez.NombreImagen = sNombreImagen;
                        UpdateJuez(juez);
                        return(true);
                    }

                    // Si no existe el usuario o no se brindo ni el id ni el correo
                    return(false);
                }
                catch (Exception Ex)
                {
                    Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
                    return(false);
                }
            }
        }
Ejemplo n.º 5
0
        public static List <PI_BA_Categoria> GetCategoriasPendientes()
        {
            using (var dbContext = new wPremiosInstitucionalesdbEntities())
            {
                try
                {
                    var categorias = dbContext.GetCategoriasPendientes().ToList();
                    List <PI_BA_Categoria> validCategories = new List <PI_BA_Categoria>();

                    foreach (var c in categorias)
                    {
                        var convo = GetConvocatoriaById(c.cveConvocatoria);
                        if (DateTime.Today >= convo.FechaInicio)
                        {
                            validCategories.Add(c);
                        }
                    }

                    return(validCategories);
                }
                catch (Exception Ex)
                {
                    Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
                    return(null);
                }
            }
        }
Ejemplo n.º 6
0
        public static bool CheckCandidatoInCategoria(String email, String idCategoria)
        {
            using (var dbContext = new wPremiosInstitucionalesdbEntities())
            {
                try
                {
                    // Revisar que el candidato no tenga una aplicacion para la categoria determinada
                    PI_BA_Candidato candidato = dbContext.PI_BA_Candidato.Where(c => c.Correo.Equals(email)).First();

                    // Revisar si alguna aplicacion de este candidato coincide con la categoria determinada
                    if (candidato.PI_BA_Aplicacion.Count > 0)
                    {
                        var query = candidato.PI_BA_Aplicacion.Where(a => a.cveCategoria.Equals(idCategoria)).ToList();
                        return(query.Count > 0);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (Exception Ex)
                {
                    Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
                    return(false);
                }
            }
        }
Ejemplo n.º 7
0
        public static Dictionary <PI_BA_Aplicacion, PI_BA_Candidato> JuezObtenerCandidatosPorAplicaciones(List <PI_BA_Aplicacion> listaAplicaciones)
        {// Obtengo lista de aplicaciones, regreso diccionario de aplicaciones con candidatos
            using (var dbContext = new wPremiosInstitucionalesdbEntities())
            {
                try
                {
                    var lista = new Dictionary <PI_BA_Aplicacion, PI_BA_Candidato>();

                    foreach (var aplicacion in listaAplicaciones)
                    {
                        var candidato = InformacionPersonalCandidatoService.GetCandidatoById(aplicacion.cveCandidato);

                        // Se despliegan las aplicaciones aceptadas unicamente
                        if (aplicacion.Status == Values.StringValues.Aceptado)
                        {
                            lista.Add(aplicacion, candidato);
                        }
                    }
                    return(lista);
                }
                catch (Exception Ex)
                {
                    Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
                    return(null);
                }
            }
        }
Ejemplo n.º 8
0
 public static Boolean HasWinnersByCategoria(String idCategoria)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             PI_BA_Categoria    categoria      = dbContext.PI_BA_Categoria.Where(c => c.cveCategoria.Equals(idCategoria)).FirstOrDefault();
             PI_BA_Convocatoria convocatoria   = dbContext.PI_BA_Convocatoria.Where(c => c.cveConvocatoria.Equals(categoria.cveConvocatoria)).FirstOrDefault();
             DateTime           fechaactual    = DateTime.Now;
             DateTime           fechaveredicto = Convert.ToDateTime(convocatoria.FechaVeredicto);
             if (DateTime.Compare(fechaactual, fechaveredicto) <= 0)
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(false);
         }
     }
 }
Ejemplo n.º 9
0
 public static void ActualizarConvocatoria(PI_BA_Convocatoria cv)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             dbContext.UpdateConvocatoria(cv.cveConvocatoria, cv.FechaInicio, cv.FechaFin, cv.cvePremio, cv.TituloConvocatoria, cv.FechaVeredicto, cv.FechaCreacion, cv.UsuarioCreacion, cv.FechaEdicion, cv.UsuarioEdicion);
             dbContext.SaveChanges();
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
         }
     }
 }
Ejemplo n.º 10
0
 public static List <PI_BA_Evaluacion> GetEvaluacionesByAplicacion(String appId)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             return(dbContext.GetEvaluacion(null, appId, null).ToList());
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 11
0
 public static PI_BA_Evaluacion GetEvaluacionById(String evalId)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             return(dbContext.GetEvaluacion(evalId, null, null).FirstOrDefault());
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 12
0
 public static void CrearEvaluacion(PI_BA_Evaluacion ev)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             dbContext.AddEvaluacion(ev.cveEvaluacion, ev.Calificacion, ev.cveAplicacion, ev.cveJuez);
             dbContext.SaveChanges();
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
         }
     }
 }
Ejemplo n.º 13
0
 public static void CreateCategoria(PI_BA_Categoria cat)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             dbContext.AddCategoria(cat.cveCategoria, cat.Nombre, cat.cveConvocatoria, cat.cveAplicacionGanadora, cat.FechaCreacion, cat.UsuarioCreacion, cat.FechaEdicion, cat.UsuarioEdicion);
             dbContext.SaveChanges();
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
         }
     }
 }
Ejemplo n.º 14
0
 public static void CreatePremio(PI_BA_Premio pr)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             dbContext.AddPremio(pr.cvePremio, pr.Nombre, pr.NombreImagen, pr.Descripcion, pr.FechaCreacion, pr.UsuarioCreacion, pr.FechaEdicion, pr.UsuarioEdicion);
             dbContext.SaveChanges();
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
         }
     }
 }
Ejemplo n.º 15
0
 public static List <PI_BA_Convocatoria> GetConvocatoriasPremio(string idPremio)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             return(dbContext.GetMostRecentConvocatoria(idPremio).ToList());
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 16
0
 public static PI_BA_Premio GetPremioByClaveCategoria(String idCategoria)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             return(dbContext.GetPremioByIdCategoria(idCategoria).FirstOrDefault());
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 17
0
 public static PI_BA_Candidato GetCandidato(String sCorreo)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             return(dbContext.GetCandidato(sCorreo, null).FirstOrDefault());
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 18
0
 public PI_SE_Configuracion GetConfiguracion(String id)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             return(dbContext.GetConfiguracion(id).FirstOrDefault());
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 19
0
 public static void CreateForma(PI_BA_Forma fr)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             dbContext.AddForma(fr.cveForma, fr.cveCategoria, fr.FechaCreacion, fr.UsuarioCreacion, fr.FechaEdicion, fr.UsuarioEdicion);
             dbContext.SaveChanges();
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
         }
     }
 }
Ejemplo n.º 20
0
 public static List <PI_BA_Juez> GetJueces()
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             return(dbContext.GetJuez(null, null).ToList());
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 21
0
 public static PI_SE_Administrador GetAdministradorByCorreo(string correo)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             return(dbContext.GetAdministrador(correo, null).FirstOrDefault());
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 22
0
 public static PI_BA_Juez GetJuezById(string id)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             return(dbContext.GetJuez(null, id).FirstOrDefault());
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 23
0
 public static PI_BA_Aplicacion GetAplicacionById(String cveApp)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             var aplicacion = dbContext.PI_BA_Aplicacion.Where(a => a.cveAplicacion.Equals(cveApp)).ToList().FirstOrDefault();
             return(aplicacion);
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 24
0
 public static void UpdateAplicacionArchivo(String cveApp, String sArchivo)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             var aplicacion = dbContext.PI_BA_Aplicacion.Where(a => a.cveAplicacion.Equals(cveApp)).ToList().FirstOrDefault();
             aplicacion.NombreArchivo = sArchivo;
             dbContext.SaveChanges();
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
         }
     }
 }
Ejemplo n.º 25
0
 public static List <PI_BA_Aplicacion> GetAplicacionesByCategoria(String categoria)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             var aplicaciones = dbContext.PI_BA_Aplicacion.Where(a => a.cveCategoria.Equals(categoria)).ToList();
             return(aplicaciones);
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 26
0
 public static void SetAplicacionModificada(String idAplicacion)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             PI_BA_Aplicacion aplicacion = dbContext.PI_BA_Aplicacion.Where(c => c.cveAplicacion.Equals(idAplicacion)).FirstOrDefault();
             aplicacion.Status = StringValues.Modificado;
             dbContext.SaveChanges();
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
         }
     }
 }
Ejemplo n.º 27
0
 public static Boolean GetEsRechazadoByAplicacion(String idAplicacion)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             PI_BA_Aplicacion aplicacion = dbContext.PI_BA_Aplicacion.Where(c => c.cveAplicacion.Equals(idAplicacion)).FirstOrDefault();
             return(aplicacion.Status.Equals(StringValues.Rechazado));
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(false);
         }
     }
 }
Ejemplo n.º 28
0
 public static PI_BA_Categoria GetCategoriaByClaveCategoria(String idCategoria)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             PI_BA_Categoria categoria = dbContext.PI_BA_Categoria.Where(c => c.cveCategoria.Equals(idCategoria)).FirstOrDefault();
             return(categoria);
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 29
0
 public static PI_BA_Aplicacion ObtenerAplicacionDeClave(String claveAplicacion)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             PI_BA_Aplicacion aplicacion = dbContext.PI_BA_Aplicacion.Where(c => c.cveAplicacion.Equals(claveAplicacion)).FirstOrDefault();
             return(aplicacion);
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
             return(null);
         }
     }
 }
Ejemplo n.º 30
0
 public static void CambiarNombreCategoria(String idCategoria, String nombre)
 {
     using (var dbContext = new wPremiosInstitucionalesdbEntities())
     {
         try
         {
             PI_BA_Categoria categoria = dbContext.PI_BA_Categoria.Where(c => c.cveCategoria.Equals(idCategoria)).FirstOrDefault();
             categoria.Nombre = nombre;
             dbContext.SaveChanges();
         }
         catch (Exception Ex)
         {
             Console.WriteLine("Catched Exception: " + Ex.Message + Environment.NewLine);
         }
     }
 }