From 082b1f2bcd27961879a3208a84b52dfc2a05a91b Mon Sep 17 00:00:00 2001
From: EggMan20339 <99349302+EggMan20339@users.noreply.github.com>
Date: Fri, 16 Feb 2024 07:50:40 -0500
Subject: [PATCH] update
---
...ce (conflicted copy 2024-02-08 103827).xml | 567 ++++++++++++++++++
...(conflicted copy 2024-02-08 100248).csproj | 83 +++
Database3-submit/Database3/App.config | 10 +
Database3-submit/Database3/Database3.csproj | 99 +++
Database3-submit/Database3/Program.cs | 22 +
.../Database3/Properties/AssemblyInfo.cs | 36 ++
.../Properties/Resources.Designer.cs | 69 +++
.../Database3/Properties/Resources.resx | 117 ++++
.../Database3/Properties/Settings.Designer.cs | 26 +
.../Database3/Properties/Settings.settings | 7 +
Database3-submit/Database3/State.xml | 55 ++
Database3-submit/Database3/StateManager.cs | 208 +++++++
Database3-submit/Database3/StudentDataTier.cs | 168 ++++++
.../Database3/frmEdit.Designer.cs | 245 ++++++++
Database3-submit/Database3/frmEdit.cs | 122 ++++
Database3-submit/Database3/frmEdit.resx | 120 ++++
.../Database3/frmSearch.Designer.cs | 194 ++++++
Database3-submit/Database3/frmSearch.cs | 142 +++++
Database3-submit/Database3/frmSearch.resx | 123 ++++
Database3-submit/Database3/state.cs | 50 ++
Database3-submit/stored procs.txt | 86 +++
Database3-submit/stored procs.txt.bak | 0
22 files changed, 2549 insertions(+)
create mode 100644 .idea/.idea.CNSA-212-Personal-CAS/.idea/workspace (conflicted copy 2024-02-08 103827).xml
create mode 100644 Database/Database (conflicted copy 2024-02-08 100248).csproj
create mode 100644 Database3-submit/Database3/App.config
create mode 100644 Database3-submit/Database3/Database3.csproj
create mode 100644 Database3-submit/Database3/Program.cs
create mode 100644 Database3-submit/Database3/Properties/AssemblyInfo.cs
create mode 100644 Database3-submit/Database3/Properties/Resources.Designer.cs
create mode 100644 Database3-submit/Database3/Properties/Resources.resx
create mode 100644 Database3-submit/Database3/Properties/Settings.Designer.cs
create mode 100644 Database3-submit/Database3/Properties/Settings.settings
create mode 100644 Database3-submit/Database3/State.xml
create mode 100644 Database3-submit/Database3/StateManager.cs
create mode 100644 Database3-submit/Database3/StudentDataTier.cs
create mode 100644 Database3-submit/Database3/frmEdit.Designer.cs
create mode 100644 Database3-submit/Database3/frmEdit.cs
create mode 100644 Database3-submit/Database3/frmEdit.resx
create mode 100644 Database3-submit/Database3/frmSearch.Designer.cs
create mode 100644 Database3-submit/Database3/frmSearch.cs
create mode 100644 Database3-submit/Database3/frmSearch.resx
create mode 100644 Database3-submit/Database3/state.cs
create mode 100644 Database3-submit/stored procs.txt
create mode 100644 Database3-submit/stored procs.txt.bak
diff --git a/.idea/.idea.CNSA-212-Personal-CAS/.idea/workspace (conflicted copy 2024-02-08 103827).xml b/.idea/.idea.CNSA-212-Personal-CAS/.idea/workspace (conflicted copy 2024-02-08 103827).xml
new file mode 100644
index 0000000..7f94821
--- /dev/null
+++ b/.idea/.idea.CNSA-212-Personal-CAS/.idea/workspace (conflicted copy 2024-02-08 103827).xml
@@ -0,0 +1,567 @@
+
+
+
+ CNSA-212-Personal-CAS/CNSA-212-Personal-CAS.csproj
+ Chapter 5/Chapter 5.csproj
+ Chapter6/Chapter6.csproj
+ Database/Database.csproj
+ ElementaryMathematics/ElementaryMathematics.csproj
+ MDI/MDI.csproj
+ MidtermProject/MidtermProject.csproj
+ ScratchBook/ScratchBook.csproj
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ "associatedIndex": 2
+}
+
+
+
+
+
+
+
+
+
+ {
+ "keyToString": {
+ ".NET Project.Chapter 5.executor": "Run",
+ ".NET Project.Chapter6.executor": "Run",
+ ".NET Project.ElementaryMathematics.executor": "Run",
+ ".NET Project.MidtermProject.executor": "Run",
+ "ASKED_ADD_EXTERNAL_FILES": "true",
+ "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "SHARE_PROJECT_CONFIGURATION_FILES": "true",
+ "git-widget-placeholder": "master",
+ "ignore.virus.scanning.warn.message": "true",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.tslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "settings.editor.selected.configurable": "preferences.sourceCode.C#",
+ "vue.rearranger.settings.migration": "true"
+ },
+ "keyToStringList": {
+ "rider.external.source.directories": [
+ "C:\\Users\\eggman\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\DecompilerCache",
+ "C:\\Users\\eggman\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\SourcesCache",
+ "C:\\Users\\eggman\\AppData\\Local\\Symbols\\src"
+ ]
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1706796774658
+
+
+ 1706796774658
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1706797379671
+
+
+
+ 1706797379671
+
+
+
+ 1706797394109
+
+
+
+ 1706797394109
+
+
+
+ 1706797559129
+
+
+
+ 1706797559129
+
+
+
+ 1706797581738
+
+
+
+ 1706797581738
+
+
+
+ 1706798013331
+
+
+
+ 1706798013331
+
+
+
+ 1706798242767
+
+
+
+ 1706798242767
+
+
+
+ 1706798280854
+
+
+
+ 1706798280854
+
+
+
+ 1706799382777
+
+
+
+ 1706799382777
+
+
+
+ 1706799462794
+
+
+
+ 1706799462794
+
+
+
+ 1706799486722
+
+
+
+ 1706799486722
+
+
+
+ 1706800098192
+
+
+
+ 1706800098192
+
+
+
+ 1706800231565
+
+
+
+ 1706800231565
+
+
+
+ 1706801326431
+
+
+
+ 1706801326431
+
+
+
+ 1706802855299
+
+
+
+ 1706802855299
+
+
+
+ 1706803393304
+
+
+
+ 1706803393304
+
+
+
+ 1706836755156
+
+
+
+ 1706836755156
+
+
+
+ 1706839510778
+
+
+
+ 1706839510778
+
+
+
+ 1706879011265
+
+
+
+ 1706879011265
+
+
+
+ 1706880990593
+
+
+
+ 1706880990593
+
+
+
+ 1706887870980
+
+
+
+ 1706887870980
+
+
+
+ 1707174420577
+
+
+
+ 1707174420577
+
+
+
+ 1707190211941
+
+
+
+ 1707190211941
+
+
+
+ 1707225564837
+
+
+
+ 1707225564837
+
+
+
+ 1707225756324
+
+
+
+ 1707225756324
+
+
+
+ 1707266649846
+
+
+
+ 1707266649846
+
+
+
+ 1707310690301
+
+
+
+ 1707310690301
+
+
+
+ 1707313377301
+
+
+
+ 1707313377301
+
+
+
+ 1707314164182
+
+
+
+ 1707314164182
+
+
+
+ 1707316220557
+
+
+
+ 1707316220557
+
+
+
+ 1707319748726
+
+
+
+ 1707319748726
+
+
+
+ 1707400016987
+
+
+
+ 1707400016987
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Database/Database (conflicted copy 2024-02-08 100248).csproj b/Database/Database (conflicted copy 2024-02-08 100248).csproj
new file mode 100644
index 0000000..55504fc
--- /dev/null
+++ b/Database/Database (conflicted copy 2024-02-08 100248).csproj
@@ -0,0 +1,83 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {5DEFB1D0-F129-4E6E-A090-69ED8FF0E5BA}
+ WinExe
+ Database
+ Database
+ v4.7.1
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ frmDisplay.cs
+
+
+
+
+ frmDisplay.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Database3-submit/Database3/App.config b/Database3-submit/Database3/App.config
new file mode 100644
index 0000000..b90b072
--- /dev/null
+++ b/Database3-submit/Database3/App.config
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Database3-submit/Database3/Database3.csproj b/Database3-submit/Database3/Database3.csproj
new file mode 100644
index 0000000..830b6e5
--- /dev/null
+++ b/Database3-submit/Database3/Database3.csproj
@@ -0,0 +1,99 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {E10AB02F-374E-4252-B833-9963091D4B05}
+ WinExe
+ Database3
+ Database3
+ v4.7.1
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ frmEdit.cs
+
+
+ Form
+
+
+ frmSearch.cs
+
+
+
+
+
+
+
+ frmEdit.cs
+
+
+ frmSearch.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Database3-submit/Database3/Program.cs b/Database3-submit/Database3/Program.cs
new file mode 100644
index 0000000..c078372
--- /dev/null
+++ b/Database3-submit/Database3/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Database3
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new frmSearch());
+ }
+ }
+}
\ No newline at end of file
diff --git a/Database3-submit/Database3/Properties/AssemblyInfo.cs b/Database3-submit/Database3/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..5824c36
--- /dev/null
+++ b/Database3-submit/Database3/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Database3")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Database3")]
+[assembly: AssemblyCopyright("Copyright © 2024")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("E10AB02F-374E-4252-B833-9963091D4B05")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/Database3-submit/Database3/Properties/Resources.Designer.cs b/Database3-submit/Database3/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..56052f2
--- /dev/null
+++ b/Database3-submit/Database3/Properties/Resources.Designer.cs
@@ -0,0 +1,69 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Database3.Properties
+{
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder",
+ "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance",
+ "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState
+ .Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp =
+ new global::System.Resources.ResourceManager("Database3.Properties.Resources",
+ typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState
+ .Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get { return resourceCulture; }
+ set { resourceCulture = value; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Database3-submit/Database3/Properties/Resources.resx b/Database3-submit/Database3/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Database3-submit/Database3/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Database3-submit/Database3/Properties/Settings.Designer.cs b/Database3-submit/Database3/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..d046e83
--- /dev/null
+++ b/Database3-submit/Database3/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Database3.Properties
+{
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute(
+ "Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+ private static Settings defaultInstance =
+ ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get { return defaultInstance; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Database3-submit/Database3/Properties/Settings.settings b/Database3-submit/Database3/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/Database3-submit/Database3/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Database3-submit/Database3/State.xml b/Database3-submit/Database3/State.xml
new file mode 100644
index 0000000..923e18f
--- /dev/null
+++ b/Database3-submit/Database3/State.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Database3-submit/Database3/StateManager.cs b/Database3-submit/Database3/StateManager.cs
new file mode 100644
index 0000000..4420893
--- /dev/null
+++ b/Database3-submit/Database3/StateManager.cs
@@ -0,0 +1,208 @@
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Security;
+using Microsoft.VisualBasic;
+using System.Windows;
+using System.Xml;
+using System.Web;
+//using System.Web.Caching;
+
+namespace Traffic
+{
+ ///
+
+ /// ''' Provides the functionality related to retrieving the list
+
+ /// ''' of states for a system;
+ //// reads an xml file
+ /// '''
+ public static class StateManager
+ {
+ // Cache object that will be used to store and retrieve items from
+ // the cache and constants used within this object
+ // private static Cache myCache = System.Web.HttpRuntime.Cache();
+ private static string stateKey = "StateKey";
+ public static string applicationConstantsFileName = AppDomain.CurrentDomain.BaseDirectory + "State.xml"; // = Strings.Replace(System.AppDomain.CurrentDomain.BaseDirectory + "State.xml", "/", @"\");
+ // "States.config", "/", "\")
+ private static state[] stateArray;
+ private static ArrayList errorList;
+
+
+ // Tells you whether or not any errors have occurred w/in the module
+ public static bool hasErrors
+ {
+ get
+ {
+ if (errorList == null || errorList.Count == 0)
+ return false;
+ else
+ return true;
+ }
+ }
+
+
+ // Retrieves an array list of Exception objects
+ public static ArrayList getErrors
+ {
+ get
+ {
+ return errorList;
+ }
+ }
+
+
+ // Private method used to add errors to the errorList
+ private static void addError(ref Exception e)
+ {
+ if (errorList == null)
+ errorList = new ArrayList();
+ errorList.Add(e);
+ }
+
+ ///
+ /// ''' Gets all the states
+ /// '''
+ /// ''' An array of State objects
+ public static state[] getStates()
+ {
+ //if (myCache[stateKey] == null)
+ PopulateCache();
+ return stateArray;
+ }
+
+
+ ///
+ /// ''' Takes the abbreviation given and returns the full name
+ /// '''
+ /// ''' The full name for the abbreviation in
+ /// ''' question
+ private static string convertAbbreviationToName(ref string abbreviation)
+ {
+ XmlDocument xmlFile = new XmlDocument();
+
+ try
+ {
+ applicationConstantsFileName = applicationConstantsFileName.Replace("/", @"\");
+ xmlFile.Load(applicationConstantsFileName);
+ XmlNode theNode = xmlFile.SelectSingleNode("descendant::state[@abbreviation='" + abbreviation + "']");
+
+ if (theNode != null)
+ return theNode.Attributes.GetNamedItem("name").Value;
+ }
+ catch (Exception e)
+ {
+ addError(ref e);
+ }
+
+ return null;
+ }
+
+
+ ///
+ /// ''' Gets the state object based on the full name
+ /// '''
+ /// ''' The full name of the state to
+ /// ''' retrieve
+ /// ''' A State object for the name given
+ public static state getStateByName(ref string name)
+ {
+ // if (myCache[stateKey + name] == null)
+ PopulateCache();
+ //return state[stateKey + name];
+
+ return (state)Convert.ChangeType(stateKey, typeof(state[]));
+ }
+
+
+ ///
+ /// ''' Gets the state object based on the abbreviation
+ /// '''
+ /// ''' The abbreviation of the state
+ /// ''' to retrieve
+ /// ''' A State object for the abbreviation
+ /// ''' given
+ public static state getStateByAbbreviation(ref string abbreviation)
+ {
+ string name = convertAbbreviationToName(ref abbreviation);
+ if (name != null)
+ return getStateByName(ref name);
+ else
+ return null/* TODO Change to default(_) if this is not a reference type */;
+ }
+
+
+ /// The manager attempts to load the XML
+ /// ''' file and store it in the cache with a dependency on the XML
+ /// ''' file itself.' This means that any time the XML file changes, it
+ /// ''' is removed from the cache. When the methods that return State
+ /// ''' objects are called again, the XML file won't exist in memory
+ /// ''' and the PopulateCache will be re-called.
+ /// '''
+ private static void PopulateCache()
+ {
+ XmlDocument xmlFile = new XmlDocument();
+ // Dim theState As State
+ XmlNode theNode;
+ string theName, theAbbreviation;
+ int i = 0;
+
+ try
+ {
+ applicationConstantsFileName = applicationConstantsFileName.Replace("/", @"\");
+ xmlFile.Load(applicationConstantsFileName);
+
+ // Attempt to find the element given the "key" for that tag
+ XmlNodeList elementList = xmlFile.GetElementsByTagName("state");
+
+ if (elementList != null)
+ {
+ stateArray = (state[])Array.CreateInstance(typeof(state), elementList.Count);
+
+ // Loop through each element that has the name we're looking for
+ for (i = 0; i <= elementList.Count - 1; i++)
+ {
+ theNode = elementList[i];
+
+ // Get the name for that tag
+ if (theNode.Attributes.GetNamedItem("name") != null)
+ theName = theNode.Attributes.GetNamedItem("name").Value;
+ else
+ theName = null;
+
+ // Get the abbreviation for that tag
+ if (theNode.Attributes.GetNamedItem("abbreviation") != null)
+ theAbbreviation = theNode.Attributes.GetNamedItem("abbreviation").Value;
+ else
+ theAbbreviation = null;
+
+ // Populate that location in the array with the
+ // values for the tag
+ stateArray[i] = new state(ref theName, ref theAbbreviation);
+
+ // Insert the state into cache
+ //// myCache.Insert(stateKey + theName, stateArray[i], new CacheDependency(applicationConstantsFileName));
+ }
+
+ // Insert the state array into cache
+ //// myCache.Insert(stateKey, stateArray, new CacheDependency(applicationConstantsFileName));
+ }
+ }
+ catch (Exception e)
+ {
+ addError(ref e);
+ }
+ }
+ }
+
+}
diff --git a/Database3-submit/Database3/StudentDataTier.cs b/Database3-submit/Database3/StudentDataTier.cs
new file mode 100644
index 0000000..afe2492
--- /dev/null
+++ b/Database3-submit/Database3/StudentDataTier.cs
@@ -0,0 +1,168 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.VisualBasic;
+using System.Data;
+using System.Configuration;
+using System.Collections;
+using System.Data.SqlClient;
+
+
+namespace Database3
+{
+ public class StudentDataTier
+ {
+ static String connString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
+ static SqlConnection myConn = new SqlConnection(connString);
+ static System.Data.SqlClient.SqlCommand cmdString = new System.Data.SqlClient.SqlCommand();
+
+ public DataSet GetStudents(string studid, string lname, DateTime dob)
+ {
+ try
+ {
+ // open connection
+ myConn.Open();
+ //clear any parameters
+ cmdString.Parameters.Clear();
+ // command
+ cmdString.Connection = myConn;
+ cmdString.CommandType = CommandType.StoredProcedure;
+ cmdString.CommandTimeout = 1500;
+ cmdString.CommandText = "SearchStudent";
+ // Define input parameter
+ cmdString.Parameters.Add("@studentid", SqlDbType.VarChar, 6).Value = studid;
+ cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 25).Value = lname;
+ cmdString.Parameters.Add("@dob", SqlDbType.Date).Value = dob;
+ // adapter and dataset
+ SqlDataAdapter aAdapter = new SqlDataAdapter();
+ aAdapter.SelectCommand = cmdString;
+ DataSet aDataSet = new DataSet();
+
+ // fill adapter
+ aAdapter.Fill(aDataSet);
+
+ // return dataSet
+ return aDataSet;
+ }
+ catch (Exception ex)
+ {
+ throw new ArgumentException(ex.Message);
+ }
+ finally
+ {
+ myConn.Close();
+ }
+ }
+
+
+ public DataSet GetStudents(string StuID)
+ {
+
+
+ try
+ {
+ // open connection
+ myConn.Open();
+ //clear any parameters
+ cmdString.Parameters.Clear();
+ // command
+ cmdString.Connection = myConn;
+ cmdString.CommandType = CommandType.StoredProcedure;
+ cmdString.CommandTimeout = 1500;
+ cmdString.CommandText = "GetByStudentIDS";
+ // Define input parameter
+ cmdString.Parameters.Add("@studentid", SqlDbType.VarChar, 6).Value = StuID;
+ // adapter and dataset
+ SqlDataAdapter aAdapter = new SqlDataAdapter();
+ aAdapter.SelectCommand = cmdString;
+ DataSet aDataSet = new DataSet();
+
+ // fill adapter
+ aAdapter.Fill(aDataSet);
+
+ // return dataSet
+ return aDataSet;
+ }
+ catch (Exception ex)
+ {
+ throw new ArgumentException(ex.Message);
+ }
+ finally
+ {
+ myConn.Close();
+ }
+ }
+
+ public void DeleteStudents(string StuID)
+ {
+
+
+ try
+ {
+ // open connection
+ myConn.Open();
+ //clear any parameters
+ cmdString.Parameters.Clear();
+ // command
+ cmdString.Connection = myConn;
+ cmdString.CommandType = CommandType.StoredProcedure;
+ cmdString.CommandTimeout = 1500;
+ cmdString.CommandText = "DELETESTUDENT";
+ // Define input parameter
+ cmdString.Parameters.Add("@studentid", SqlDbType.VarChar, 6).Value = StuID;
+
+ object result = cmdString.ExecuteScalar();
+
+ }
+ catch (Exception ex)
+ {
+ throw new ArgumentException(ex.Message);
+ }
+ finally
+ {
+ myConn.Close();
+ }
+
+ }
+
+ public void UpdateStudent(string studid, string firstname, string lastname, DateTime dob, decimal acctbal, string Gender,decimal totalCreds, string state)
+ {
+ try
+ {
+ myConn.Open();
+
+ cmdString.Parameters.Clear();
+
+ cmdString.Connection = myConn;
+ cmdString.CommandType = CommandType.StoredProcedure;
+ cmdString.CommandTimeout = 1500;
+
+ cmdString.CommandText = "UPDATESTUDENTBYID";
+
+ cmdString.Parameters.Add("@student_id", SqlDbType.VarChar, 6).Value = studid;
+ cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 25).Value = firstname;
+ cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 25).Value = lastname;
+ cmdString.Parameters.Add("@balance", SqlDbType.Decimal, 7).Value = acctbal;
+ cmdString.Parameters.Add("@dob", SqlDbType.Date).Value = dob;
+ cmdString.Parameters.Add("@gender", SqlDbType.Char, 6).Value = Gender;
+ cmdString.Parameters.Add("@credits", SqlDbType.Decimal, 5).Value = totalCreds;
+ cmdString.Parameters.Add("@state", SqlDbType.Char, 2).Value = state;
+
+ cmdString.ExecuteScalar();
+
+ }
+ catch (Exception ex)
+ {
+ throw new ArgumentException(ex.Message);
+ }
+ finally
+ {
+ myConn.Close();
+ }
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/Database3-submit/Database3/frmEdit.Designer.cs b/Database3-submit/Database3/frmEdit.Designer.cs
new file mode 100644
index 0000000..9437a87
--- /dev/null
+++ b/Database3-submit/Database3/frmEdit.Designer.cs
@@ -0,0 +1,245 @@
+using System.ComponentModel;
+
+namespace Database3
+{
+ partial class frmEdit
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.lblDisStuID = new System.Windows.Forms.Label();
+ this.lblDisfname = new System.Windows.Forms.Label();
+ this.lblDislname = new System.Windows.Forms.Label();
+ this.lblDisDOB = new System.Windows.Forms.Label();
+ this.lblDisSalary = new System.Windows.Forms.Label();
+ this.lblDisGender = new System.Windows.Forms.Label();
+ this.lblDisCredits = new System.Windows.Forms.Label();
+ this.lblDisState = new System.Windows.Forms.Label();
+ this.btnUpdate = new System.Windows.Forms.Button();
+ this.txtStuID = new System.Windows.Forms.TextBox();
+ this.txtfname = new System.Windows.Forms.TextBox();
+ this.txtlname = new System.Windows.Forms.TextBox();
+ this.txtDOB = new System.Windows.Forms.TextBox();
+ this.txtSalary = new System.Windows.Forms.TextBox();
+ this.txtCredits = new System.Windows.Forms.TextBox();
+ this.cboGender = new System.Windows.Forms.ComboBox();
+ this.cboState = new System.Windows.Forms.ComboBox();
+ this.SuspendLayout();
+ //
+ // lblDisStuID
+ //
+ this.lblDisStuID.Location = new System.Drawing.Point(91, 62);
+ this.lblDisStuID.Name = "lblDisStuID";
+ this.lblDisStuID.Size = new System.Drawing.Size(183, 24);
+ this.lblDisStuID.TabIndex = 0;
+ this.lblDisStuID.Text = "Student ID:";
+ this.lblDisStuID.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lblDisfname
+ //
+ this.lblDisfname.Location = new System.Drawing.Point(91, 86);
+ this.lblDisfname.Name = "lblDisfname";
+ this.lblDisfname.Size = new System.Drawing.Size(183, 24);
+ this.lblDisfname.TabIndex = 1;
+ this.lblDisfname.Text = "First Name:";
+ this.lblDisfname.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lblDislname
+ //
+ this.lblDislname.Location = new System.Drawing.Point(91, 110);
+ this.lblDislname.Name = "lblDislname";
+ this.lblDislname.Size = new System.Drawing.Size(183, 24);
+ this.lblDislname.TabIndex = 2;
+ this.lblDislname.Text = "Last Name:";
+ this.lblDislname.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lblDisDOB
+ //
+ this.lblDisDOB.Location = new System.Drawing.Point(91, 134);
+ this.lblDisDOB.Name = "lblDisDOB";
+ this.lblDisDOB.Size = new System.Drawing.Size(183, 24);
+ this.lblDisDOB.TabIndex = 3;
+ this.lblDisDOB.Text = "Date of Birth:";
+ this.lblDisDOB.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lblDisSalary
+ //
+ this.lblDisSalary.Location = new System.Drawing.Point(91, 158);
+ this.lblDisSalary.Name = "lblDisSalary";
+ this.lblDisSalary.Size = new System.Drawing.Size(183, 24);
+ this.lblDisSalary.TabIndex = 4;
+ this.lblDisSalary.Text = "Salary:";
+ this.lblDisSalary.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lblDisGender
+ //
+ this.lblDisGender.Location = new System.Drawing.Point(91, 182);
+ this.lblDisGender.Name = "lblDisGender";
+ this.lblDisGender.Size = new System.Drawing.Size(183, 24);
+ this.lblDisGender.TabIndex = 5;
+ this.lblDisGender.Text = "Gender:";
+ this.lblDisGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lblDisCredits
+ //
+ this.lblDisCredits.Location = new System.Drawing.Point(91, 206);
+ this.lblDisCredits.Name = "lblDisCredits";
+ this.lblDisCredits.Size = new System.Drawing.Size(183, 24);
+ this.lblDisCredits.TabIndex = 6;
+ this.lblDisCredits.Text = "Total Credits:";
+ this.lblDisCredits.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lblDisState
+ //
+ this.lblDisState.Location = new System.Drawing.Point(91, 230);
+ this.lblDisState.Name = "lblDisState";
+ this.lblDisState.Size = new System.Drawing.Size(183, 24);
+ this.lblDisState.TabIndex = 7;
+ this.lblDisState.Text = "State:";
+ this.lblDisState.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // btnUpdate
+ //
+ this.btnUpdate.Location = new System.Drawing.Point(537, 111);
+ this.btnUpdate.Name = "btnUpdate";
+ this.btnUpdate.Size = new System.Drawing.Size(75, 23);
+ this.btnUpdate.TabIndex = 8;
+ this.btnUpdate.Text = "Update";
+ this.btnUpdate.UseVisualStyleBackColor = true;
+ this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
+ //
+ // txtStuID
+ //
+ this.txtStuID.Location = new System.Drawing.Point(312, 65);
+ this.txtStuID.Name = "txtStuID";
+ this.txtStuID.Size = new System.Drawing.Size(187, 20);
+ this.txtStuID.TabIndex = 9;
+ //
+ // txtfname
+ //
+ this.txtfname.Location = new System.Drawing.Point(312, 89);
+ this.txtfname.Name = "txtfname";
+ this.txtfname.Size = new System.Drawing.Size(187, 20);
+ this.txtfname.TabIndex = 10;
+ //
+ // txtlname
+ //
+ this.txtlname.Location = new System.Drawing.Point(312, 113);
+ this.txtlname.Name = "txtlname";
+ this.txtlname.Size = new System.Drawing.Size(187, 20);
+ this.txtlname.TabIndex = 11;
+ //
+ // txtDOB
+ //
+ this.txtDOB.Location = new System.Drawing.Point(312, 137);
+ this.txtDOB.Name = "txtDOB";
+ this.txtDOB.Size = new System.Drawing.Size(187, 20);
+ this.txtDOB.TabIndex = 12;
+ //
+ // txtSalary
+ //
+ this.txtSalary.Location = new System.Drawing.Point(312, 161);
+ this.txtSalary.Name = "txtSalary";
+ this.txtSalary.Size = new System.Drawing.Size(187, 20);
+ this.txtSalary.TabIndex = 13;
+ //
+ // txtCredits
+ //
+ this.txtCredits.Location = new System.Drawing.Point(312, 209);
+ this.txtCredits.Name = "txtCredits";
+ this.txtCredits.Size = new System.Drawing.Size(187, 20);
+ this.txtCredits.TabIndex = 15;
+ //
+ // cboGender
+ //
+ this.cboGender.FormattingEnabled = true;
+ this.cboGender.Location = new System.Drawing.Point(312, 185);
+ this.cboGender.Name = "cboGender";
+ this.cboGender.Size = new System.Drawing.Size(187, 21);
+ this.cboGender.TabIndex = 16;
+ //
+ // cboState
+ //
+ this.cboState.FormattingEnabled = true;
+ this.cboState.Location = new System.Drawing.Point(312, 233);
+ this.cboState.Name = "cboState";
+ this.cboState.Size = new System.Drawing.Size(187, 21);
+ this.cboState.TabIndex = 17;
+ //
+ // frmEdit
+ //
+ this.AcceptButton = this.btnUpdate;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.cboState);
+ this.Controls.Add(this.cboGender);
+ this.Controls.Add(this.txtCredits);
+ this.Controls.Add(this.txtSalary);
+ this.Controls.Add(this.txtDOB);
+ this.Controls.Add(this.txtlname);
+ this.Controls.Add(this.txtfname);
+ this.Controls.Add(this.txtStuID);
+ this.Controls.Add(this.btnUpdate);
+ this.Controls.Add(this.lblDisState);
+ this.Controls.Add(this.lblDisCredits);
+ this.Controls.Add(this.lblDisGender);
+ this.Controls.Add(this.lblDisSalary);
+ this.Controls.Add(this.lblDisDOB);
+ this.Controls.Add(this.lblDislname);
+ this.Controls.Add(this.lblDisfname);
+ this.Controls.Add(this.lblDisStuID);
+ this.Name = "frmEdit";
+ this.Text = "frmEdit";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Closing);
+ this.Load += new System.EventHandler(this.frmEdit_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+ }
+
+ private System.Windows.Forms.Button btnUpdate;
+ private System.Windows.Forms.TextBox txtStuID;
+ private System.Windows.Forms.TextBox txtfname;
+ private System.Windows.Forms.TextBox txtlname;
+ private System.Windows.Forms.TextBox txtDOB;
+ private System.Windows.Forms.TextBox txtSalary;
+ private System.Windows.Forms.TextBox txtCredits;
+ private System.Windows.Forms.ComboBox cboGender;
+ private System.Windows.Forms.ComboBox cboState;
+
+ private System.Windows.Forms.Label lblDisStuID;
+ private System.Windows.Forms.Label lblDisfname;
+ private System.Windows.Forms.Label lblDislname;
+ private System.Windows.Forms.Label lblDisDOB;
+ private System.Windows.Forms.Label lblDisSalary;
+ private System.Windows.Forms.Label lblDisGender;
+ private System.Windows.Forms.Label lblDisCredits;
+ private System.Windows.Forms.Label lblDisState;
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Database3-submit/Database3/frmEdit.cs b/Database3-submit/Database3/frmEdit.cs
new file mode 100644
index 0000000..b2df256
--- /dev/null
+++ b/Database3-submit/Database3/frmEdit.cs
@@ -0,0 +1,122 @@
+using System;
+using System.Data;
+using System.Windows.Forms;
+using Traffic;
+
+namespace Database3
+{
+ public partial class frmEdit : Form
+ {
+
+ private frmSearch forminstance;
+ public frmEdit(frmSearch there)
+ {
+ InitializeComponent();
+ forminstance = there;
+ }
+
+ private void Form_Closing(object sender, FormClosingEventArgs e)
+ {
+
+ forminstance.btnSearch_Click(sender, e);
+
+ }
+
+ private void frmEdit_Load(object sender, EventArgs e)
+ {
+ // txtStuID.Text = frmSearch.myID;
+
+ try
+ {
+
+
+ DataSet ds = new DataSet();
+ StudentDataTier stuDT = new StudentDataTier();
+
+ ds = stuDT.GetStudents(frmSearch.myID.ToString());
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+
+ txtStuID.Text = ds.Tables[0].Rows[0]["student_id"].ToString();
+ txtStuID.Enabled = false;
+ txtfname.Text = ds.Tables[0].Rows[0]["fname"].ToString();
+ txtlname.Text = ds.Tables[0].Rows[0]["lname"].ToString();
+
+ }
+ }
+ catch (Exception exception)
+ {
+ // Do Nothing
+ }
+
+ }
+
+ private void btnUpdate_Click(object sender, EventArgs e)
+ {
+ string studid = "";
+ string firstname = "";
+ string lastname = "";
+ DateTime dob = new DateTime(1/1/1111);
+ decimal acctbal = 0;
+ string gender = "";
+ decimal credits = 0;
+ string state = "";
+
+ try
+ {
+ DataSet ds = new DataSet();
+ StudentDataTier stuDT = new StudentDataTier();
+
+ studid = txtStuID.Text.Trim();
+ firstname = txtfname.Text.Trim();
+ lastname = txtlname.Text.Trim();
+ try
+ {
+ dob = DateTime.Parse(txtDOB.Text.Trim());
+
+ }
+ catch (Exception exception)
+ {
+ }
+
+ try
+ {
+ acctbal = decimal.Parse(txtSalary.Text.Trim());
+
+ }
+ catch (Exception exception)
+ {
+ }
+
+
+
+ gender = cboGender.Text.Trim();
+ if (gender != "MALE" && gender != "FEMALE")
+ {
+
+ gender = "NA";
+
+ }
+ try
+ {
+
+ credits = decimal.Parse(txtCredits.Text.Trim());
+
+ }
+ catch (Exception exception)
+ {
+ }
+ state = cboState.Text.Trim();
+
+ stuDT.UpdateStudent(studid, firstname, lastname, dob, acctbal, gender, credits, state);
+
+ }
+ catch
+ {
+
+ }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Database3-submit/Database3/frmEdit.resx b/Database3-submit/Database3/frmEdit.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/Database3-submit/Database3/frmEdit.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Database3-submit/Database3/frmSearch.Designer.cs b/Database3-submit/Database3/frmSearch.Designer.cs
new file mode 100644
index 0000000..9605e8c
--- /dev/null
+++ b/Database3-submit/Database3/frmSearch.Designer.cs
@@ -0,0 +1,194 @@
+namespace Database3
+{
+ partial class frmSearch
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.lblDisStID = new System.Windows.Forms.Label();
+ this.dgvStudents = new System.Windows.Forms.DataGridView();
+ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.cmuSearch = new System.Windows.Forms.ToolStripMenuItem();
+ this.cmuEdit = new System.Windows.Forms.ToolStripMenuItem();
+ this.cmuDelete = new System.Windows.Forms.ToolStripMenuItem();
+ this.lblDislname = new System.Windows.Forms.Label();
+ this.lblDisDOB = new System.Windows.Forms.Label();
+ this.txtStuID = new System.Windows.Forms.TextBox();
+ this.txtlname = new System.Windows.Forms.TextBox();
+ this.txtDOB = new System.Windows.Forms.TextBox();
+ this.btnSearch = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dgvStudents)).BeginInit();
+ this.contextMenuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // lblDisStID
+ //
+ this.lblDisStID.Location = new System.Drawing.Point(206, 87);
+ this.lblDisStID.Name = "lblDisStID";
+ this.lblDisStID.Size = new System.Drawing.Size(130, 21);
+ this.lblDisStID.TabIndex = 0;
+ this.lblDisStID.Text = "Student ID:";
+ this.lblDisStID.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // dgvStudents
+ //
+ this.dgvStudents.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dgvStudents.ContextMenuStrip = this.contextMenuStrip1;
+ this.dgvStudents.Location = new System.Drawing.Point(77, 250);
+ this.dgvStudents.Name = "dgvStudents";
+ this.dgvStudents.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.dgvStudents.Size = new System.Drawing.Size(638, 150);
+ this.dgvStudents.TabIndex = 1;
+ //
+ // contextMenuStrip1
+ //
+ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripSeparator1, this.cmuSearch, this.cmuEdit, this.cmuDelete });
+ this.contextMenuStrip1.Name = "contextMenuStrip1";
+ this.contextMenuStrip1.Size = new System.Drawing.Size(153, 98);
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
+ //
+ // cmuSearch
+ //
+ this.cmuSearch.Name = "cmuSearch";
+ this.cmuSearch.Size = new System.Drawing.Size(152, 22);
+ this.cmuSearch.Text = "Search";
+ this.cmuSearch.Click += new System.EventHandler(this.cmuSearch_Click);
+ //
+ // cmuEdit
+ //
+ this.cmuEdit.Name = "cmuEdit";
+ this.cmuEdit.Size = new System.Drawing.Size(152, 22);
+ this.cmuEdit.Text = "Edit";
+ this.cmuEdit.Click += new System.EventHandler(this.cmuEdit_Click);
+ //
+ // cmuDelete
+ //
+ this.cmuDelete.Name = "cmuDelete";
+ this.cmuDelete.Size = new System.Drawing.Size(152, 22);
+ this.cmuDelete.Text = "Delete";
+ this.cmuDelete.Click += new System.EventHandler(this.cmuDelete_Click);
+ //
+ // lblDislname
+ //
+ this.lblDislname.Location = new System.Drawing.Point(206, 108);
+ this.lblDislname.Name = "lblDislname";
+ this.lblDislname.Size = new System.Drawing.Size(130, 21);
+ this.lblDislname.TabIndex = 2;
+ this.lblDislname.Text = "Last Name:";
+ this.lblDislname.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lblDisDOB
+ //
+ this.lblDisDOB.Location = new System.Drawing.Point(206, 129);
+ this.lblDisDOB.Name = "lblDisDOB";
+ this.lblDisDOB.Size = new System.Drawing.Size(130, 21);
+ this.lblDisDOB.TabIndex = 3;
+ this.lblDisDOB.Text = "Date of Birth:";
+ this.lblDisDOB.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // txtStuID
+ //
+ this.txtStuID.Location = new System.Drawing.Point(342, 88);
+ this.txtStuID.Name = "txtStuID";
+ this.txtStuID.Size = new System.Drawing.Size(132, 20);
+ this.txtStuID.TabIndex = 4;
+ this.txtStuID.TextChanged += new System.EventHandler(this.txtStuID_TextChanged);
+ //
+ // txtlname
+ //
+ this.txtlname.Location = new System.Drawing.Point(342, 109);
+ this.txtlname.Name = "txtlname";
+ this.txtlname.Size = new System.Drawing.Size(132, 20);
+ this.txtlname.TabIndex = 5;
+ //
+ // txtDOB
+ //
+ this.txtDOB.Location = new System.Drawing.Point(342, 130);
+ this.txtDOB.Name = "txtDOB";
+ this.txtDOB.Size = new System.Drawing.Size(132, 20);
+ this.txtDOB.TabIndex = 6;
+ //
+ // btnSearch
+ //
+ this.btnSearch.Location = new System.Drawing.Point(399, 175);
+ this.btnSearch.Name = "btnSearch";
+ this.btnSearch.Size = new System.Drawing.Size(75, 23);
+ this.btnSearch.TabIndex = 7;
+ this.btnSearch.Text = "Search";
+ this.btnSearch.UseVisualStyleBackColor = true;
+ this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
+ //
+ // frmSearch
+ //
+ this.AcceptButton = this.btnSearch;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.ContextMenuStrip = this.contextMenuStrip1;
+ this.Controls.Add(this.btnSearch);
+ this.Controls.Add(this.txtDOB);
+ this.Controls.Add(this.txtlname);
+ this.Controls.Add(this.txtStuID);
+ this.Controls.Add(this.lblDisDOB);
+ this.Controls.Add(this.lblDislname);
+ this.Controls.Add(this.dgvStudents);
+ this.Controls.Add(this.lblDisStID);
+ this.Name = "frmSearch";
+ this.Text = "Form1";
+ this.Load += new System.EventHandler(this.frmSearch_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dgvStudents)).EndInit();
+ this.contextMenuStrip1.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+ }
+
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private System.Windows.Forms.ToolStripMenuItem cmuSearch;
+ private System.Windows.Forms.ToolStripMenuItem cmuEdit;
+ private System.Windows.Forms.ToolStripMenuItem cmuDelete;
+
+ private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
+
+ private System.Windows.Forms.Label lblDislname;
+ private System.Windows.Forms.Label lblDisDOB;
+ private System.Windows.Forms.TextBox txtStuID;
+ private System.Windows.Forms.TextBox txtlname;
+ private System.Windows.Forms.TextBox txtDOB;
+ private System.Windows.Forms.Button btnSearch;
+
+ private System.Windows.Forms.Label lblDisStID;
+ private System.Windows.Forms.DataGridView dgvStudents;
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Database3-submit/Database3/frmSearch.cs b/Database3-submit/Database3/frmSearch.cs
new file mode 100644
index 0000000..e6dc814
--- /dev/null
+++ b/Database3-submit/Database3/frmSearch.cs
@@ -0,0 +1,142 @@
+using System;
+using System.Data;
+using System.Drawing;
+using System.Windows.Forms;
+
+
+
+namespace Database3
+{
+ public partial class frmSearch : Form
+ {
+
+ public static string myID = "";
+
+ public frmSearch()
+ {
+ InitializeComponent();
+
+ dgvStudents.DoubleClick += new EventHandler(dgvStudents_DoubleClick);
+
+ }
+
+ private void dgvStudents_DoubleClick(object sender, EventArgs e)
+ {
+
+ string studentid = "";
+
+ if (dgvStudents.Rows.Count > 0)
+ {
+ DataGridViewRow row = dgvStudents.SelectedRows[0];
+ frmEdit aform = new frmEdit(this);
+
+ studentid = row.Cells[0].Value.ToString().Trim();
+ myID = studentid;
+ aform.ShowDialog();
+
+ }
+
+ }
+
+
+
+ public void btnSearch_Click(object sender, EventArgs e)
+ {
+ string studentid = "9999999999";
+ string lname = "9999999999";
+ DateTime dob = new DateTime();
+
+ ErrorProvider ep1 = new ErrorProvider();
+
+ try
+ {
+ DataSet ds = new DataSet();
+ StudentDataTier stuDT = new StudentDataTier();
+
+
+ studentid = txtStuID.Text;
+ lname = txtlname.Text;
+ try
+ {
+ dob = DateTime.Parse(txtDOB.Text);
+
+ }
+ catch (Exception exception)
+ {
+ ep1.SetError(txtDOB, "Non valid value, but that's ok");
+ }
+
+ if (string.IsNullOrWhiteSpace(txtStuID.Text) &&
+ string.IsNullOrWhiteSpace(txtlname.Text) &&
+ string.IsNullOrWhiteSpace(txtDOB.Text))
+ {
+ throw new Exception("Must Enter at least one value");
+ }
+
+ // Get the dataset using all three search parameters.
+ ds = stuDT.GetStudents(studentid, lname, dob);
+
+ // Check to see if any record is returned.
+ if (ds.Tables[0].Rows.Count > 0) // There is a record.
+ {
+ dgvStudents.Visible = true;
+ // Get data source.
+ dgvStudents.DataSource = ds.Tables[0];
+ dgvStudents.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
+
+ // Set the row and column header styles.
+ dgvStudents.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
+ dgvStudents.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
+ }
+ else
+ {
+ dgvStudents.Visible = false; // Hide the DataGridView if no results are found.
+ MessageBox.Show("No records found.");
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show($"An error occurred: {ex.Message}");
+ }
+ }
+
+ private void frmSearch_Load(object sender, EventArgs e)
+ {
+ dgvStudents.Visible = false;
+ contextMenuStrip1.Items[1].Enabled = false;
+ }
+
+ private void cmuSearch_Click(object sender, EventArgs e)
+ {
+ btnSearch_Click(sender,e);
+ }
+
+ private void txtStuID_TextChanged(object sender, EventArgs e)
+ {
+ cmuSearch.Enabled = txtStuID.Text.Length>0;
+ }
+
+ private void cmuEdit_Click(object sender, EventArgs e)
+ {
+ dgvStudents_DoubleClick(sender, e);
+ }
+
+ private void cmuDelete_Click(object sender, EventArgs e)
+ {
+ string studentid = "";
+
+ DataSet ds = new DataSet();
+ StudentDataTier stuDT = new StudentDataTier();
+
+ DataGridViewRow row = dgvStudents.SelectedRows[0];
+
+ studentid = row.Cells[0].Value.ToString().Trim();
+
+ stuDT.DeleteStudents(studentid);
+
+ btnSearch_Click(sender, e);
+
+ }
+ }
+
+ }
diff --git a/Database3-submit/Database3/frmSearch.resx b/Database3-submit/Database3/frmSearch.resx
new file mode 100644
index 0000000..ad53752
--- /dev/null
+++ b/Database3-submit/Database3/frmSearch.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/Database3-submit/Database3/state.cs b/Database3-submit/Database3/state.cs
new file mode 100644
index 0000000..878ca95
--- /dev/null
+++ b/Database3-submit/Database3/state.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Traffic
+{
+ public class state
+ {
+ private string nameString;
+ private string abbreviationString;
+ ///
+ /// used to display the states in 3 different forms
+ /// Name ("Pennsylvania"), Abbreviation ("PA") ,
+ /// name and abbreviation ("Pennsylvania (PA) ")
+ ///
+ ///
+ ///
+ public state(ref string nameArg, ref string abbreviationArg)
+ {
+ abbreviationString = abbreviationArg;
+ nameString = nameArg;
+ }
+
+ public string Name
+ {
+ get
+ {
+ return nameString;
+ }
+ }
+
+ public string Abbreviation
+ {
+ get
+ {
+ return abbreviationString;
+ }
+ }
+
+ public string FullAndAbbrev
+ {
+ get
+ {
+ return nameString + " (" + abbreviationString + ")";
+ }
+ }
+ }
+}
diff --git a/Database3-submit/stored procs.txt b/Database3-submit/stored procs.txt
new file mode 100644
index 0000000..26e6e0f
--- /dev/null
+++ b/Database3-submit/stored procs.txt
@@ -0,0 +1,86 @@
+CREATE PROCEDURE [dbo].[DELETESTUDENT] (
+ @studentid varchar(6)
+
+)
+AS
+BEGIN
+-- SET NOCOUNT ON added to prevent extra result sets from
+
+SET NOCOUNT ON;
+ DELETE
+ FROM STUDENT
+ WHERE upper(STUDENT_ID) = UPPER( @studentid)
+
+
+
+END
+go
+
+
+
+
+CREATE PROCEDURE [dbo].[GetByStudentIDS] (
+ @studentid varchar(6)
+)
+AS
+BEGIN
+ -- SET NOCOUNT ON added to prevent extra result sets from
+ --updated by CAS 2/13/2023 1:52PM
+ SET NOCOUNT ON;
+
+ SELECT *
+ FROM STUDENT
+ WHERE upper(STUDENT_ID) = upper(@studentid)
+
+END
+go
+
+
+CREATE PROCEDURE [dbo].[UPDATESTUDENTBYID]
+(
+ @student_id varchar(6),
+ @fname varchar (25),
+ @lname varchar(25),
+ @balance decimal(7,2),
+ @gender char(6),
+ @credits decimal(5,2),
+ @state char(2),
+ @DOB date
+)
+
+as
+begin
+
+ update STUDENT
+ set FNAME = @fname,
+ LNAME = @lname,
+ ACCT_BAL = @balance,
+ DOB = @DOB,
+ GENDER = @gender,
+ TOTALCREDITS = @credits,
+ STU_STATE = @state
+ where STUDENT_ID = @student_id
+ end
+go
+
+CREATE PROCEDURE SEARCHSTUDENTS (
+ @fname varchar(6),
+ @lname varchar(25)
+
+)
+AS
+BEGIN
+-- SET NOCOUNT ON added to prevent extra result sets from
+
+SET NOCOUNT ON;
+ --return same # of fields used in datagrid
+ SELECT student_id, fname, lname,HOME_PHONE
+ FROM STUDENT
+ WHERE upper(FNAME) like '%' + upper( @fname ) + '%' or (FNAME = '')
+ or upper(lname) like '%' + upper( @lname ) + '%' or (lname = '')
+
+
+
+END
+go
+
diff --git a/Database3-submit/stored procs.txt.bak b/Database3-submit/stored procs.txt.bak
new file mode 100644
index 0000000..e69de29