Exemple #1
0
 public ActionResult EditarVinculoModulo([Bind(Include = "Vinculo_ID, Modulo_ID, Matricula_ID, Status_Vinculo")] Negocio_Vinculo_Modulo vm)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(vm).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("VerAluno", new { id = vm.Matricula_ID }));
         }
         return(View(vm));
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
     {
         Exception raise = dbEx;
         foreach (var validationErrors in dbEx.EntityValidationErrors)
         {
             foreach (var validationError in validationErrors.ValidationErrors)
             {
                 string message = string.Format("{0}:{1}",
                                                validationErrors.Entry.Entity.ToString(),
                                                validationError.ErrorMessage);
                 raise = new InvalidOperationException(message, raise);
             }
         }
         throw raise;
     }
 }
Exemple #2
0
        public ActionResult RemoverVinculoModuloConfirmacao(int id)
        {
            Negocio_Vinculo_Modulo vinculo = db.Negocio_Vinculo_Modulo.Find(id);

            db.Negocio_Vinculo_Modulo.Remove(vinculo);
            db.SaveChanges();
            return(RedirectToAction("VerAluno", new { id = vinculo.Matricula_ID }));
        }
Exemple #3
0
        public ActionResult RemoverVinculoModulo(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Negocio_Vinculo_Modulo vinculo = db.Negocio_Vinculo_Modulo.Find(id);

            if (vinculo == null)
            {
                return(HttpNotFound());
            }
            return(View(vinculo));
        }
Exemple #4
0
        public ActionResult VincularModulo(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Negocio_Matricula_Aluno aluno = db.Negocio_Matricula_Aluno.Find(id);

            if (aluno == null)
            {
                return(HttpNotFound());
            }
            Negocio_Vinculo_Modulo NVM = new Negocio_Vinculo_Modulo();

            NVM.Matricula_ID = aluno.Matricula_ID;
            PopulateModuloDropDownList(aluno.Matricula_ID);
            return(View(NVM));
        }
Exemple #5
0
        public async Task <ActionResult> VincularModulo([Bind(Include = "Vinculo_ID, Modulo_ID, Matricula_ID, Status_Vinculo")] Negocio_Vinculo_Modulo vm)
        {
            if (ModelState.IsValid)
            {
                int c = 0;
                foreach (var st in db.Negocio_Vinculo_Modulo)
                {
                    if (st.Matricula_ID == vm.Matricula_ID)
                    {
                        if (st.Status_Vinculo == "Matricula Trancada" && st.Status_Vinculo == "Reprovado")
                        {
                            c += 1;
                        }
                    }
                }
                if (c > 0)
                {
                    return(RedirectToAction("Error"));
                }
                //vm.Status_Vinculo = "Em Curso";
                db.Negocio_Vinculo_Modulo.Add(vm);
                await db.SaveChangesAsync();

                Negocio_Vinculo_Disciplina vd;
                foreach (var d in db.Negocio_Disciplina.ToList())
                {
                    if (d.Modulo_ID == vm.Modulo_ID)
                    {
                        vd = new Negocio_Vinculo_Disciplina();
                        vd.Disciplina_ID = d.Disciplina_ID;
                        vd.Matricula_ID  = vm.Matricula_ID;
                        vd.Frequencia    = 0;
                        vd.Nota1         = 0;
                        vd.Nota2         = 0;
                        vd.Media_Final   = 0;
                        db.Negocio_Vinculo_Disciplina.Add(vd);
                        await db.SaveChangesAsync();
                    }
                }
                return(RedirectToAction("VerAluno", new { id = vm.Matricula_ID }));
            }
            PopulateModuloDropDownList(vm.Matricula_ID, vm.Modulo_ID);
            return(View(vm));
        }
Exemple #6
0
        public async Task <ActionResult> VincularMatModulo([Bind(Include = "ModuloID, MatriculaID, StatusVinculo")] CriarVinculoModuloViewModel CVMVM)
        {
            if (ModelState.IsValid)
            {
                Negocio_Vinculo_Modulo NVM = new Negocio_Vinculo_Modulo();
                NVM.Matricula_ID   = CVMVM.MatriculaID;
                NVM.Modulo_ID      = CVMVM.ModuloID;
                NVM.Status_Vinculo = CVMVM.StatusVinculo;
                db.Negocio_Vinculo_Modulo.Add(NVM);
                await db.SaveChangesAsync();

                Negocio_Vinculo_Disciplina disciplina;
                foreach (var d in db.Negocio_Disciplina.ToList())
                {
                    if (d.Modulo_ID == CVMVM.ModuloID)
                    {
                        disciplina = new Negocio_Vinculo_Disciplina();
                        disciplina.Disciplina_ID = d.Disciplina_ID;
                        disciplina.Matricula_ID  = CVMVM.MatriculaID;
                        disciplina.Frequencia    = 0;
                        disciplina.Num_Chamada   = 0;
                        disciplina.Nota1         = 0;
                        disciplina.Nota2         = 0;
                        disciplina.Media_Final   = 0;
                        db.Negocio_Vinculo_Disciplina.Add(disciplina);
                        await db.SaveChangesAsync();
                    }
                }
                bool DeveDoc = db.Negocio_Matricula_Aluno.Find(CVMVM.MatriculaID).Deve_Documento.Value;
                if (DeveDoc)
                {
                    return(RedirectToAction("DeveDocumento", "Matricula", new { id = CVMVM.MatriculaID }));
                }
                return(RedirectToAction("Index"));
            }
            int cursoID = db.Negocio_Matricula_Aluno.Find(CVMVM.MatriculaID).Curso_ID;

            PopulateModuloMatriculaDropDownList(cursoID, CVMVM.ModuloID);
            return(View(CVMVM));
        }
Exemple #7
0
        public ActionResult VerVinculoModulo(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Negocio_Vinculo_Modulo vinculo = db.Negocio_Vinculo_Modulo.Find(id);

            if (vinculo == null)
            {
                return(HttpNotFound());
            }

            VerVinculoModuloViewModel VVMVM = new VerVinculoModuloViewModel();

            VVMVM.VinculoID     = vinculo.Vinculo_ID;
            VVMVM.MatID         = vinculo.Matricula_ID;
            VVMVM.ModuloNM      = vinculo.Negocio_Modulo.Modulo_Nome;
            VVMVM.StatusVinculo = vinculo.Status_Vinculo;

            ListaDisciplinasViewModel        LDVM;
            List <ListaDisciplinasViewModel> listTemp = new List <ListaDisciplinasViewModel>();

            foreach (var d in db.Negocio_Disciplina)
            {
                if (d.Modulo_ID == vinculo.Modulo_ID)
                {
                    LDVM = new ListaDisciplinasViewModel();
                    LDVM.DisciplinaID = d.Disciplina_ID;
                    LDVM.DisciplinaNM = d.Disciplina_Nome;
                    listTemp.Add(LDVM);
                }
            }
            VVMVM.disciplinas = listTemp;

            return(View(VVMVM));
        }