Thursday, April 29, 2010

ADO Phase One

Here is the Default.aspx page
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>New Donation</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>New Donation</h1>
<p>
<asp:Label ID="Label1" runat="server" >Last name</asp:Label>
<asp:TextBox ID="txtLastName" runat="server"></asp:TextBox> <br />
<asp:Label ID="Label2" runat="server" Text="First Name"></asp:Label><asp:TextBox ID="txtFirstName"
runat="server"></asp:TextBox><br />

<asp:Label ID="Label3" runat="server" Text="Street"></asp:Label><asp:TextBox ID="txtStreet"
runat="server"></asp:TextBox><br />

<asp:Label ID="Label4" runat="server" Text="City"></asp:Label><asp:TextBox ID="txtCity"
runat="server"></asp:TextBox><br />

<asp:Label ID="Label5" runat="server" Text="State"></asp:Label><asp:TextBox ID="txtState"
runat="server"></asp:TextBox><br />

<asp:Label ID="Label6" runat="server" Text="Zip Code"></asp:Label><asp:TextBox ID="txtZip"
runat="server"></asp:TextBox><br />

<asp:Label ID="Label7" runat="server" Text="Donation Amount"></asp:Label><asp:TextBox ID="txtDonation"
runat="server"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="Submit donation" />
</p>

</div>
</form>
</body>
</html


Here is the code for the person class


Imports Microsoft.VisualBasic

Public Class Person

Private first As String
Private last As String
Private street As String
Private city As String
Private state As String
Private zip As String

Public Property FirstName() As String
Get
Return first
End Get
Set(ByVal value As String)
first = value
End Set
End Property

Public Property LastName() As String
Get
Return last
End Get
Set(ByVal value As String)
last = value
End Set
End Property

Public Property Address() As String
Get
Return street
End Get
Set(ByVal value As String)
street = value
End Set
End Property

Public Property PersonCity() As String
Get
Return city
End Get
Set(ByVal value As String)
city = value
End Set
End Property

Public Property PersonState() As String
Get
Return state
End Get
Set(ByVal value As String)
state = value
End Set
End Property

Public Property Zipcode() As String
Get
Return zip
End Get
Set(ByVal value As String)
zip = value
End Set
End Property

End Class

Here is the Donor class



Imports Microsoft.VisualBasic

Public Class Donor : Inherits Person
Private ID As String
'this class encapsulates the donor
'it inherits from Person'

Public Sub New(ByVal donorKey As String)
DonorID = donorKey
End Sub


Public Property DonorID() As String
Get
Return ID
End Get
Set(ByVal value As String)
ID = value
End Set
End Property
End Class



Here is the donation class

Imports Microsoft.VisualBasic

Public Class Donation
Private amount As Double
Private dDate As DateTime

Sub New(ByVal dAmount As Double)
amount = dAmount
dDate = DateTime.Now
End Sub

Public Property DonationAmount() As Double
Get
Return amount
End Get
Set(ByVal value As Double)
amount = value
End Set
End Property

Public ReadOnly Property DonationDate() As DateTime
Get
Return dDate
End Get
End Property

End Class





Here is the beginning of the Datalayer Class


Imports System.Data
Imports System.Data.SqlClient

Public Class DataLayer

Private don As Donor
Private gift As Donation
Private connect As SqlConnection

Sub New(ByVal d As Donor, ByVal dn As Donation)
don = d
gift = dn
connect = New SqlConnection("Data Source=localhost;initial catalog=Communityassist;integrated security=true")
End Sub

Public Function WriteDonation() As Boolean

End Function


End Class

No comments:

Post a Comment