YMCMb 0 Light Poster

Hello everyone

My current scenario is

creating a mark sheet for students on different module.

Module 1 marks are as follows
Grade A = 70 marks or over
Grade B = 55-69
Grade C = 40 -54
Grade F = 0-39

Module 2 marks are as follows
Grade A = 75 marks or over
Grade B = 60-74
Grade C = 40 -59
Grade F = 0-39

and many other modules but with different marks

so when a new module is added
If the new grade is added and the grade = "B" Then
Grade B maximum mark should always be less than grade A minimum mark
but also Grade B Minimum mark should always be higher than Grade C Maximum Mark.

I have managed to create a select statement where it calls in a function Greater than which is as follows:

Private Function CheckGreaterThan(ByVal Pub As Integer, ByVal Rate As Char, ByVal MinMax As String, ByVal Value As Integer) As Boolean
Dim LowValue As Integer
Dim MyRateCardDetails As RateCardDetailsBLL = New RateCardDetailsBLL
        Dim MyRCDetails As RateCardDetailsDataTable = MyRateCardDetails.GetSpecGrade(Module, Rate)
Dim minmaxFieldName As String = ""
        If MinMax = "MAX" Then
            minmaxFieldName = "Max_Value"
        ElseIf MinMax = "MIN" Then
            minmaxFieldName = "Min_Value"
        End If


        If MyRCDetails.Rows.Count = 0 Then 

'This causes problems as if i return True it just addes the new record but doesnt do any 'validation check :(

        ElseIf MyRCDetails.Rows.Count > 0 Then
            If minmaxFieldName.Length > 0 Then
                LblError.Visible = True
                LblError.Text = "Stage 1"

                LowValue = MyRCDetails.Rows(0)(minmaxFieldName)
                If MyRCDetails.Rows.Count = 0 Then
                    Return True
                ElseIf MyRCDetails.Rows.Count > 0 Then

                    If Value > LowValue Then
                        Return True
                        LblError.Visible = True
                        LblError.Text = "Stage 1 a"
                    Else
                        Return False
                        LblError.Visible = True
                        LblError.Text = "Stage 1 b"
                    End If

                End If
            Else
                LblError.Visible = True
                LblError.Text = "Cant get past this stage for some reason :s"
            End If
        End If

Similar code to CheckLessThan
But at the moment when i create A grade it works, but doesnt do a validation check when i add a B grade as it requires to see if a row exists for grade C, But the thing is i still haven't added a Grade C but i would still like to make sure that Grade B Maximum is still smaller than Grade A Minimum.

Please can anyone help please