internal List <Models.StudentResults> GetAllResultGradet(string Grade) { try { string Parameter = ""; if (Grade != "") { Parameter = " where Grade='" + Grade + "' "; } string query = @"SELECT [ID],[Grade] ,[Flag] FROM [Grades] " + Parameter; SqlCommand command = new SqlCommand(query, con); con.Open(); SqlDataReader reader = command.ExecuteReader(); StudentResults Aresult = null; var CrstList = new List <StudentResults>(); if (reader.HasRows) { while (reader.Read()) { Aresult = new StudentResults(); Aresult.ID = Convert.ToInt32(reader["ID"]); Aresult.Grade = reader["Grade"].ToString(); CrstList.Add(Aresult); } } con.Close(); return(CrstList); } catch (Exception ex) { throw new Exception(ex.Message); } }
internal string SaveStudentResult(StudentResults studentResults) { try { string Query = @"INSERT INTO [StudentResult] ([RegID] ,[CourseID] ,[GradeID] ,[Addby] ,[Addate]) VALUES ('" + studentResults.RegNo + "','" + studentResults.Course + "','" + studentResults.Grade + "','Sojol',GETDATE())"; int rowEffect = DataTransfection.ExecuteNonQuery(Query); if (rowEffect > 0) { return("Record is/are Saved Sucessfully....!!"); } else { throw new Exception("Record Save Failed....!!! "); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult StudentResult(StudentResults studentResults) { try { string Alart = _studentResultManager.SaveStudentResult(studentResults); ViewBag.Message = Alart; GetAllRessult(); return(View()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public IEnumerable <StudentResults> GetResults() { var tim = GetTim; var sally = GetSally; var bob = GetBob; var dev401i = new Subject(1, "DEV401I", "Advanced Development Software 4"); var ntw401i = new Subject(2, "NTW401I", "Networks 4"); var ops401i = new Subject(3, "OPS401I", "Operating Systems 4"); var rit4801 = new Subject(4, "RIT4801", "RESEARCH IN IT"); var timResults = new StudentResults(tim) { Results = new List <Result>() { new Result(1, dev401i, 60, 70, 67), new Result(2, ntw401i, 80, 90, 87), new Result(3, ops401i, 95, 98, 97), new Result(4, rit4801, 80, 80, 80) } }; var sallyResults = new StudentResults(sally) { Results = new List <Result>() { new Result(1, dev401i, 66, 90, 77), new Result(3, ops401i, 95, 95, 95), new Result(4, rit4801, 82, 82, 82) } }; var bobResults = new StudentResults(bob) { Results = new List <Result>() { new Result(1, dev401i, 50, 55, 52), new Result(4, rit4801, 82, 83, 84) } }; return(new List <StudentResults>() { timResults, sallyResults, bobResults }); }
public List <StudentResults> GetAll() { // Note - this is just for illustrative purposes. Normally we'd go to a database to fetch these results. // This is to demonstrate a RESTful API in dotnet and its results. List <StudentResults> studentResultsList = new List <StudentResults>(); StudentResults studentResultsClark = new StudentResults(); studentResultsClark.Date = DateTime.Now; studentResultsClark.FirstName = "Super"; studentResultsClark.LastName = "Man"; studentResultsClark.Id = 1243454; studentResultsClark.SummaryNotes = "Your student is a pleasure to have in class"; studentResultsClark.ClassResults = new List <ClassResults>(); studentResultsClark.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsClark.Id, "Flying", 4.0f)); studentResultsClark.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsClark.Id, "Laser beam vision", 3.1f)); studentResultsClark.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsClark.Id, "Kryptonite Resistance", 0.1f)); studentResultsList.Add(studentResultsClark); StudentResults studentResultsLois = new StudentResults(); studentResultsLois.Date = DateTime.Now; studentResultsLois.FirstName = "Lois"; studentResultsLois.LastName = "Lane"; studentResultsLois.Id = 9834543; studentResultsLois.SummaryNotes = "Lois is smart and resourceful."; studentResultsLois.ClassResults = new List <ClassResults>(); studentResultsLois.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsLois.Id, "Flying", 0.0f)); studentResultsLois.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsLois.Id, "Journalism", 4.0f)); studentResultsLois.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsLois.Id, "Establishing personal boundaries", 2.4f)); studentResultsList.Add(studentResultsLois); StudentResults studentResultsGreenLantern = new StudentResults(); studentResultsGreenLantern.Date = DateTime.Now; studentResultsGreenLantern.FirstName = "Green"; studentResultsGreenLantern.LastName = "Lantern"; studentResultsGreenLantern.Id = 0025214; studentResultsGreenLantern.SummaryNotes = "Green Lantern was a pleasure to have in class. He might be a little too cocky for his own good but in the end he does the right thing."; studentResultsGreenLantern.ClassResults = new List <ClassResults>(); studentResultsGreenLantern.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsGreenLantern.Id, "Flying", 3.2f)); studentResultsGreenLantern.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsGreenLantern.Id, "Alter-Ego", 3.9f)); studentResultsGreenLantern.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsGreenLantern.Id, "Green Power Ring", 4.0f)); studentResultsList.Add(studentResultsGreenLantern); StudentResults studentResultsWonderWoman = new StudentResults(); studentResultsWonderWoman.Date = DateTime.Now; studentResultsWonderWoman.FirstName = "Wonder"; studentResultsWonderWoman.LastName = "Woman"; studentResultsWonderWoman.Id = 0215487; studentResultsWonderWoman.SummaryNotes = "Wonder Woman brings true fighting spirit and the feeling of hope and unity to the classroom."; studentResultsWonderWoman.ClassResults = new List <ClassResults>(); studentResultsWonderWoman.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsWonderWoman.Id, "Flying", 3.6f)); studentResultsWonderWoman.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsWonderWoman.Id, "Bracers of Themiscyra", 4.0f)); studentResultsWonderWoman.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsWonderWoman.Id, "Lasso of Hestia", 4.0f)); studentResultsWonderWoman.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultsWonderWoman.Id, "Sword of the Amazons", 4.0f)); studentResultsList.Add(studentResultsWonderWoman); StudentResults studentResultBatman = new StudentResults(); studentResultBatman.Date = DateTime.Now; studentResultBatman.FirstName = "Bat"; studentResultBatman.LastName = "Man"; studentResultBatman.Id = 9854758; studentResultBatman.SummaryNotes = "Batman is the worlds best detective and a formidible opponent in combat. I would encourage Batman to let his guard down and allow himself to be vulnerable and build positive, lasting relationships."; studentResultBatman.ClassResults = new List <ClassResults>(); studentResultBatman.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultBatman.Id, "Batarang", 3.6f)); studentResultBatman.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultBatman.Id, "Detective Skills - Advanced", 4.0f)); studentResultBatman.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultBatman.Id, "Martial Arts", 3.7f)); studentResultBatman.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultBatman.Id, "Building Loving Relationships", 1.7f)); studentResultsList.Add(studentResultBatman); StudentResults studentResultTheFlash = new StudentResults(); studentResultTheFlash.Date = DateTime.Now; studentResultTheFlash.FirstName = "The"; studentResultTheFlash.LastName = "Flash"; studentResultTheFlash.Id = 9854758; studentResultTheFlash.SummaryNotes = "Gets his work done quicky! (who would have thought?). Could maybe take some time and slow down and appreciate life more."; studentResultTheFlash.ClassResults = new List <ClassResults>(); studentResultTheFlash.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultTheFlash.Id, "Super-speed", 3.9f)); studentResultTheFlash.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultTheFlash.Id, "Time shifting", 3.1f)); studentResultTheFlash.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultTheFlash.Id, "Phasing", 3.5f)); studentResultTheFlash.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultTheFlash.Id, "Art Appreciation", 1.2f)); studentResultsList.Add(studentResultTheFlash); StudentResults studentResultGreenArrow = new StudentResults(); studentResultGreenArrow.Date = DateTime.Now; studentResultGreenArrow.FirstName = "Green"; studentResultGreenArrow.LastName = "Arrow"; studentResultGreenArrow.Id = 9854758; studentResultGreenArrow.SummaryNotes = "Green Arrow is a wonderful student. Bow skills are fantastic. Martial arts prowess top notch. Look forward to him finding a real super power."; studentResultGreenArrow.ClassResults = new List <ClassResults>(); studentResultGreenArrow.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultGreenArrow.Id, "Archery", 4.0f)); studentResultGreenArrow.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultGreenArrow.Id, "Martial Arts", 3.4f)); studentResultGreenArrow.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultGreenArrow.Id, "Stealth", 3.8f)); studentResultGreenArrow.ClassResults.Add(ClassResults.BuildClassResults(DateTime.Now, studentResultGreenArrow.Id, "Invulnerability", 0.2f)); studentResultsList.Add(studentResultGreenArrow); return(studentResultsList); }