Example #1
0
        public JsonResult ResultFinalResultOne(int id)
        {
            List <Mark>   list        = new List <Mark>();
            SystemContext context     = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext;
            int           academic_id = context.GetAcademic().Id;
            int           mark_mid    = 0;
            int           mark        = 0;
            int           final_mark  = 0;
            int           ass_mark    = 0;

            using (MySqlConnection conn1 = context.GetConnection())
            {
                conn1.Open();
                //MySqlCommand cmd1 = new MySqlCommand("select * from mark_final,result,subject,studentrollno,student_detail,student,year,major,class where student_detail.class_id=class.id and mark_final.subject_id=subject.id and studentrollno.id=result.studentrollno_id and mark_final.studentrollno_id=studentrollno.id and student_detail.studentrollno_id=studentrollno.id and studentrollno.student_id=student.id and student_detail.year_id=year.id and student_detail.major_id=major.id and student_detail.major_id=" + major + " and student_detail.year_id=" + id + " and mark_final.academic_id=" + academic_id + " and student_detail.class_id=" + class_id+ " order by mark_final.studentrollno_id,mark_final.subject_id asc", conn1);
                MySqlCommand cmd1 = new MySqlCommand("select * from mark_final,subject where mark_final.subject_id=subject.id and studentrollno_id=" + id + " and academic_id=" + academic_id + " order By subject_id asc", conn1);
                using (var reader = cmd1.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        mark_mid   = context.GetMidMarkOne(Convert.ToInt32(reader["studentrollno_id"]), Convert.ToInt32(reader["subject_id"]), academic_id);
                        final_mark = Convert.ToInt32(reader["mark"]);
                        ass_mark   = context.GetAss_MarkOne(Convert.ToInt32(reader["studentrollno_id"]), Convert.ToInt32(reader["subject_id"]), academic_id);
                        mark       = (mark_mid + final_mark) * 80 / 200;
                        mark       = mark + ass_mark;
                        list.Add(new Mark()
                        {
                            Id         = Convert.ToInt32(reader["id"]),
                            Subject    = reader["subject_name"].ToString(),
                            Subject_id = Convert.ToInt32(reader["subject_id"]),
                            S_mark     = mark,
                            Rollno_id  = Convert.ToInt32(reader["studentrollno_id"]),
                        });
                    }
                }
                conn1.Close();
            }
            return(Json(list));
        }