Title: Some Information from InClass Exercise 2
1Some Information from In-Class Exercise 2
- Out of 35 submissions, 15 submitted the wrong
file or did not name the file correctly. - The instruction requests the file for the aspx
Web form (i.e., the file with the .aspx file
extension) be submitted. - Some submitted the vb code file (the file with
the .aspx.vb extension) - Some submitted the .sln file.
Question Is there confusion about the file
structure in a Web application?
2Some Advice
- Keep up with your reading. That will help you
get through in-class exercise easier. - Treat programming instruction as end-user
requirements. Part of MIS workers
professionalism is to precisely implement user
requirements. - MIS has its technical side that requires us to be
accurate and logical. If something does not work
or seem complicated, there must be a reason. Be
a good detective.
3How to be a good detective?
- Object-oriented programming relies mainly on
objects (i.e., classes in VB terminology) to
perform its tasks. - The more objects you know about, the more
effective you will be. - To know objects, you need to know how to use
their properties, behaviors (i.e., functions),
and events. - You also need to master the three basic
processing constructs sequential, selection, and
looping. - Can conceptualize/visualize abstract data types
such as a sorted list being constructed using
basic data types such as integer, string, etc. - Also useful is standalone functions CType( ),
FormatCurrency( ), CDec( )
4How to Know More Objects?
- By seeing how others use them, e.g., application
examples in your books - By checking out the help files about objects.
Lets start by checking out the following
classes, which you need to use in your first
homework assignment gtgt DropDownList gtgt
AccessDataSource gtgt DataView gtgt
DataRowView gtgt HttpSessionState, Session gtgt
SortedList
5DropDownList
- Some Properties AutoPostBack, DataSourceID,
DataFieldText, DataValueField, Items,
SelectedItem, SelectedIndex, SelectedValue - Some Methods DataBind( ), ToString
6AccessDataSource
- Some Properties ID, ConnectionString, DataFile,
SelectCommand, DeleteCommand, InsertCommand,
UpdateCommand - Some Methods Select, Update, Insert, Delete
7DataView
- Definition Represents a databindable, customized
view of a DataTable for sorting, filtering,
searching, editing, and navigation. - Some Properties Count, Item, RowFilter, Sort,
Table - Indexing DataView1.Item(integer) or DataView1
(integer) - Some Methods AddNew, ToString, ToTable, Delete,
Find, FindRows, GetType
8DataRowView
- Some Properties Item, Row
- Indexing
- DataRowView1.Item (integer)
- DataRowView1 (integer)
- DataRowView1.Item (Table Column Name)
- DataRowView1 (Table Column Name)
- DataRowView1.Row (integer)
- Some Methods Delete, GetType, ToString
9HttpSessionState, Session
- ASP.NET provides session-state management to
enable you to store information associated with a
unique browser session across multiple requests. - You can store a collection of values referenced
by a key name or by numerical index. - Access to session values and functionality is
available using the HttpSessionState class - HttpSessionState class is accessible through the
Session property of the current HttpContext, or
the Session property of the Page.
10HttpSessionState, Session
- Some Properties Count, IsCookieless, Item, Keys,
SessionID - Some Methods
- Add (object name, object value)
- Session(object name) object value
- Remove (key value)
- RemoveAt (integer)
- RemoveAll
11SortedList An Abstract Data Type
- A collection of key-and-value pairs that are
sorted by the keys and are accessible by key and
by index. - Each entry in a SortedList is of the data type
Dictionary Entry, i.e. (key, value) - The key is the identifier used to retrieve the
value. - The value can be a simple data type like a string
or a complex data type like a user-defined class
12SortedList An Abstract Data Type
- Some Properties Count, Keys, Values, Item
- Indexing
- SortedList1.Item (key value or integer)
- SortedList1 (key value or integer)
- Some Methods Add, ConstainsKey, ConstainsValue,
IndexOfKey, IndexOfValue, GetKey (integer),
Remove, RemoveAt, RemoveAll
13SortedList An Abstract Data Type
Public Class Product Public ProductID As
String Public Name As String Public
ShortDescription As String Public
LongDescription As String Public UnitPrice As
Decimal Public ImageFile As String End Class
The shopping cart (Cart) defined in the Order
page is a sortedlist. Each entry
(DictionaryEntry) in the Cart has a pair of key
and value. The Key is the ProductID, and the
Value is the user-defined class "CartItem". The
Cart is stored in Session.
Public Class CartItem Public Product As
Product Public Quantity As Integer End Class
Inside the Shopping Cart Key Value ProductID Car
tItem (Product (ProductID, Name),
Quantity) ProductID CartItem (Product (ProductID,
Name), Quantity)
14The shopping cart or the session looks like this
Entry 1
Entry 2