Ejemplo n.º 1
0
        public DataTable CRUDAddExams(StudentsExams stdExam, string action)
        {
            DataTable dtResult = new DataTable();

            try
            {
                SqlParameter objSqlParameter   = new SqlParameter("StudentExamId", stdExam.ExamTimesId);
                SqlParameter objSqlParameter1  = new SqlParameter("StudentId", stdExam.StudentId);
                SqlParameter objSqlParameter2  = new SqlParameter("Description", stdExam.Description);
                SqlParameter objSqlParameter3  = new SqlParameter("CourseId", stdExam.CourseId);
                SqlParameter objSqlParameter4  = new SqlParameter("ExamTime", stdExam.ExamTimesId);
                SqlParameter objSqlParameter5  = new SqlParameter("ExamDate", stdExam.ExamDate);
                SqlParameter objSqlParameter6  = new SqlParameter("Fees", stdExam.Fees);
                SqlParameter objSqlParameter7  = new SqlParameter("IsExpired", stdExam.IsExpired);
                SqlParameter objSqlParameter8  = new SqlParameter("ExamResult", stdExam.ExamResult);
                SqlParameter objSqlParameter9  = new SqlParameter("IsAppeared", stdExam.IsAppeared);
                SqlParameter objSqlParameter10 = new SqlParameter("LoggedInUser", stdExam.LoggedInUser);
                SqlParameter objSqlParameter11 = new SqlParameter("Action", action);

                List <SqlParameter> lstSqlParams = DBCommon.GetSqlParameterList(new SqlParameter[] { objSqlParameter, objSqlParameter1, objSqlParameter2, objSqlParameter3, objSqlParameter4, objSqlParameter5, objSqlParameter6, objSqlParameter7, objSqlParameter8, objSqlParameter9, objSqlParameter10, objSqlParameter11 });
                dtResult = DBCommon.ExecuteDataAdapterDataTable("CRUDExams", lstSqlParams);
            }
            catch (Exception ex)
            {
            }
            return(dtResult);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Ppkfkstudent,Ppkfkexam,Grade")] StudentsExams studentsExams)
        {
            if (id != studentsExams.Ppkfkstudent)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(studentsExams);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentsExamsExists(studentsExams.Ppkfkstudent))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Ppkfkexam"]    = new SelectList(_context.Exams, "Pkexam", "Subject", studentsExams.Ppkfkexam);
            ViewData["Ppkfkstudent"] = new SelectList(_context.Students, "Pkstudent", "Name", studentsExams.Ppkfkstudent);
            return(View(studentsExams));
        }
Ejemplo n.º 3
0
        public ActionResult AddStudentExam(long?id)
        {
            StudentsExams exam = new StudentsExams();

            exam.ListCourse   = new SelectList(GetDropdownList(objCourseBL.CRUDCourses(new CourseMaster(), "L"), "CourseName", "CourseId", "Select Course"), "Value", "Text");
            exam.ExamTimeList = new SelectList(GetDropdownList(objExamBL.CRUDExamTimes(new ExamTimes(), "L"), "ExamTime", "ExamTimesId", "Select Exam Time"), "Value", "Text");
            return(View(exam));
        }
Ejemplo n.º 4
0
        public ActionResult StudentDashboard()
        {
            StudentsExams objExam = new StudentsExams();

            objExam.StudentId = long.Parse("0" + Request.Cookies["UserId"].Value);
            List <StudentsExams> examList = examBL.CRUDAddExams(objExam, "L");

            return(View(examList));
        }
Ejemplo n.º 5
0
        public ActionResult ViewStudentExams(long id)
        {
            StudentsExams objExam = new StudentsExams();

            objExam.StudentId = id;
            List <StudentsExams> examList = objExamBL.CRUDAddExams(objExam, "L");

            return(View(examList));
        }
        public async Task <IActionResult> Create([Bind("Ppkfkstudent,Ppkfkexam,Grade")] StudentsExams studentsExams)
        {
            if (ModelState.IsValid)
            {
                _context.Add(studentsExams);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Ppkfkexam"]    = new SelectList(_context.Exams, "Pkexam", "Subject", studentsExams.Ppkfkexam);
            ViewData["Ppkfkstudent"] = new SelectList(_context.Students, "Pkstudent", "Name", studentsExams.Ppkfkstudent);
            return(View(studentsExams));
        }
Ejemplo n.º 7
0
        public List <StudentsExams> CRUDAddExams(StudentsExams exams, string action)
        {
            List <StudentsExams> examList = new List <StudentsExams>();

            try
            {
                DataTable dtResponse = examDA.CRUDAddExams(exams, action);
                if (dtResponse != null && dtResponse.Rows.Count > 0)
                {
                    examList = dtResponse.ConvertToListOf <StudentsExams>();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(examList);
        }
Ejemplo n.º 8
0
 public ActionResult AddStudentExam(StudentsExams objExam)
 {
     try
     {
         objExam.LoggedInUser = long.Parse("0" + Request.Cookies["UserId"].Value);
         StudentsExams objUserDetails = objExamBL.CRUDAddExams(objExam, (objExam.StudentExamId > 0 ? "U" : "I")).FirstOrDefault();
         if (objUserDetails.CRUDStatus == "success" || objUserDetails.StudentExamId > 0)
         {
             TempData["SuccessMessage"] = "You have " + (objExam.StudentExamId > 0 ? "updated" : "added") + " one Student Exam successfully";
             return(RedirectToAction("Students", "Student"));
         }
         else
         {
             TempData["ErrorMessage"] = objUserDetails.CRUDStatus;
             return(RedirectToAction("Students", "Student"));
         }
     }
     catch (Exception ex)
     {
         TempData["ErrorMessage"] = ex.Message;
         return(RedirectToAction("Students", "Student"));
     }
 }