Пример #1
0
 public static bool RegistrarCurriculaBase(CurriculaBase Base)
 {
     using (var cn = new InnovaEntities())
     {
         try
         {
             if (Base.IdCurriculaBase > 0)
             {
                 var baseEdit = cn.CurriculaBase.FirstOrDefault(b => b.IdCurriculaBase == Base.IdCurriculaBase);
                 if (baseEdit != null)
                 {
                     baseEdit.Año = Base.Año;
                     baseEdit.NumeroResolucion = Base.NumeroResolucion;
                     baseEdit.Descripcion      = Base.Descripcion;
                     baseEdit.Vigencia         = Base.Vigencia;
                     cn.SaveChanges();
                 }
             }
             else
             {
                 cn.CurriculaBase.Add(Base);
                 cn.SaveChanges();
             }
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Пример #2
0
 public static bool RegistrarPlanByIdGrado(int idCurriculaBase, int idAreaCurricular, int IdGrado, decimal Horas)
 {
     using (var cn = new InnovaEntities())
     {
         try
         {
             var PlanEdit = (from c in cn.PlanEstudiosBase
                             where c.IdCurriculaBase == idCurriculaBase &&
                             c.IdAreaCurricular == idAreaCurricular &&
                             c.IdGrado == IdGrado
                             select c).FirstOrDefault();
             if (PlanEdit != null)
             {
                 PlanEdit.Horas = Horas;
                 cn.SaveChanges();
             }
             else
             {
                 cn.PlanEstudiosBase.Add(new PlanEstudiosBase
                 {
                     IdCurriculaBase  = idCurriculaBase,
                     IdAreaCurricular = idAreaCurricular,
                     IdGrado          = IdGrado,
                     Horas            = Horas
                 });
                 cn.SaveChanges();
             }
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
 public static bool RegistrarCurriculaBase(CurriculaBase Base)
 {
     using (var cn = new InnovaEntities())
     {
         try
         {
             if (Base.IdCurriculaBase > 0)
             {
                 var baseEdit = cn.CurriculaBase.FirstOrDefault(b => b.IdCurriculaBase == Base.IdCurriculaBase);
                 if (baseEdit != null)
                 {
                     baseEdit.Año = Base.Año;
                     baseEdit.NumeroResolucion = Base.NumeroResolucion;
                     baseEdit.Descripcion      = Base.Descripcion;
                     if (Convert.ToBoolean(Base.Vigencia))
                     {
                         cn.CurriculaBase.ToList().ForEach(s => s.Vigencia = false);
                         baseEdit.Vigencia = Base.Vigencia;
                     }
                     else
                     {
                         baseEdit.Vigencia = Base.Vigencia;
                     }
                     cn.SaveChanges();
                 }
             }
             else
             {
                 // se valida que una resolución no se registre dos veces.
                 var baseEdit = cn.CurriculaBase.FirstOrDefault(b => b.NumeroResolucion.Trim() == Base.NumeroResolucion.Trim());
                 if (baseEdit != null)
                 {
                     return(false);
                 }
                 else
                 {
                     if (Convert.ToBoolean(Base.Vigencia))
                     {
                         cn.CurriculaBase.ToList().ForEach(s => s.Vigencia = false);
                     }
                     cn.CurriculaBase.Add(Base);
                     cn.SaveChanges();
                 }
             }
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
        public static bool RegistrarCompetenciaArea(CurriculaBaseCompetencia BaseCompetencia)
        {
            using (var cn = new InnovaEntities())
            {
                try
                {
                    var ragistroValidacion = cn.CurriculaBaseCompetencia.FirstOrDefault(
                        c => c.IdAreaCurricular == BaseCompetencia.IdAreaCurricular &&
                        c.IdCompetencia == BaseCompetencia.IdCompetencia && c.IdCurriculaBase == BaseCompetencia.IdCurriculaBase);

                    if (ragistroValidacion != null)
                    {
                        return(false);
                    }
                    else
                    {
                        cn.CurriculaBaseCompetencia.Add(BaseCompetencia);
                        cn.SaveChanges();
                        return(true);
                    }
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }
Пример #5
0
 public static bool RegistrarCompetenciaArea(CurriculaBaseCompetencia BaseCompetencia)
 {
     using (var cn = new InnovaEntities())
     {
         try
         {
             cn.CurriculaBaseCompetencia.Add(BaseCompetencia);
             cn.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Пример #6
0
        public static bool EliminarCompetenciaCapadidadArea(int idCurriculaBaseCompetencia)
        {
            using (var cn = new InnovaEntities())
            {
                try
                {
                    var baseCompetencia = cn.CurriculaBaseCompetencia.FirstOrDefault(c => c.IdCurriculaBaseCompetencia == idCurriculaBaseCompetencia);
                    if (baseCompetencia != null)
                    {
                        cn.CurriculaBaseCompetencia.Remove(baseCompetencia);
                        cn.SaveChanges();
                    }

                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }