public List <Attendence> GetAttendenceOne(int id, string month) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; List <Attendence> list = new List <Attendence>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("SELECT * FROM attendance where studentrollno_id=" + id + " and month='" + month + "' and academic_id=" + academic_id, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { list.Add(new Attendence() { Id = Convert.ToInt32(reader["id"]), Month = reader["month"].ToString(), Total = Convert.ToInt32(reader["total"]), Current = Convert.ToInt32(reader["current"]), }); } } } return(list); }
public List <Exam> ExamOne(int id) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; List <Exam> list = new List <Exam>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("select * from exam,subject where exam.subject_id=subject.id and exam.id=" + id, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { list.Add(new Exam() { Id = Convert.ToInt32(reader["id"]), Subject = reader["subject_name"].ToString(), Date = reader["date"].ToString(), Start_time = reader["start"].ToString(), End_time = reader["end"].ToString(), }); } } } return(list); }
public JsonResult ResultMarkFinal(int id, int major, int class_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; 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); using (var reader = cmd1.ExecuteReader()) { while (reader.Read()) { list.Add(new Mark() { Id = Convert.ToInt32(reader["id"]), Rollno = reader["rollno"].ToString(), Name = reader["student_name"].ToString(), S_mark = Convert.ToInt32(reader["mark"]), Year = reader["year_name"].ToString(), Major = reader["major_name"].ToString(), Grade = context.Grade(Convert.ToInt32(reader["mark"])), Rollno_id = Convert.ToInt32(reader["studentrollno_id"]), Subject = reader["subject_name"].ToString(), Pass = Convert.ToInt32(reader["pass"]), Class = reader["class_name"].ToString(), }); } } conn1.Close(); } return(Json(list)); }
public IActionResult PostNewStudent(Student student) { int student_id = 0; string img_name = null; if (student.Photo != null) { string uploadFolder = Path.Combine(hostingEnvironment.WebRootPath, "student_img"); img_name = Guid.NewGuid().ToString() + "_" + student.Photo.FileName; string filePath = Path.Combine(uploadFolder, img_name); student.Photo.CopyTo(new FileStream(filePath, FileMode.Create)); } SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Insert Into student (student_name,reg_no,reg_date,father_name,father_job,mother_name,mother_job,father_religion,mother_religion,religion,father_nrc,mother_nrc,nrc,gender,city,father_city,mother_city,nationality,father_nationality,mother_nationality,dob,academicyear_id,img) Values ('{student.Name}','{student.Reg_no}','{student.Reg_date}','{student.Father_name}','{student.Father_job}','{student.Mother_name}','{student.Mother_job}','{student.Father_religion}','{student.Mother_religion}','{student.Religion}','{student.Father_nrc}','{student.Mother_nrc}','{student.Nrc}','{student.Sex}','{student.City}','{student.Father_city}','{student.Mother_city}','{student.Nationality}','{student.Father_nationality}','{student.Mother_nationality}','{student.DOB}','{student.Academic_id}','{img_name}')"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); student_id = context.GetLastStudentId(); } string sql1 = $"Insert Into old_student (student_year_id,address,phone,father_phone,mother_phone,email,academic_id,major_id,student_id,mark) Values ('1','{student.Address}','{student.Phone}','{student.Father_phone}','{student.Mother_phone}','{student.Email}','{student.Academic_id}',1,'{student_id}','{student.Mark}')"; using (MySqlCommand command1 = new MySqlCommand(sql1, conn)) { command1.ExecuteNonQuery(); } } return(Redirect("/Student/AddNewStudent")); }
public List <Exam> GetExamDetail(int title, int id, int major) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; List <Exam> list = new List <Exam>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("select * from exam,examtitle,subject,year where exam.examtitle_id=examtitle.id and exam.subject_id=subject.id and exam.year_id=year.id and exam.year_id=" + id + " and exam.academic_id=" + academic_id + " and exam.examtitle_id=" + title, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { ViewBag.year = reader["year_name"].ToString(); list.Add(new Exam() { Id = Convert.ToInt32(reader["id"]), Examtile = reader["examtitle_name"].ToString(), Subject = reader["subject_name"].ToString(), Date = reader["date"].ToString(), Start_time = reader["start"].ToString(), End_time = reader["end"].ToString(), Year = reader["year_name"].ToString(), }); } } } return(list); }
public JsonResult ResultMarkFinalSubject(int id, int subject) { 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; using (MySqlConnection conn1 = context.GetConnection()) { conn1.Open(); MySqlCommand cmd1 = new MySqlCommand("select * from mark_final where studentrollno_id=" + id + " and subject_id=" + subject, conn1); using (var reader = cmd1.ExecuteReader()) { while (reader.Read()) { list.Add(new Mark() { Id = Convert.ToInt32(reader["id"]), S_mark = Convert.ToInt32(reader["mark"]), }); } } conn1.Close(); } return(Json(list)); }
public IActionResult Index() { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; List <Subject> list = new List <Subject>(); ViewBag.major = GetMajor(); ViewBag.year = GetYear(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("SELECT * FROM subject,year,subject_major,major where subject.year_id=year.id and subject_major.subject_id=subject.id and major.id=subject_major.major_id", conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { int id = Convert.ToInt32(reader["id"]); String name = reader["subject_name"].ToString(); list.Add(new Subject() { Id = id, Name = name, Year = reader["year_name"].ToString(), Major = reader["major_name"].ToString(), Major_id = Convert.ToInt32(reader["major_id"]), Year_id = Convert.ToInt32(reader["year_id"]), }); } } } return(View(list)); }
public IActionResult GenerateRollno() { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic = context.GetAcademic().Id; List <Student> list = new List <Student>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("select * from student,old_student,year where old_student.student_id=student.id and old_student.student_year_id=year.id and old_student.academic_id=" + academic, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { int Id = Convert.ToInt32(reader["id"]); String name = reader["student_name"].ToString(); list.Add(new Student() { Id = Id, Name = name, Year = reader["year_name"].ToString(), Sex = reader["gender"].ToString(), Father_name = reader["father_name"].ToString(), Mother_name = reader["mother_name"].ToString(), Phone = reader["phone"].ToString(), Address = reader["address"].ToString(), Mark = Convert.ToInt32(reader["mark"]) }); } } } return(View(list)); }
public Student GetOneStudent(int id) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; Student student = new Student(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("select * from student,old_student,studentrollno,attendance where attendance.studentrollno_id=studentrollno.id and old_student.student_id=student.id and studentrollno.student_id=student.id and studentrollno.id=" + id, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { ; int Id = Convert.ToInt32(reader["id"]); String name = reader["student_name"].ToString(); student.Id = Id; student.Name = name; student.Img = reader["img"].ToString(); student.Rollno = reader["rollno"].ToString(); student.Phone = reader["phone"].ToString(); student.Address = reader["address"].ToString(); student.Email = reader["email"].ToString(); student.Total = Convert.ToInt32(reader["total"]); student.Current = Convert.ToInt32(reader["current"]); } } } return(student); }
public List <Year> GetYear() { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; List <Year> list = new List <Year>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("SELECT * FROM year ", conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { int id = Convert.ToInt32(reader["id"]); String name = reader["year_name"].ToString(); list.Add(new Year() { Id = id, Name = name, }); } } } return(list); }
public IActionResult Index() { ViewBag.year = GetYear(); SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; List <Class> list = new List <Class>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("SELECT * FROM class,year where class.year_id=year.id ", conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { int id = Convert.ToInt32(reader["id"]); String name = reader["class_name"].ToString(); list.Add(new Class() { Id = id, Name = name, Year = reader["year_name"].ToString(), Year_id = Convert.ToInt32(reader["year_id"]), }); } } } return(View(list)); }
public JsonResult GetAssignment(int id, int major, int classes, int subject) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; List <Assignment> list = new List <Assignment>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("select * from assignment,studentrollno,student,subject,student_detail,year,major,class where assignment.studentrollno_id=studentrollno.id and studentrollno.student_id=student.id and assignment.subject_id=subject.id and student_detail.studentrollno_id=studentrollno.id and student_detail.year_id=year.id and student_detail.major_id=major.id and student_detail.class_id=class.id and student_detail.year_id=" + id + " and student_detail.major_id=" + major + " and assignment.academic_id=" + academic_id + " and student_detail.class_id=" + classes + " and assignment.subject_id=" + subject, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { list.Add(new Assignment() { Id = Convert.ToInt32(reader["id"]), Name = reader["student_name"].ToString(), Rollno = reader["rollno"].ToString(), Subject = reader["subject_name"].ToString(), Mark = Convert.ToInt32(reader["mark"]), Year = reader["year_name"].ToString(), Major = reader["major_name"].ToString(), Class = reader["class_name"].ToString(), }); } } } return(Json(list)); }
public string EditAssignment(Assignment assignment) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Update assignment set mark='{assignment.Mark}' where id={assignment.Id}"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); // conn.Close(); } int total_mark = context.GetTotalMark(assignment.Rollno_id, context.GetAcademic().Id); int pass = context.GetEditPass(assignment.Rollno_id, academic_id); string sql1 = $"Update result set total_mark='{total_mark}',pass={pass} where studentrollno_id={assignment.Rollno_id}"; using (MySqlCommand command = new MySqlCommand(sql1, conn)) { command.ExecuteNonQuery(); conn.Close(); } } return("This assignment is edit!"); }
public JsonResult GetAttendenceMonth(int id, int major, int class_id, string month) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; List <Attendence> list = new List <Attendence>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("SELECT attendance.id,attendance.studentrollno_id,rollno,student_name,major_name,year_name,class_name,month,total,current FROM student,studentrollno,student_detail,major,class,year,attendance where student.id=studentrollno.student_id and studentrollno.id=student_detail.studentrollno_id and student_detail.year_id=year.id and student_detail.major_id=major.id and student_detail.class_id=class.id and studentrollno.id=attendance.studentrollno_id and student_detail.year_id=" + id + " and student_detail.major_id=" + major + " and student_detail.class_id=" + class_id + " and month='" + month + "'", conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { ViewBag.year = reader["year_name"].ToString(); ViewBag.major = reader["major_name"].ToString(); list.Add(new Attendence() { Id = Convert.ToInt32(reader["id"]), Name = reader["student_name"].ToString(), Rollno = reader["rollno"].ToString(), Month = reader["month"].ToString(), Current = Convert.ToInt32(reader["current"]), Total = Convert.ToInt32(reader["total"]), Major = reader["major_name"].ToString(), Year = reader["year_name"].ToString(), Class = reader["class_name"].ToString(), Rollno_id = Convert.ToInt32(reader["studentrollno_id"]), }); } } } return(Json(list)); }
public List <Subject> GetSubject(int id, int major) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; List <Subject> list = new List <Subject>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("select * from subject,subject_major where subject_major.subject_id=subject.id and subject_major.major_id=" + major + " and year_id=" + id, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { list.Add(new Subject() { Id = Convert.ToInt32(reader["id"]), Name = reader["subject_name"].ToString(), }); } } } return(list); }
public IActionResult Index() { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; List <Examtitle> list = new List <Examtitle>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("SELECT * FROM examtitle", conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { int id = Convert.ToInt32(reader["id"]); String name = reader["examtitle_name"].ToString(); list.Add(new Examtitle() { Id = id, Name = name }); } } } return(View(list)); }
public List <Class> GetClass(int id, int major) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; List <Class> list = new List <Class>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("SELECT * FROM class where year_id=" + id + " and major_id=" + major, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { list.Add(new Class() { Id = Convert.ToInt32(reader["id"]), Name = reader["class_name"].ToString(), }); } } } return(list); }
public IActionResult PostAddSubject(Subject subject) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Insert Into subject (subject_name,year_id) Values ('{subject.Name}','{subject.Year_id}')"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); } int sub_id = 0; MySqlCommand cmd = new MySqlCommand("SELECT * FROM subject ORDER BY id DESC LIMIT 1", conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { sub_id = Convert.ToInt32(reader["id"]); } } string sql1 = $"Insert Into subject_major (subject_id,major_id) Values ('{sub_id}','{subject.Major_id}')"; using (MySqlCommand command = new MySqlCommand(sql1, conn)) { command.ExecuteNonQuery(); conn.Close(); } } HttpContext.Session.SetString("info", "add successfully"); ViewBag.data = "haaha"; return(Redirect("/subject/addSubject")); }
public string EditFinal(Mark mark) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Update mark_final set mark='{mark.S_mark}' where studentrollno_id={mark.Id} and subject_id={mark.Subject_id}"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); // conn.Close(); } int tmk = context.GetFinal_Mark(mark.Id, academic_id); int total_mk = context.GetTotalMark(mark.Id, academic_id); int pass = context.GetEditPass(mark.Id, academic_id); string sql1 = $"Update result set final_mark='{tmk}',total_mark={total_mk},pass={pass} where studentrollno_id={mark.Id} and academic_id={academic_id}"; using (MySqlCommand command = new MySqlCommand(sql1, conn)) { command.ExecuteNonQuery(); conn.Close(); } } return("OK"); }
public List <Rollno> GetRollNo(int id) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; List <Rollno> list = new List <Rollno>(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("SELECT * FROM student,studentrollno,student_detail where student.id=studentrollno.student_id and studentrollno.id=student_detail.studentrollno_id and student_detail.year_id=" + id + " and studentrollno.academic_id=" + academic_id, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { list.Add(new Rollno() { Id = Convert.ToInt32(reader["id"]), Roll = reader["rollno"].ToString(), Name = reader["student_name"].ToString(), }); } } } return(list); }
public string PostAddAttendence(Attendence attendence) { int student_id = 0; string ck = null; SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; using (MySqlConnection conn1 = context.GetConnection()) { conn1.Open(); MySqlCommand cmd1 = new MySqlCommand("SELECT * FROM studentrollno where rollno='" + attendence.Rollno + "' and academic_id=" + academic_id, conn1); using (var reader = cmd1.ExecuteReader()) { while (reader.Read()) { student_id = Convert.ToInt32(reader["id"]); } } conn1.Close(); } if (context.CheckAttendence(student_id, attendence.Month, academic_id) == 0) { using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Insert Into attendance (studentrollno_id,month,total,current,academic_id) Values ('{student_id}','{attendence.Month}','{attendence.Total}','{attendence.Current}','{academic_id}')"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); conn.Close(); } } ck = "OK"; } else { ck = "NO"; } return(ck); //return Redirect("/attendence/addAttendence"); }
public IActionResult EditStudent(int id) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; Student student = new Student(); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); MySqlCommand cmd = new MySqlCommand("select * from student,old_student,studentrollno where old_student.student_id=student.id and studentrollno.student_id=student.id and studentrollno.id=" + id, conn); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { int Id = Convert.ToInt32(reader["id"]); String name = reader["student_name"].ToString(); student.Id = Id; student.Name = name; student.Sex = reader["gender"].ToString(); student.Reg_date = reader["reg_date"].ToString(); student.Reg_no = reader["reg_no"].ToString(); student.Father_name = reader["father_name"].ToString(); student.Father_job = reader["father_job"].ToString(); student.Father_city = reader["father_city"].ToString(); student.Father_nationality = reader["father_nationality"].ToString(); student.Father_nrc = reader["father_nrc"].ToString(); student.Father_phone = reader["father_phone"].ToString(); student.Father_religion = reader["father_religion"].ToString(); student.Mother_city = reader["mother_city"].ToString(); student.Mother_job = reader["mother_job"].ToString(); student.Mother_name = reader["mother_name"].ToString(); student.Mother_nationality = reader["mother_nationality"].ToString(); student.Mother_nrc = reader["mother_nrc"].ToString(); student.Mother_phone = reader["mother_phone"].ToString(); student.Mother_religion = reader["mother_religion"].ToString(); student.Religion = reader["religion"].ToString(); student.Phone = reader["phone"].ToString(); student.Address = reader["address"].ToString(); student.City = reader["city"].ToString(); student.DOB = reader["dob"].ToString(); student.Email = reader["email"].ToString(); student.Nationality = reader["nationality"].ToString(); student.Nrc = reader["nrc"].ToString(); student.Mark = Convert.ToInt32(reader["mark"]); student.Img = reader["img"].ToString(); } } } ViewBag.student = student; return(View()); }
public void PostAddAssignment(Assignment assignment) { int c = 0; string sql = null; int? mark = 0; SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; int student_id = context.GetStudentId(assignment.Rollno, academic_id); using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string check = $"Select count(*),mark from assignment where studentrollno_id={student_id} and subject_id={assignment.Subject_id}"; using (MySqlCommand command = new MySqlCommand(check, conn)) { c = Convert.ToInt32(command.ExecuteScalar()); } if (c == 0) { sql = $"Insert Into assignment (studentrollno_id,subject_id,mark,academic_id) Values ('{student_id}','{assignment.Subject_id}','{assignment.Mark}','{academic_id}')"; } else { string aa = $"Select mark from assignment where studentrollno_id={student_id} and subject_id={assignment.Subject_id}"; using (MySqlCommand command = new MySqlCommand(aa, conn)) { var reader = command.ExecuteReader(); while (reader.Read()) { mark = Convert.ToInt32(reader["mark"]); } } sql = $"Update assignment set mark={mark + assignment.Mark} where studentrollno_id={student_id} and subject_id={assignment.Subject_id}"; } using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); //conn.Close(); } int total_mark = context.GetTotalMark(assignment.Rollno_id, context.GetAcademic().Id); string sql1 = $"Update result set total_mark='{total_mark}' where studentrollno_id={assignment.Rollno_id}"; using (MySqlCommand command = new MySqlCommand(sql1, conn)) { command.ExecuteNonQuery(); conn.Close(); } } }
public IActionResult EditClass(Class classes) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Update class set class_name='{classes.Name}',year_id='{classes.Year_id}' where id={classes.Id}"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); conn.Close(); } } return(Redirect("/class/index")); }
public IActionResult AddClass(Class classes) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Insert Into class (class_name,year_id) Values ('{classes.Name}','{classes.Year_id}')"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); conn.Close(); } } return(Redirect("/Class/Index")); }
public string Signup(Account account) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Insert Into user (user_name,email,password) Values ('{account.User_Name}','{account.Email}','{account.Password}')"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); conn.Close(); } } return("OK"); }
public IActionResult AddYear(Year year) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Insert Into year (year_name) Values ('{year.Name}')"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); conn.Close(); } } return(Redirect("/Year/index")); }
public IActionResult EditExamTitle(Examtitle et) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Update examtitle set examtitle_name='{et.Name}' where id={et.Id}"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); conn.Close(); } } return(Redirect("/examtitle/index")); }
public IActionResult EditAcademicYear(AcademicYear acy) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Update academicyear set academic_name='{acy.Name}' where id={acy.Id}"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); conn.Close(); } } return(Redirect("/academicYear/index")); }
public IActionResult StopStudent(Student student) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic = context.GetAcademic().Id; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"UPDATE student SET status='stop' where id={student.Id}"; using (MySqlCommand command1 = new MySqlCommand(sql, conn)) { command1.ExecuteNonQuery(); } } return(Redirect("/Student/Index/1?major=1&class_id=1")); }