예제 #1
0
        public ActionResult viewdiscussion(tbl_CourseAssigntoTeacherValidation testing)
        {
            try
            {
                int teacherid = Convert.ToInt32(Session["Teacher"]);
                int tempclassid;
                int originalclassid;
                var getteacherid = dbContext.Teachers.Find(teacherid);
                tempclassid = getteacherid.Class_Id;
                var classid = dbContext.Tbl_Class.Where(x => x.Class_Id == tempclassid).SingleOrDefault();
                originalclassid = classid.Class_Id;


                CourseDBHandle gc = new CourseDBHandle();

                List <tbl_CourseAssigntoTeacherValidation> list = gc.GetTeacherAssignedCourse(teacherid, originalclassid);
                ViewBag.course = new SelectList(list, "courseId", "courseName");
                return(RedirectToAction("Index", new { courseid = testing.courseId }));
            }
            catch (Exception ex)
            {
                ViewBag.Message = "Please try later";
                return(View());
            }
        }
예제 #2
0
        public ActionResult viewdiscussion()
        {
            if (Session["Teacher"] == null)
            {
                return(RedirectToAction("login", "Home", new { area = "" }));
            }
            int teacherid = Convert.ToInt32(Session["Teacher"]);
            int tempclassid;
            int originalclassid;
            var getteacherid = dbContext.Teachers.Find(teacherid);

            tempclassid = getteacherid.Class_Id;
            var classid = dbContext.Tbl_Class.Where(x => x.Class_Id == tempclassid).SingleOrDefault();

            originalclassid = classid.Class_Id;


            CourseDBHandle gc = new CourseDBHandle();

            List <tbl_CourseAssigntoTeacherValidation> list = gc.GetTeacherAssignedCourse(teacherid, originalclassid);

            ViewBag.course = new SelectList(list, "courseId", "courseName");



            return(View());
        }
예제 #3
0
        public ActionResult PostMessage(MessageReplyViewModel vm)
        {
            int msgid = 0;

            int teacherid = Convert.ToInt32(Session["Teacher"]);

            int schoolid;
            int classid;
            var getteacherid = dbContext.Teachers.Find(teacherid);

            schoolid = getteacherid.School_Id;
            classid  = getteacherid.Class_Id;

            CourseDBHandle gc = new CourseDBHandle();
            int            tempclassid;
            int            originalclassid;

            tempclassid = getteacherid.Class_Id;
            var classid1 = dbContext.Tbl_Class.Where(x => x.Class_Id == tempclassid).SingleOrDefault();

            originalclassid = classid1.Class_Id;
            List <tbl_CourseAssigntoTeacherValidation> list = gc.GetTeacherAssignedCourse(teacherid, originalclassid);

            ViewBag.course = new SelectList(list, "courseId", "courseName");

            Message messagetoPost = new Message();

            if (vm.Message.Subject != string.Empty && vm.Message.MessageToPost != string.Empty)
            {
                messagetoPost.DatePosted = DateTime.Now;
                messagetoPost.Subject    = vm.Message.Subject;
                messagetoPost.courseId   = vm.Message.courseId;

                messagetoPost.MessageToPost = vm.Message.MessageToPost;
                messagetoPost.From          = Session["TeacherName"].ToString();
                messagetoPost.Class_Id      = classid;
                messagetoPost.Role_ID       = 3;
                messagetoPost.UserId        = teacherid;
                messagetoPost.courseId      = vm.Message.courseId;
                messagetoPost.SchoolId      = schoolid;
                dbContext.Messages.Add(messagetoPost);
                dbContext.SaveChanges();
                msgid = messagetoPost.Id;
            }

            return(RedirectToAction("Index", "Message", new { Id = msgid, courseid = vm.Message.courseId }));
        }
예제 #4
0
        public ActionResult Create()
        {
            int teacherid            = Convert.ToInt32(Session["Teacher"]);
            MessageReplyViewModel vm = new MessageReplyViewModel();
            CourseDBHandle        gc = new CourseDBHandle();
            int tempclassid;
            int originalclassid;
            var getteacherid = dbContext.Teachers.Find(teacherid);

            tempclassid = getteacherid.Class_Id;
            var classid = dbContext.Tbl_Class.Where(x => x.Class_Id == tempclassid).SingleOrDefault();

            originalclassid = classid.Class_Id;
            List <tbl_CourseAssigntoTeacherValidation> list = gc.GetTeacherAssignedCourse(teacherid, originalclassid);

            ViewBag.course = new SelectList(list, "courseId", "courseName");
            return(View(vm));
        }
예제 #5
0
        public JsonResult addonlinetest(QuestionOptionViewModel QuestionOption)
        {
            int teacherid = Convert.ToInt32(Session["Teacher"]);

            int tempclassid;
            int schoolid;
            int originalclassid;
            var getteacherid = db.Teachers.Find(teacherid);

            tempclassid = getteacherid.Class_Id;
            var classid = db.Tbl_Class.Where(x => x.Class_Id == tempclassid).SingleOrDefault();

            originalclassid = classid.Class_Id;


            CourseDBHandle gc = new CourseDBHandle();

            List <tbl_CourseAssigntoTeacherValidation> list = gc.GetTeacherAssignedCourse(teacherid, originalclassid);

            ViewBag.course = new SelectList(list, "courseId", "courseName");
            OnlineTest q = new OnlineTest();

            q.Role_Id = Convert.ToInt32(Session["RoleId"]);
            q.UserId  = Convert.ToInt32(Session["Teacher"]);
            var getteachid = db.Teachers.Find(teacherid);

            schoolid   = getteachid.School_Id;
            q.SchoolId = schoolid;
            //OnlineTest test = new OnlineTest();
            q.CourseId     = QuestionOption.CourseId;
            q.QuestionName = QuestionOption.QuestionName;
            q.IsActive     = true;
            q.ClassId      = originalclassid;
            q.CreatedDate  = DateTime.Now;
            q.Duration     = "1 hour";
            q.IsMultiple   = false;
            db.OnlineTests.Add(q);
            db.SaveChanges();

            int questionId = q.QuestionId;

            foreach (var item in QuestionOption.ListOfOptions)
            {
                OnlineTestQuestionOption objoption = new OnlineTestQuestionOption();
                objoption.OptionName = item;
                objoption.QuestionId = questionId;
                db.OnlineTestQuestionOptions.Add(objoption);
                db.SaveChanges();
            }
            OnlineTestAnswer objanswer = new OnlineTestAnswer();

            objanswer.AnswerText = QuestionOption.AnswerText;
            objanswer.RoleId     = Convert.ToInt32(Session["RoleId"]);
            objanswer.UserId     = Convert.ToInt32(Session["Teacher"]);
            objanswer.SchoolId   = schoolid;



            objanswer.QuestionId = questionId;
            db.OnlineTestAnswers.Add(objanswer);
            db.SaveChanges();

            return(Json(new { message = "Data Successfully Added", success = true }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult uploadLecture(tbl_LectureValidation lec)
        {
            int teacherid = Convert.ToInt32(Session["Teacher"]);

            int tempclassid;
            int schoolid;
            int originalclassid;

            var getteacherid = db.Teachers.Find(teacherid);

            tempclassid = getteacherid.Class_Id;
            schoolid    = getteacherid.School_Id;
            var classid = db.Tbl_Class.Where(x => x.Class_Id == tempclassid).SingleOrDefault();

            originalclassid = classid.Class_Id;

            lec.SchoolId = schoolid;
            lec.ClassId  = originalclassid;
            CourseDBHandle gc = new CourseDBHandle();

            List <tbl_CourseAssigntoTeacherValidation> list = gc.GetTeacherAssignedCourse(teacherid, originalclassid);

            ViewBag.course = new SelectList(list, "courseId", "courseName");


            if (lec.UserdocFIle == null)
            {
                ModelState.AddModelError("CustomError", "Please Select File");
                return(View());
            }
            if (!(lec.UserdocFIle.ContentType == "application/pdf" || lec.UserdocFIle.ContentType == "application/pdf"))
            {
                ModelState.AddModelError("CustomError", "Select Doc or Pdf extention file only ");
                return(View());
            }

            try
            {
                Lecture teaclecture = new Lecture();

                string fileName = Guid.NewGuid() + Path.GetExtension(lec.UserdocFIle.FileName);
                lec.UserdocFIle.SaveAs(Path.Combine(Server.MapPath("~/FrontEnd/File_upload/Lecture/"), fileName));

                teaclecture.LectureUrl          = fileName;
                teaclecture.Lecturename         = lec.Lecturename;
                teaclecture.CourseId            = lec.CourseId;
                teaclecture.ClassId             = lec.ClassId;
                teaclecture.CreatedDate         = DateTime.Now;
                teaclecture.Lecture_Description = lec.Lecture_Description;
                teaclecture.SchoolId            = lec.SchoolId;
                teaclecture.VideoLink           = lec.VideoLink;
                teaclecture.UserId = Convert.ToInt32(Session["Teacher"]);

                db.Lectures.Add(teaclecture);

                db.SaveChanges();

                ModelState.Clear();


                ViewBag.Message = "Data Submitted";
            }
            catch (Exception ex)
            {
                ViewBag.Message = "Not Submitted";
                return(View());
            }



            return(View());
        }
        public ActionResult addtestfile(tbl_TestFileValidation tfile)
        {
            int teacherid = Convert.ToInt32(Session["Teacher"]);

            int tempclassid;
            int schoolid;
            int originalclassid;

            var getteacherid = db.Teachers.Find(teacherid);

            tempclassid = getteacherid.Class_Id;
            schoolid    = getteacherid.School_Id;
            var classid = db.Tbl_Class.Where(x => x.Class_Id == tempclassid).SingleOrDefault();

            originalclassid = classid.Class_Id;
            CourseDBHandle gc = new CourseDBHandle();

            tfile.SchoolId = schoolid;
            tfile.ClassId  = originalclassid;
            List <tbl_CourseAssigntoTeacherValidation> list = gc.GetTeacherAssignedCourse(teacherid, originalclassid);

            ViewBag.course = new SelectList(list, "courseId", "courseName");


            if (tfile.UserdocFIle == null)
            {
                ModelState.AddModelError("CustomError", "Please Select File");
                return(View());
            }
            if (!(tfile.UserdocFIle.ContentType == "application/msword" || tfile.UserdocFIle.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || tfile.UserdocFIle.ContentType == "application/pdf"))
            {
                ViewBag.Message = "Select  doc or Docx Pdf extention file only ";
                return(View());
            }

            try
            {
                ManualTest mantestfile = new ManualTest();

                string fileName = Guid.NewGuid() + Path.GetExtension(tfile.UserdocFIle.FileName);
                tfile.UserdocFIle.SaveAs(Path.Combine(Server.MapPath("~/FrontEnd/File_Upload/ManualTest/"), fileName));


                mantestfile.TestUrl     = fileName;
                mantestfile.CourseId    = tfile.CourseId;
                mantestfile.ClassId     = tfile.ClassId;
                mantestfile.CreatedDate = DateTime.Now;
                mantestfile.Duration    = tfile.Duration;
                mantestfile.SchoolId    = tfile.SchoolId;
                mantestfile.UserId      = Convert.ToInt32(Session["Teacher"]);



                db.ManualTests.Add(mantestfile);
                db.SaveChanges();


                ModelState.Clear();

                ViewBag.Message = "Data Submitted";
            }
            catch (Exception ex)
            {
                ViewBag.Message = "Not Submitted";
                return(View());
            }



            return(View());
        }
        public ActionResult assignment(tbl_AssignmentValidation a)
        {
            int teacherid = Convert.ToInt32(Session["Teacher"]);

            int tempclassid;
            int schoolid;
            int originalclassid;

            var getteacherid = db.Teachers.Find(teacherid);

            tempclassid = getteacherid.Class_Id;
            schoolid    = getteacherid.School_Id;
            var classid = db.Tbl_Class.Where(x => x.Class_Id == tempclassid).SingleOrDefault();

            originalclassid = classid.Class_Id;

            a.SchoolId = schoolid;
            a.ClassId  = originalclassid;
            CourseDBHandle gc = new CourseDBHandle();

            List <tbl_CourseAssigntoTeacherValidation> list = gc.GetTeacherAssignedCourse(teacherid, originalclassid);

            ViewBag.course = new SelectList(list, "courseId", "courseName");


            if (a.UserdocFIle == null)
            {
                ModelState.AddModelError("CustomError", "Please Select File");
                return(View());
            }
            if (!(a.UserdocFIle.ContentType == "application/pdf" || a.UserdocFIle.ContentType == "application/pdf"))
            {
                ModelState.AddModelError("CustomError", "Select Doc or Pdf extention file only ");
                return(View());
            }

            try
            {
                SchoolAssignment scassignemnt = new SchoolAssignment();


                string fileName = Guid.NewGuid() + Path.GetExtension(a.UserdocFIle.FileName);
                a.UserdocFIle.SaveAs(Path.Combine(Server.MapPath("~/FrontEnd/File_Upload/Assignment/"), fileName));

                scassignemnt.AssignmentUrl  = fileName;
                scassignemnt.AssignmentName = a.AssignmentName;
                scassignemnt.CourseId       = a.CourseId;
                scassignemnt.ClassId        = a.ClassId;
                scassignemnt.CreatedDate    = DateTime.Now;
                scassignemnt.Duration       = a.Duration;
                scassignemnt.SchoolId       = a.SchoolId;
                scassignemnt.UserId         = Convert.ToInt32(Session["Teacher"]);

                db.SchoolAssignments.Add(scassignemnt);

                db.SaveChanges();

                ModelState.Clear();


                ViewBag.Message = "Data Submitted";
            }
            catch (Exception ex)
            {
                ViewBag.Message = "Not Submitted";
                return(View());
            }



            return(View());
        }