Chpt 6 pg 204-205
I cannot delete the player. If you are outside of season then the player can be deleted it says. The recored is not deleted.
I changed my system date to 2/20/06 and 8/20/06 for testing and created me as a player to delete and my date is 2/17/2006.
Please review and let me know what is missing to delete.
NOTE: I use the WroxUnited and created me then deleted. It deleted all players. I used the dave login account.
My code and yours is:
--------------------------------------------------------------
Protected Sub DetailsDataSource_Deleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEven tArgs) Handles DetailsDataSource.Deleting
Dim today As DateTime = DateTime.Now()
Dim startYear As Integer
Dim endYear As Integer
Dim seasonStart As DateTime
Dim seasonEnd As DateTime
If today.Month > 5 Then
startYear = today.Year
endYear = today.Year + 1
Else
startYear = today.Year - 1
endYear = today.Year
End If
seasonStart = New DateTime(startYear, 8, 20) '20th August 8 >> Feb 2
seasonEnd = New DateTime(endYear, 5, 31) '31 May
If today >= seasonStart And today <= seasonEnd Then
e.Cancel = True
Message.Text = "Cannot delete players during the season"
Else
'GridView1.DataBind()
Message.Text = ""
End If
End Sub
|