public IHttpActionResult GetAllMarks() { var obj = StudentMarks.getMarks(); return(Ok(obj)); }
public void AddStudentMark(StudentMarkViewModel model) { int? m = model.mark; string res = ""; if (m >= 50) { res = model.result = "Pass"; } else if (m < 50) { res = model.result = "Fail"; } else if (m == 0) { res = ""; } var tb = new StudentMarks { Student_Number = model.Student_Number, Student_Name = model.Student_Name, Subject_Code = model.Subject_Code, GroupeName = model.GroupeName, ClassGroupe_id = model.ClassGroupe_id, mark = model.mark, result = res }; uow.Repository <StudentMarks>().Insert(tb); uow.Save(); }
public async Task <IActionResult> PutStudentMarks(int id, StudentMarks studentMarks) { if (id != studentMarks.Id) { return(BadRequest()); } _context.Entry(studentMarks).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentMarksExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <StudentMarks> > PostStudentMarks(StudentMarks studentMarks) { _context.StudentMarks.Add(studentMarks); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStudentMarks", new { id = studentMarks.Id }, studentMarks)); }
public void TestCalculateGradeProfile() { //Arrange StudentMarks studentMarks = new StudentMarks(); //Act studentMarks.addStudent(20); studentMarks.addStudent(79); studentMarks.addStudent(70); studentMarks.addStudent(54); studentMarks.addStudent(33); studentMarks.addStudent(67); studentMarks.addStudent(99); studentMarks.addStudent(58); studentMarks.addStudent(64); studentMarks.addStudent(46); studentMarks.addStudent(21); studentMarks.addStudent(69); studentMarks.addStudent(31); studentMarks.addStudent(78); studentMarks.addStudent(89); studentMarks.calculateGradeProfile(); //Assert int expectedPercentageFailed = 26; int expectedPercentageThirdClass = 6; int expectedPercentageLowerSecondClass = 13; int expectedPercentageUpperSecondClass = 20; int expectedPercentageFirstClass = 33; Assert.AreEqual(expectedPercentageFailed, studentMarks.PercentageFailed); Assert.AreEqual(expectedPercentageThirdClass, studentMarks.PercentageThirdClass); Assert.AreEqual(expectedPercentageLowerSecondClass, studentMarks.PercentageLowerSecondClass); Assert.AreEqual(expectedPercentageUpperSecondClass, studentMarks.PercentageUpperSecondClass); Assert.AreEqual(expectedPercentageFirstClass, studentMarks.PercentageFirstClass); }
public async Task <IActionResult> Analyse() { var students = await _context.Students.ToListAsync(); StudentMarks stats = new StudentMarks(); stats.Data = new string[students.Count]; int index = 0; foreach (Student student in students) { stats.Data[index] = student.Name + "," + student.Marks; index++; } double[] gradePercentages = stats.StatFinder("multi"); double total = gradePercentages[0]; double a = gradePercentages[1] / total * 100; double b = gradePercentages[2] / total * 100; double c = gradePercentages[3] / total * 100; double d = gradePercentages[4] / total * 100; double f = gradePercentages[5] / total * 100; stats.GradeA = string.Format("{0:0.00}", a); stats.GradeB = string.Format("{0:0.00}", b); stats.GradeC = string.Format("{0:0.00}", c); stats.GradeD = string.Format("{0:0.00}", d); stats.GradeF = string.Format("{0:0.00}", f); stats.StatFinder("min"); stats.StatFinder("max"); stats.StatFinder("mean"); return(View(stats)); }
public ActionResult ShowMark() { var studentmarkdetail = entityobj.Student_Mark.Where(x => x.Is_Delete != true).Select(x => x).ToList(); // var studentmarkdetail = entityobj.Student_Mark.Select(s => s).ToList(); //var stkdObj = entityobj.Student_Mark.Select(e => new { e.Std_Id,e.Name}).ToList(); var getname = entityobj.Student_Detail.Select(x => new { x.Name, x.Std_Id }).ToList(); var marklist = new List <StudentMarks>(); if (studentmarkdetail != null) { foreach (var item in studentmarkdetail) { StudentMarks markobj = new StudentMarks(); markobj.Std_Id = item.Std_Id; markobj.Mark_Id = item.Mark_Id; markobj.Name = getname.Where(e => e.Std_Id == item.Std_Id).Select(e => e.Name).SingleOrDefault(); // markobj.Name = getname.Where(s => s.Std_Id == item.Std_Id).Select(x => x.Name).SingleOrDefault(); // markobj.Name = entityobj.Student_Detail.Where(x=>x.Std_Id==item.Std_Id).Select(e => e.Name).SingleOrDefault(); markobj.Mark1 = (decimal)item.Mark1; markobj.Mark2 = (decimal)item.Mark2; ViewBag.Total = item.Mark1 + item.Mark2; marklist.Add(markobj); } } return(View(marklist)); }
public List <StudentMarks> GetAllMarks(string courseId, string batch) { List <StudentMarks> aList = new List <StudentMarks>(); int courseid2 = Convert.ToInt32(courseId); SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT EnrollCourse.StudentId,EnrollCourse.courseid,EnrollCourse.Batch,InputCTAttendence.CT1,InputCTAttendence.CT2,InputCTAttendence.CT3,InputCTAttendence.CT4,InputCTAttendence.Attendence FROM EnrollCourse INNER JOIN InputCTAttendence ON InputCTAttendence.StudentId=EnrollCourse.StudentId AND InputCTAttendence.courseid=EnrollCourse.courseid AND InputCTAttendence.courseid='" + courseId + "' AND EnrollCourse.Batch='" + batch + "'"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { StudentMarks aMarks = new StudentMarks(); aMarks.StudentId = reader["StudentId"].ToString(); aMarks.CT1 = reader["CT1"].ToString(); aMarks.CT2 = reader["CT2"].ToString(); aMarks.CT3 = reader["CT3"].ToString(); aMarks.CT4 = reader["CT4"].ToString(); aMarks.Attendance = reader["Attendence"].ToString(); aList.Add(aMarks); } reader.Close(); connection.Close(); return(aList); }
public static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("BNU CO453 Applications Programming 2020-2021!"); Console.WriteLine(); Console.Beep(); string [] choices = { " Distance Converter", " BMI Calculator", " Student Grades", " Social Network", " RPG Game" }; int choice = ConsoleHelper.SelectChoice(choices); if (choice == 1) { DistanceConverter converter = new DistanceConverter(); converter.Run(); } else if (choice == 2) { BMI calculator = new App02.BMI(); calculator.Run(); } else if (choice == 3) { StudentMarks grader = new StudentMarks(); grader.Run(); } else if (choice == 4) { SocialNetworkMain social = new SocialNetworkMain(); social.Run(); } }
public static void Main() { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("BNU CO453 Applications Programming 2020-2021!"); Console.WriteLine(); Console.Beep(); Console.WriteLine("1. Distance converter"); Console.WriteLine("2. BMI Calculator"); Console.WriteLine("3. Student Grades"); Console.WriteLine("4. Student Grades"); Console.WriteLine("5. Student Grades"); Console.WriteLine(0); Console.WriteLine("Select an applocation "); string choice = Console.ReadLine(); if (choice == "1") { DistanceConverter converter = new DistanceConverter(); converter.MilesToFeet(); converter.MetresToMiles(); converter.KilometresToMiles(); converter.MilesToFeet2(); converter.MetresToMiles2(); converter.KilometresToMiles2(); converter.MetresTofeet(); converter.FeetToMetres(); } else if (choice == "2") { } else if (choice == "3") { StudentMarks students = new StudentMarks(); students.Run(); } else if (choice == "4") { Socialnet social = new Socialnet(); social.Run(); } else if (choice == "5") { StudentMarks students = new StudentMarks(); students.Run(); } // BMI calculator = new BMI(); // BMI(); // Console.ReadLine(); }
// // GET: /GetStudentMarkssrb/ public ActionResult IndividulaResult(string StudentId, string courseID) { MarksManagersrb aManagersrb = new MarksManagersrb(); CourseManagersrb aCourseManagersrb = new CourseManagersrb(); ViewBag.courses = aCourseManagersrb.Getallcourse(); StudentMarks aMarks = aManagersrb.AMarks(courseID, StudentId); ViewBag.marks = aMarks; return(View()); }
public ActionResult Addmark(StudentMarks modelobj2) { Student_Mark tableobj = new Student_Mark(); tableobj.Mark1 = modelobj2.Mark1; tableobj.Mark2 = modelobj2.Mark2; tableobj.Std_Id = modelobj2.Std_Id; entityobj.Student_Mark.Add(tableobj); entityobj.SaveChanges(); return(RedirectToAction("ShowMark")); }
public IHttpActionResult PutMarks(Marks param) { Marks obj = new Marks(); obj = param; if (obj.studentId <= 0) { return(BadRequest()); } var temp = StudentMarks.PutMarks(obj); return(Ok(temp)); }
public IHttpActionResult GetMarksByStudentId(Marks param) { Marks obj = new Marks(); obj.studentId = param.studentId; if (obj.studentId <= 0) { return(BadRequest()); } var temp = StudentMarks.getMarksByStudentId(obj); return(Ok(temp)); }
public void TestGetClassification() { //Arrange StudentMarks studentMarks = new StudentMarks(); //Act + Assert Assert.AreEqual(Classification.FAILED, studentMarks.getClassification(39)); Assert.AreEqual(Classification.THIRD_CLASS, studentMarks.getClassification(40)); Assert.AreEqual(Classification.THIRD_CLASS, studentMarks.getClassification(49)); Assert.AreEqual(Classification.LOWER_SECOND_CLASS, studentMarks.getClassification(50)); Assert.AreEqual(Classification.LOWER_SECOND_CLASS, studentMarks.getClassification(59)); Assert.AreEqual(Classification.UPPER_SECOND_CLASS, studentMarks.getClassification(60)); Assert.AreEqual(Classification.UPPER_SECOND_CLASS, studentMarks.getClassification(69)); Assert.AreEqual(Classification.FIRST_CLASS, studentMarks.getClassification(70)); }
///<summary> /// Method shows the selection of applications and allows people to choose what application to use. ///</summary> public static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("BNU CO453 Application Programming 2020-2021"); Console.WriteLine(); Console.Beep(); DistanceConverter converter = new DistanceConverter(); BMICalculator calculator = new BMICalculator(); StudentMarks studentMarks = new StudentMarks(); NetworkApp networkApp = new NetworkApp(); while (true) { Console.WriteLine("Select a program:"); Console.WriteLine("1. Distance Converter"); Console.WriteLine("2. BMI Calculator"); Console.WriteLine("3. Student Grades"); Console.WriteLine("4. Network"); Console.WriteLine("5. Mono Game"); Console.WriteLine("0. Quit"); string value = Console.ReadLine(); int choice = Convert.ToInt32(value); if (choice == 1) { converter.run(); } else if (choice == 2) { calculator.run(); } else if (choice == 3) { studentMarks.run(); } else if (choice == 4) { networkApp.run(); } else { break; } } }
public void Test_Grade_D_40_Marks() { StudentMarks studentMarks = new StudentMarks(); { string passCheck = "fail"; int marks = 40; string result = studentMarks.GradeFinder(marks); string expectedResult = "D"; if (result == expectedResult) { passCheck = "pass"; } SaveData(GetCurrentMethod(), "Total: 100, Marks:" + marks, expectedResult, result, passCheck); Assert.IsTrue(result == expectedResult); } }
public void Test_Grade_A_Random() { StudentMarks studentMarks = new StudentMarks(); { string result = "fail"; string expectedResult = ""; Random rand = new Random(); for (int i = 1; i < 6; i++) { string passCheck = "fail"; int marks = rand.Next(70, 100); result = studentMarks.GradeFinder(marks); expectedResult = "A"; if (result == expectedResult) { passCheck = "pass"; } SaveData(GetCurrentMethod() + " Loop Test: " + i, "Marks:" + marks, expectedResult, result, passCheck); } Assert.IsTrue(result == expectedResult); } }
public void TestCalculateStats() { //Arrange StudentMarks studentMarks = new StudentMarks(); //Act studentMarks.addStudent(20); studentMarks.addStudent(79); studentMarks.addStudent(70); studentMarks.addStudent(54); studentMarks.addStudent(33); studentMarks.addStudent(67); studentMarks.addStudent(99); studentMarks.addStudent(58); studentMarks.addStudent(64); studentMarks.addStudent(46); studentMarks.addStudent(21); studentMarks.addStudent(69); studentMarks.addStudent(31); studentMarks.addStudent(78); studentMarks.addStudent(89); studentMarks.calculateStats(); //Assert int expectedMean = 58; int expectedMin = 20; int expectedMax = 99; Assert.AreEqual(expectedMean, studentMarks.MeanMark); Assert.AreEqual(expectedMin, studentMarks.MinMark); Assert.AreEqual(expectedMax, studentMarks.MaxMark); }
public static void ChoseApplication(int AppNumber) { switch (AppNumber) { case APP01: ConsoleHelper.PrintString("Distance Converter", true); //Create an object DistanceConverter converter = new DistanceConverter(); converter.RunDistanceConverter(); break; case APP02: ConsoleHelper.PrintString("BMI Converter", true); ConsoleHelper.PrintString(bmi.GetDescription(), false); bmi.RunBmiConverter(); break; case APP03: ConsoleHelper.PrintString("Student Marks", true); StudentMarks students = new StudentMarks(); students.Run(); break; case APP04: SocialNetwork social = new SocialNetwork(); social.Run(); break; case APP05: default: break; } }
public StudentMarks GetNumber(string courseId, string StudentId) { StudentMarks aMarks = new StudentMarks(); int courseid2 = Convert.ToInt32(courseId); SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT* FROM InputCTAttendence WHERE StudentId='" + StudentId + "' AND courseid='" + courseid2 + "'"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { aMarks.CT1 = reader["CT1"].ToString(); aMarks.CT2 = reader["CT2"].ToString(); aMarks.CT3 = reader["CT3"].ToString(); aMarks.CT4 = reader["CT4"].ToString(); aMarks.Attendance = reader["Attendence"].ToString(); } reader.Close(); connection.Close(); return(aMarks); }
public ClassA() { Marks = new StudentMarks(); }
public StudentMarks AMarks(string courseID, string StudentId) { StudentMarks aMarks = aMarksGatewaysrb.GetNumber(courseID, StudentId); return(aMarks); }