1The Online Diaryand OrganizerBy the end of this chapter you’ll have created an online diary, organizer, and contacts manager. Sowhat exactly does the
Method Return Type DescriptionGetContactsByFirstLetterAsCollection(ByVal SqlDataReader Shared method DiaryId As Integer, Optional ByVal that returns
The ContactCollection class has only one property:Property Type DescriptionItem(ByVal Index As Integer) Integer Returns the Contact object stored at t
Having created a DiaryEntry object, saving it involves simply calling the Save() method. As with theSave() method of the Contacts class, the DiaryEntr
Method Return Type DescriptionGetDiaryEntriesByDateAsCollection(ByVal DiaryEntryCollection Creates a new DiaryId As Integer, ByVal FromDate DiaryEntr
Along with the Item() property, the DiaryEntryCollection class has three public methods:Method Return Type DescriptionAdd(ByVal New DiaryEntry None
The following table explains these methods in detail:Method Return Type DescriptionSave() None Saves a fully populatedDiaryEvent object. If it’sa new
Method Return Type DescriptionDeleteEvent() None Deletes from the database theevent with EventId equal tomEventId of the object. TheDiaryEvent object’
This class contains only one property:Property Type DescriptionItem(ByVal Index As Integer) Integer Returns the DiaryEvent object stored atthe positio
Each of the seven class files is stored in the App_Code directory (at the top of the figure). The App_Datadirectory contains the two databases: the lo
Font-Names=”Verdana” Font-Size=”0.8em”ForeColor=”#284775” /><TextBoxStyle Font-Size=”0.8em” /><TitleTextStyle BackColor=”#5D7B9D” Font-Bol
Figure 1-1Figure 1-2This shows another of the new security controls in ASP.NET 2.0; creating a registration process is nowjust a matter of adding a co
<NavigationButtonStyle BackColor=”#FFFBFF” BorderColor=”#CCCCCC”BorderStyle=”Solid”BorderWidth=”1px” Font-Names=”Verdana” ForeColor=”#284775” />
</table></asp:WizardStep><asp:CompleteWizardStep runat=”server”><ContentTemplate><table border=”0” style=”font-size: 100%;
Figure 1-13Figure 1-14This screen asks users for their first name and last name. This time it’s up to you to store the data some-where, and you do tha
This step creates a new diary for users and stores their first and last names. The UserName comes fromthe CreateUserWizard control’s UserName property
Viewing the Online CalendarThe DiaryMain.aspx page is the central hub of the application. It displays a calendar of the currentmonth, showing which da
However, the new ObjectDataSource lets you have the best of both: easy-to-use data controls and use ofclasses to separate business, data, and presenta
<asp:BoundField DataField=”EntryText” /></Columns><PagerStyle BackColor=”#284775” ForeColor=”White”HorizontalAlign=”Center” /><Se
mDiaryEntry is a global variable used to hold the DiaryEntry object relating to the day being edited.The constructor, shown in the following code, doe
When the diary title or entry boxes are changed, mDiaryEntry is updated:Protected Sub entryTitleTextBox_TextChanged(ByVal sender As Object, ByVal e As
diaryDBConn = NothingEnd IfEnd SubThe private method UpdateDiaryEntry() updates it:Private Sub UpdateDiaryEntry()If mDiaryEntryId <> -1 ThenDim
Figure 1-4On this page you see a monthly calendar. Days with diary entries are marked with a blue background.Days with events are marked in red text.
Type=”DateTime” /><asp:Parameter DefaultValue=”0” Name=”MaxRows” Type=”Int32” /></SelectParameters><DeleteParameters><asp:Para
In addition, the code specifies a Delete button on each row in the grid:<asp:CommandField ShowDeleteButton=”True” />When you click the Delete bu
itemToSelect =eventDurationDropDownList.Items.FindByValue(EventBeingEdited.EventDuration.ToString())itemToSelect.Selected = TrueEventBeingEdited = Not
It gets its data from the ObjectDataSource control ObjectDataSource1, which in turn connects to theContact class’s GetContactByFirstLetter() shared me
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)Handles Me.LoadIf IsPostBack ThenDim currentContact As NewContact(CLng(Req
Alternatively, if you have IIS installed make the OnlineDiary directory you copied over a virtual direc-tory and then simply browse to SignOn.aspx.To
04_749516 ch01.qxp 2/10/06 9:11 PM Page 36
You can also navigate your diary from here via the small calendar to the right.Adding a diary entry simply involves typing in the Entry Title and Diar
Figure 1-8Here you see a list of your contacts, which you can edit and delete by clicking the appropriate link in theContacts table. You can also add
So you’ve seen what the Online Diary does, now you can look at how it does it! The next sectiondescribes the overall design and how the system hangs t
The default database created using the new membership features of ASP.NET 2.0 is also used. Thedatabase is a SQL Server Express database and not modif
Consider this very simple stored procedure:DeleteContactRather unsurprisingly, DeleteContact deletes a contact from the database. The naming conventio
It has two constructors, outlined in the following table: Constructor DescriptionNew(ByVal Diaryid as Integer) Creates a new Contact object with all p
Comments to this Manuals