Ejemplo n.º 1
0
        public static int InitializeScoresheetTable(string scoreID, string courseID, string teacherID,
                                                    string studentID, string semesterID, float attendanceScore,
                                                    float labScore, float homeworkScore, float finalExamScore,
                                                    float totalScore, string grade, string remark)
        {
            ScoresheetViewModel data = new ScoresheetViewModel
            {
                ScoreID         = scoreID,
                CourseID        = courseID,
                TeacherID       = teacherID,
                StudentID       = studentID,
                SemesterID      = semesterID,
                AttendanceScore = attendanceScore,
                LabScore        = labScore,
                HomeworkScore   = homeworkScore,
                FinalExamScore  = finalExamScore,
                TotalScore      = totalScore,
                Grade           = grade,
                Remark          = remark
            };
            string sql = @"INSERT into dbo.Scoresheets (EnrollStudentID, CourseID, TeacherID,
                                            StudentID, SemesterID, AttendanceScore, LabScore,
                                            HomeworkScore, FinalExamScore, TotalScore, Grade, Remark)
                                            values (@ScoreID, @CourseID, @TeacherID,
                                            @StudentID, @SemesterID, @AttendanceScore, @LabScore,
                                            @HomeworkScore, @FinalExamScore, @TotalScore, @Grade, @Remark);";

            return(SqlDataAccess.SaveData(sql, data));
        }
Ejemplo n.º 2
0
        public static int UpdateGrade(string id, string grade)
        {
            var list = GetScoresheet(id);

            if (list[0].TotalScore >= 90)
            {
                grade = "A";
            }
            else if (list[0].TotalScore >= 80)
            {
                grade = "B";
            }
            else if (list[0].TotalScore >= 70)
            {
                grade = "C";
            }
            else if (list[0].TotalScore >= 60)
            {
                grade = "D";
            }
            else
            {
                grade = "F";
            }
            ScoresheetViewModel data = new ScoresheetViewModel
            {
                ScoreID = id,
                Grade   = grade
            };
            string sql = @"UPDATE dbo.Scoresheets SET Grade = @Grade
                            WHERE EnrollStudentID = @ScoreID";

            return(SqlDataAccess.SaveData(sql, data));
        }