| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Want to get organized in 2022? Let Dokkio put your cloud files (Drive, Dropbox, and Slack and Gmail attachments) and documents (Google Docs, Sheets, and Notion) in order. Try Dokkio (from the makers of PBworks) for free. Available on the web, Mac, and Windows.

View
 

COP 4834 Summer 2012 Assignment 2 - Creating Database Input Forms

Page history last edited by Dr. Ron Eaglin 9 years, 8 months ago

 Assignment #2 Creating Database Input Forms

 

Objectives

 

To be able to create the ability to communicate with the database to retrieve data and insert data.

 

Assignment

 

 

You will need to create a database called TraumaFlow. Start SQL Server and create this database.  I am going to be giving you scripts to run that use this database for all the upcoming assignments. For this assignment you will need to be able to manage selections on your form.  An example of this for your data is Mental Status - which has the choices: Alert, Awake, Confused, Restless, Combative, Lethargic, and Unresponsive. 

 

When faced with these fixed set of choices there are 2 possible ways they can be selected - one is where there is one possible selection and the other where there are multiple possible selections.  For example the patient in the above example could be Alert and Restless.

 

You will only have one namespace right now in your system. It will be Trauma Flow and it should have an ID of 1. This will be created with the script below.

 

Every patient data in the system will fall into a Category, in cases where there are options to choose from - the user of the form will need to select the value from a list of Codes - and this information gets entered into the database. Sometimes the value will not come from a Code, it will simply be a Value - in which case it is stored as Text. We will go more into this when you use this in the next assignment.

 

USE TraumaFlow
GO
-- These tables are used for filling in drop down boxes with specific
-- information from the database. Namespace is used to prevent collisions
-- This is a very simplified version of a code management system
CREATE TABLE Namespaces (
 id int primary key identity(1,1),
 Name varchar(50)
 )
CREATE TABLE Categories (
  id int primary key identity(1,1),
  NamespaceID int,  
  DisplayText varchar(200)
  )
 
  CREATE TABLE Codes (
  id int primary key identity(1,1),
  CategoryID int,
  DisplayText varchar(200)
  )
   
  ALTER TABLE Codes ADD FOREIGN KEY (CategoryID) REFERENCES Categories(id)
  
  ALTER TABLE Categories ADD FOREIGN KEY (NamespaceID) REFERENCES Namespaces(id)
  
  INSERT INTO Namespaces (Name) VALUES ('Trauma Flow')

 

USE TraumaFlow  
GO
CREATE PROCEDURE sp_InsertCategory (
   @DisplayText varchar(200)
   )
  AS
  BEGIN
  
  INSERT INTO Categories
    (NamespaceID, DisplayText)
  VALUES
    (1, @DisplayText)
    
  END    
  GO
 
  CREATE PROCEDURE sp_InsertCode (
   @CategoryID int,
   @DisplayText varchar(200)
   )
  AS
  BEGIN
  
  INSERT INTO Codes
    (CategoryID, DisplayText)
  VALUES
    (@CategoryID, @DisplayText)
    
  END 
  GO

CREATE VIEW viewAllCodes
  AS
  SELECT
    Categories.id AS 'CategoryID',
    Codes.id AS 'CodeID',
    Categories.DisplayText AS 'Category',
    Codes.DisplayText AS 'Code'
  FROM
    Categories, Codes
  WHERE
    Codes.CategoryID = Categories.id
   
   GO 
  

 

You will now be creating a new Web Site Solution TraumaFlowSystem - in this Solution you will need three forms. I recommend you create a directory for these forms called CodeSystem as these forms will all correspond to the management of code data.

 

InsertCategory.aspx  - This form will allow the user to enter the name of a Category. We will go over some categories with the next assignment. For now you will have one category: Mental Status. The Category will be entered into a TextBox.

 

 

InsertCodes.aspx - This form will allow the user to insert codes for a created Category. You will be entering these codes for the category, Alert, Awake, Confused, Restless, Combative, Lethargic, and Unresponsive. Because codes must be related to a Category - you'll need to let the user select the Category from a drop down. The Code associated with the Category will be entered into a Text Box.

 

 

ViewCodes.aspx - This form will show a display of all the codes from the viewAllCodes in a GridView. You can embed this into your InsertCodes.aspx file and do this with 2 pages.

 

You MUST transfer the system to your web site for it to be graded. Submit the URL in Dropbox.

 

Information

 

If you are not sure how to run scripts in SQL Server or create the database, then I will create materials to assist here.

 

Estimated Completion Time

 

This can be done in less than 1 hour, however most students will need to anticipate 5-10 hours to complete this assignment.

 

Supporting Lectures 

 

You'll want to view  the Getting Started with Database Tools in Visual Studio https://cop4709.pbworks.com/w/page/52841098/Getting%20Started%20with%20Database%20Tools%20in%20Visual%20Studio 

 

From the COP 4834 Lectures Page - I recommend brushing up on Text Boxes, Drop Down Lists, and GridView  Controls.

 

To complete this assignment you will need to know how to create stored procedures from Visual Studio- lecture here

 

A very good lecture from COP4709 on the GridView control is  here

 

 

 

Questions and Answers

 

Questions asked about this assignment will be answered here.

 

External Resources

 

 

 

Grading Criteria

 

Operational .NET web site worth 2 points

Input forms worth 3 points each (x2)

View form worth 2 points

 

Comments (0)

You don't have permission to comment on this page.