Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CertificateStudentM_M certificateStudentM_M = db.CertificateStudentM_M.Find(id);

            db.CertificateStudentM_M.Remove(certificateStudentM_M);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit(CertificateStudentM_M certificateStudentM_M)
 {
     if (ModelState.IsValid)
     {
         db.Entry(certificateStudentM_M).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CertificateId = new SelectList(db.Certificates, "Id", "CirtificateTypeName", certificateStudentM_M.CertificateId);
     ViewBag.GradeId       = new SelectList(db.Grades, "Id", "GradeName", certificateStudentM_M.GradeId);
     ViewBag.StudentId     = new SelectList(db.Students, "Id", "SchoolSection", certificateStudentM_M.StudentId);
     return(View(certificateStudentM_M));
 }
        public ActionResult Create(CertificateStudentM_M certificateStudentM_M, List <int> StudentId, int Phase)
        {
            if (ModelState.IsValid)
            {
                if (Phase == 1)
                {
                    foreach (var item in StudentId)
                    {
                        certificateStudentM_M.StudentId = item;
                        certificateStudentM_M.Date      = DateTime.Now;
                        db.CertificateStudentM_M.Add(certificateStudentM_M);
                        var old = db.Students.Find(certificateStudentM_M.StudentId);
                        old.IsGraduatedS = true;
                        db.SaveChanges();
                    }
                }
                else if (Phase == 2)
                {
                    foreach (var item in StudentId)
                    {
                        certificateStudentM_M.StudentId = item;
                        certificateStudentM_M.Date      = DateTime.Now;
                        db.CertificateStudentM_M.Add(certificateStudentM_M);
                        var old = db.Students.Find(certificateStudentM_M.StudentId);
                        old.IsGraduatedI = true;
                        db.SaveChanges();
                    }
                }
                else
                {
                    foreach (var item in StudentId)
                    {
                        certificateStudentM_M.StudentId = item;
                        certificateStudentM_M.Date      = DateTime.Now;
                        db.CertificateStudentM_M.Add(certificateStudentM_M);
                        var old = db.Students.Find(certificateStudentM_M.StudentId);
                        old.IsGraduatedP = true;
                        db.SaveChanges();
                    }
                }



                return(RedirectToAction("Index"));
            }

            ViewBag.CertificateId = new SelectList(db.Certificates, "Id", "CirtificateTypeName", certificateStudentM_M.CertificateId);
            ViewBag.GradeId       = new SelectList(db.Grades.Where(a => a.Is_Deleted != true), "Id", "GradeName", certificateStudentM_M.GradeId);
            ViewBag.StudentId     = new SelectList(db.Students.Where(a => a.Is_Deleted != true), "Id", "SchoolSection", certificateStudentM_M.StudentId);
            return(View(certificateStudentM_M));
        }
Example #4
0
        // GET: CertificateStudentM_M/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CertificateStudentM_M certificateStudentM_M = db.CertificateStudentM_M.Find(id);

            if (certificateStudentM_M == null)
            {
                return(HttpNotFound());
            }
            return(View(certificateStudentM_M));
        }
        // GET: CertificateStudentM_MSecondary/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CertificateStudentM_M certificateStudentM_M = db.CertificateStudentM_M.Find(id);

            if (certificateStudentM_M == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CertificateId = new SelectList(db.Certificates, "Id", "CirtificateTypeName", certificateStudentM_M.CertificateId);
            ViewBag.GradeId       = new SelectList(db.Grades, "Id", "GradeName", certificateStudentM_M.GradeId);
            ViewBag.StudentId     = new SelectList(db.Students, "Id", "SchoolSection", certificateStudentM_M.StudentId);
            return(View(certificateStudentM_M));
        }
Example #6
0
        // GET: CertificateStudentM_M/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CertificateStudentM_M certificateStudentM_M = db.CertificateStudentM_M.Find(id);

            if (certificateStudentM_M == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CertificateId            = new SelectList(db.Certificates, "Id", "CirtificateTypeName", certificateStudentM_M.CertificateId);
            ViewBag.GradeId                  = new SelectList(db.Grades, "Id", "GradeName", certificateStudentM_M.GradeId);
            ViewBag.GraduationProjectGradeId = new SelectList(db.Grades, "Id", "GradeName", certificateStudentM_M.GradeId);
            ViewBag.StudentId                = new SelectList(db.Students.Where(a => a.Is_Deleted != true && a.IsGraduatedS == true && a.IsGraduatedU != true).Select(a => new { a.Id, a.Citizen.citizen_national_id }), "Id", "citizen_national_id");


            return(View(certificateStudentM_M));
        }
Example #7
0
        public ActionResult Create(CertificateStudentM_M certificateStudentM_M, int facultyId, List <int> StudentId)
        {
            if (ModelState.IsValid)
            {
                foreach (var item in StudentId)
                {
                    certificateStudentM_M.StudentId = item;
                    db.CertificateStudentM_M.Add(certificateStudentM_M);
                    var old = db.Students.Find(certificateStudentM_M.StudentId);
                    old.IsGraduatedU = true;
                    db.SaveChanges();
                }


                return(RedirectToAction("Index"));
            }

            ViewBag.CertificateId            = new SelectList(db.Certificates, "Id", "CirtificateTypeName", certificateStudentM_M.CertificateId);
            ViewBag.GradeId                  = new SelectList(db.Grades, "Id", "GradeName", certificateStudentM_M.GradeId);
            ViewBag.GraduationProjectGradeId = new SelectList(db.Grades, "Id", "GradeName", certificateStudentM_M.GradeId);
            ViewBag.StudentId                = new SelectList(db.Students.Where(a => a.Is_Deleted != true && a.IsGraduatedS == true && a.IsGraduatedU != true).Select(a => new { a.Id, a.Citizen.citizen_national_id }), "Id", "citizen_national_id");

            return(View(certificateStudentM_M));
        }
Example #8
0
        public ActionResult Create(CertificateStudentM_M certificateStudentM_M, List <int> StudentId, int Phase)
        {
            if (ModelState.IsValid)
            {
                var data = db.CertificateStudentM_M.Where(a => a.StudentId == certificateStudentM_M.StudentId && a.CertificateId == certificateStudentM_M.CertificateId).SingleOrDefault();
                if (data != null)
                {
                    ViewBag.CertificateId = new SelectList(db.Certificates, "Id", "CirtificateTypeName", certificateStudentM_M.CertificateId);
                    ViewBag.GradeId       = new SelectList(db.Grades.Where(a => a.Is_Deleted != true), "Id", "GradeName", certificateStudentM_M.GradeId);
                    ViewBag.StudentId     = new SelectList(db.Students.Where(a => a.Is_Deleted != true), "Id", "SchoolSection", certificateStudentM_M.StudentId);

                    if (Session["lang"] != null)
                    {
                        if (Session["lang"].ToString().Equals("ar-EG"))
                        {
                            ViewBag.CertificateId = new SelectList(db.Certificates, "Id", "CirtificateTypeNameArabic", certificateStudentM_M.CertificateId);
                            ViewBag.GradeId       = new SelectList(db.Grades.Where(a => a.Is_Deleted != true), "Id", "GradeNameArabic", certificateStudentM_M.GradeId);
                            ViewBag.StudentId     = new SelectList(db.Students.Where(a => a.Is_Deleted != true), "Id", "SchoolSection", certificateStudentM_M.StudentId);
                        }
                    }
                }
                if (Phase == 1)
                {
                    foreach (var item in StudentId)
                    {
                        certificateStudentM_M.StudentId = item;
                        certificateStudentM_M.Date      = DateTime.Now;
                        db.CertificateStudentM_M.Add(certificateStudentM_M);
                        var old = db.Students.Find(certificateStudentM_M.StudentId);
                        old.IsGraduatedS = true;
                        db.SaveChanges();
                    }
                }
                else if (Phase == 2)
                {
                    foreach (var item in StudentId)
                    {
                        certificateStudentM_M.StudentId = item;
                        certificateStudentM_M.Date      = DateTime.Now;
                        db.CertificateStudentM_M.Add(certificateStudentM_M);
                        var old = db.Students.Find(certificateStudentM_M.StudentId);
                        old.IsGraduatedI = true;
                        db.SaveChanges();
                    }
                }
                else
                {
                    foreach (var item in StudentId)
                    {
                        certificateStudentM_M.StudentId = item;
                        certificateStudentM_M.Date      = DateTime.Now;
                        db.CertificateStudentM_M.Add(certificateStudentM_M);
                        var old = db.Students.Find(certificateStudentM_M.StudentId);
                        old.IsGraduatedP = true;
                        db.SaveChanges();
                    }
                }



                return(RedirectToAction("SchoolCertificate", "CertificateStudentM_M"));
            }

            ViewBag.CertificateId = new SelectList(db.Certificates, "Id", "CirtificateTypeName", certificateStudentM_M.CertificateId);
            ViewBag.GradeId       = new SelectList(db.Grades.Where(a => a.Is_Deleted != true), "Id", "GradeName", certificateStudentM_M.GradeId);
            ViewBag.StudentId     = new SelectList(db.Students.Where(a => a.Is_Deleted != true), "Id", "SchoolSection", certificateStudentM_M.StudentId);
            return(View(certificateStudentM_M));
        }