Compare commits
No commits in common. "7eb71dd6c9c17af9263eb14d6b5019ea7fcbf065" and "3b6d1bee4db25dd51aba9b8593086e92d34db74b" have entirely different histories.
7eb71dd6c9
...
3b6d1bee4d
1
.idea/.idea.CNSA-212-Personal-CAS/.idea/.name
Normal file
1
.idea/.idea.CNSA-212-Personal-CAS/.idea/.name
Normal file
@ -0,0 +1 @@
|
|||||||
|
CNSA-212-Personal-CAS
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="SqlDialectMappings">
|
|
||||||
<file url="PROJECT" dialect="GenericSQL" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
BIN
Chapter6.zip
Normal file
BIN
Chapter6.zip
Normal file
Binary file not shown.
Binary file not shown.
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<startup>
|
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
|
|
||||||
</startup>
|
|
||||||
<connectionStrings>
|
|
||||||
<add name="ConnString" connectionString="Data Source=home.eggtech.net;Initial Catalog=college2; connect timeout=30; integrated security=false; User ID=admin;Password=delirium-purveyor-overall-backboned-approval-amino;" providerName="System.Data.SqlClient" />
|
|
||||||
</connectionStrings>
|
|
||||||
|
|
||||||
</configuration>
|
|
@ -1,99 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{E10AB02F-374E-4252-B833-9963091D4B05}</ProjectGuid>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<RootNamespace>Database3</RootNamespace>
|
|
||||||
<AssemblyName>Database3</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
|
||||||
<Deterministic>true</Deterministic>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System"/>
|
|
||||||
<Reference Include="System.Configuration" />
|
|
||||||
<Reference Include="System.Core"/>
|
|
||||||
<Reference Include="System.Xml.Linq"/>
|
|
||||||
<Reference Include="System.Data.DataSetExtensions"/>
|
|
||||||
<Reference Include="Microsoft.CSharp"/>
|
|
||||||
<Reference Include="System.Data"/>
|
|
||||||
<Reference Include="System.Deployment"/>
|
|
||||||
<Reference Include="System.Drawing"/>
|
|
||||||
<Reference Include="System.Net.Http"/>
|
|
||||||
<Reference Include="System.Windows.Forms"/>
|
|
||||||
<Reference Include="System.Xml"/>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="frmEdit.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="frmEdit.Designer.cs">
|
|
||||||
<DependentUpon>frmEdit.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="frmSearch.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="frmSearch.Designer.cs">
|
|
||||||
<DependentUpon>frmSearch.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Program.cs"/>
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
|
||||||
<Compile Include="state.cs" />
|
|
||||||
<Compile Include="StateManager.cs" />
|
|
||||||
<Compile Include="StudentDataTier.cs" />
|
|
||||||
<EmbeddedResource Include="frmEdit.resx">
|
|
||||||
<DependentUpon>frmEdit.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="frmSearch.resx">
|
|
||||||
<DependentUpon>frmSearch.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<None Include="Properties\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<Compile Include="Properties\Settings.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config"/>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="State.xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
|
||||||
</Project>
|
|
@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Database3
|
|
||||||
{
|
|
||||||
static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
Application.EnableVisualStyles();
|
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
|
||||||
Application.Run(new frmSearch());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
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")]
|
|
@ -1,69 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 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.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Database3.Properties
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
|
||||||
/// </summary>
|
|
||||||
// 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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the cached ResourceManager instance used by this class.
|
|
||||||
/// </summary>
|
|
||||||
[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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Overrides the current thread's CurrentUICulture property for all
|
|
||||||
/// resource lookups using this strongly typed resource class.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState
|
|
||||||
.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture
|
|
||||||
{
|
|
||||||
get { return resourceCulture; }
|
|
||||||
set { resourceCulture = value; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,117 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,26 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 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.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
|
||||||
<Profiles>
|
|
||||||
<Profile Name="(Default)" />
|
|
||||||
</Profiles>
|
|
||||||
<Settings />
|
|
||||||
</SettingsFile>
|
|
@ -1,55 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<states>
|
|
||||||
<state name="Alabama" abbreviation="AL" />
|
|
||||||
<state name="Alaska" abbreviation="AK" />
|
|
||||||
<state name="Arizona" abbreviation="AZ" />
|
|
||||||
<state name="Arkansas" abbreviation="AR" />
|
|
||||||
<state name="California" abbreviation="CA" />
|
|
||||||
<state name="Colorado" abbreviation="CO" />
|
|
||||||
<state name="Connecticut" abbreviation="CT" />
|
|
||||||
<state name="Delaware" abbreviation="DE" />
|
|
||||||
<!--
|
|
||||||
<state name="District of Columbia" abbreviation="DC" />
|
|
||||||
-->
|
|
||||||
<state name="Florida" abbreviation="FL" />
|
|
||||||
<state name="Georgia" abbreviation="GA" />
|
|
||||||
<state name="Hawaii" abbreviation="HI" />
|
|
||||||
<state name="Idaho" abbreviation="ID" />
|
|
||||||
<state name="Illinois" abbreviation="IL" />
|
|
||||||
<state name="Iowa" abbreviation="IA" />
|
|
||||||
<state name="Kansas" abbreviation="KS" />
|
|
||||||
<state name="Kentucky" abbreviation="KY" />
|
|
||||||
<state name="Louisiana" abbreviation="LA" />
|
|
||||||
<state name="Maine" abbreviation="ME" />
|
|
||||||
<state name="Maryland" abbreviation="MD" />
|
|
||||||
<state name="Massachussetts" abbreviation="MA" />
|
|
||||||
<state name="Michigan" abbreviation="MI" />
|
|
||||||
<state name="Minnesota" abbreviation="MN" />
|
|
||||||
<state name="Mississippi" abbreviation="MS" />
|
|
||||||
<state name="Missouri" abbreviation="MO" />
|
|
||||||
<state name="Montana" abbreviation="MT" />
|
|
||||||
<state name="Nebraska" abbreviation="NE" />
|
|
||||||
<state name="Nevada" abbreviation="NV" />
|
|
||||||
<state name="New Hampshire" abbreviation="NH" />
|
|
||||||
<state name="New Jersey" abbreviation="NJ" />
|
|
||||||
<state name="New Mexico" abbreviation="NM" />
|
|
||||||
<state name="New York" abbreviation="NY" />
|
|
||||||
<state name="North Carolina" abbreviation="NC" />
|
|
||||||
<state name="North Dakota" abbreviation="ND" />
|
|
||||||
<state name="Ohio" abbreviation="OH" />
|
|
||||||
<state name="Oklahoma" abbreviation="OK" />
|
|
||||||
<state name="Oregon" abbreviation="OR" />
|
|
||||||
<state name="Pennsylvania" abbreviation="PA" />
|
|
||||||
<state name="Rhode Island" abbreviation="RI" />
|
|
||||||
<state name="South Carolina" abbreviation="SC" />
|
|
||||||
<state name="South Dakota" abbreviation="SD" />
|
|
||||||
<state name="Tennessee" abbreviation="TN" />
|
|
||||||
<state name="Texas" abbreviation="TX" />
|
|
||||||
<state name="Utah" abbreviation="UT" />
|
|
||||||
<state name="Vermont" abbreviation="VT" />
|
|
||||||
<state name="Virginia" abbreviation="VA" />
|
|
||||||
<state name="Washington" abbreviation="WA" />
|
|
||||||
<state name="West Virgina" abbreviation="WV" />
|
|
||||||
<state name="Wisconsin" abbreviation="WI" />
|
|
||||||
<state name="Wyoming" abbreviation="WY" />
|
|
||||||
</states>
|
|
@ -1,208 +0,0 @@
|
|||||||
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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
|
|
||||||
/// ''' Provides the functionality related to retrieving the list
|
|
||||||
|
|
||||||
/// ''' of states for a system;
|
|
||||||
//// reads an xml file
|
|
||||||
/// ''' </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ''' Gets all the states
|
|
||||||
/// ''' </summary>
|
|
||||||
/// ''' <returns>An array of State objects</returns>
|
|
||||||
public static state[] getStates()
|
|
||||||
{
|
|
||||||
//if (myCache[stateKey] == null)
|
|
||||||
PopulateCache();
|
|
||||||
return stateArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ''' Takes the abbreviation given and returns the full name
|
|
||||||
/// ''' </summary>
|
|
||||||
/// ''' <returns>The full name for the abbreviation in
|
|
||||||
/// ''' question</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ''' Gets the state object based on the full name
|
|
||||||
/// ''' </summary>
|
|
||||||
/// ''' <param name="name">The full name of the state to
|
|
||||||
/// ''' retrieve</param>
|
|
||||||
/// ''' <returns>A State object for the name given</returns>
|
|
||||||
public static state getStateByName(ref string name)
|
|
||||||
{
|
|
||||||
// if (myCache[stateKey + name] == null)
|
|
||||||
PopulateCache();
|
|
||||||
//return state[stateKey + name];
|
|
||||||
|
|
||||||
return (state)Convert.ChangeType(stateKey, typeof(state[]));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ''' Gets the state object based on the abbreviation
|
|
||||||
/// ''' </summary>
|
|
||||||
/// ''' <param name="abbreviation">The abbreviation of the state
|
|
||||||
/// ''' to retrieve</param>
|
|
||||||
/// ''' <returns>A State object for the abbreviation
|
|
||||||
/// ''' given</returns>
|
|
||||||
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 */;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>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.
|
|
||||||
/// ''' </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,168 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
245
Database3-submit/Database3/frmEdit.Designer.cs
generated
245
Database3-submit/Database3/frmEdit.Designer.cs
generated
@ -1,245 +0,0 @@
|
|||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace Database3
|
|
||||||
{
|
|
||||||
partial class frmEdit
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,122 +0,0 @@
|
|||||||
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
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
194
Database3-submit/Database3/frmSearch.Designer.cs
generated
194
Database3-submit/Database3/frmSearch.Designer.cs
generated
@ -1,194 +0,0 @@
|
|||||||
namespace Database3
|
|
||||||
{
|
|
||||||
partial class frmSearch
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,142 +0,0 @@
|
|||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,123 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,50 +0,0 @@
|
|||||||
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;
|
|
||||||
/// <summary>
|
|
||||||
/// used to display the states in 3 different forms
|
|
||||||
/// Name ("Pennsylvania"), Abbreviation ("PA") ,
|
|
||||||
/// name and abbreviation ("Pennsylvania (PA) ")
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="nameArg"></param>
|
|
||||||
/// <param name="abbreviationArg"></param>
|
|
||||||
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 + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
BIN
Database3.zip
BIN
Database3.zip
Binary file not shown.
@ -61,12 +61,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Program.cs"/>
|
<Compile Include="Program.cs"/>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||||
<Compile Include="state.cs" />
|
|
||||||
<Compile Include="StateManager.cs" />
|
|
||||||
<Compile Include="StudentDataTier.cs" />
|
<Compile Include="StudentDataTier.cs" />
|
||||||
<EmbeddedResource Include="frmEdit.resx">
|
|
||||||
<DependentUpon>frmEdit.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="frmSearch.resx">
|
<EmbeddedResource Include="frmSearch.resx">
|
||||||
<DependentUpon>frmSearch.cs</DependentUpon>
|
<DependentUpon>frmSearch.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
@ -92,8 +87,5 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config"/>
|
<None Include="App.config"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="State.xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||||
</Project>
|
</Project>
|
@ -1,55 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<states>
|
|
||||||
<state name="Alabama" abbreviation="AL" />
|
|
||||||
<state name="Alaska" abbreviation="AK" />
|
|
||||||
<state name="Arizona" abbreviation="AZ" />
|
|
||||||
<state name="Arkansas" abbreviation="AR" />
|
|
||||||
<state name="California" abbreviation="CA" />
|
|
||||||
<state name="Colorado" abbreviation="CO" />
|
|
||||||
<state name="Connecticut" abbreviation="CT" />
|
|
||||||
<state name="Delaware" abbreviation="DE" />
|
|
||||||
<!--
|
|
||||||
<state name="District of Columbia" abbreviation="DC" />
|
|
||||||
-->
|
|
||||||
<state name="Florida" abbreviation="FL" />
|
|
||||||
<state name="Georgia" abbreviation="GA" />
|
|
||||||
<state name="Hawaii" abbreviation="HI" />
|
|
||||||
<state name="Idaho" abbreviation="ID" />
|
|
||||||
<state name="Illinois" abbreviation="IL" />
|
|
||||||
<state name="Iowa" abbreviation="IA" />
|
|
||||||
<state name="Kansas" abbreviation="KS" />
|
|
||||||
<state name="Kentucky" abbreviation="KY" />
|
|
||||||
<state name="Louisiana" abbreviation="LA" />
|
|
||||||
<state name="Maine" abbreviation="ME" />
|
|
||||||
<state name="Maryland" abbreviation="MD" />
|
|
||||||
<state name="Massachussetts" abbreviation="MA" />
|
|
||||||
<state name="Michigan" abbreviation="MI" />
|
|
||||||
<state name="Minnesota" abbreviation="MN" />
|
|
||||||
<state name="Mississippi" abbreviation="MS" />
|
|
||||||
<state name="Missouri" abbreviation="MO" />
|
|
||||||
<state name="Montana" abbreviation="MT" />
|
|
||||||
<state name="Nebraska" abbreviation="NE" />
|
|
||||||
<state name="Nevada" abbreviation="NV" />
|
|
||||||
<state name="New Hampshire" abbreviation="NH" />
|
|
||||||
<state name="New Jersey" abbreviation="NJ" />
|
|
||||||
<state name="New Mexico" abbreviation="NM" />
|
|
||||||
<state name="New York" abbreviation="NY" />
|
|
||||||
<state name="North Carolina" abbreviation="NC" />
|
|
||||||
<state name="North Dakota" abbreviation="ND" />
|
|
||||||
<state name="Ohio" abbreviation="OH" />
|
|
||||||
<state name="Oklahoma" abbreviation="OK" />
|
|
||||||
<state name="Oregon" abbreviation="OR" />
|
|
||||||
<state name="Pennsylvania" abbreviation="PA" />
|
|
||||||
<state name="Rhode Island" abbreviation="RI" />
|
|
||||||
<state name="South Carolina" abbreviation="SC" />
|
|
||||||
<state name="South Dakota" abbreviation="SD" />
|
|
||||||
<state name="Tennessee" abbreviation="TN" />
|
|
||||||
<state name="Texas" abbreviation="TX" />
|
|
||||||
<state name="Utah" abbreviation="UT" />
|
|
||||||
<state name="Vermont" abbreviation="VT" />
|
|
||||||
<state name="Virginia" abbreviation="VA" />
|
|
||||||
<state name="Washington" abbreviation="WA" />
|
|
||||||
<state name="West Virgina" abbreviation="WV" />
|
|
||||||
<state name="Wisconsin" abbreviation="WI" />
|
|
||||||
<state name="Wyoming" abbreviation="WY" />
|
|
||||||
</states>
|
|
@ -1,208 +0,0 @@
|
|||||||
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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
|
|
||||||
/// ''' Provides the functionality related to retrieving the list
|
|
||||||
|
|
||||||
/// ''' of states for a system;
|
|
||||||
//// reads an xml file
|
|
||||||
/// ''' </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ''' Gets all the states
|
|
||||||
/// ''' </summary>
|
|
||||||
/// ''' <returns>An array of State objects</returns>
|
|
||||||
public static state[] getStates()
|
|
||||||
{
|
|
||||||
//if (myCache[stateKey] == null)
|
|
||||||
PopulateCache();
|
|
||||||
return stateArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ''' Takes the abbreviation given and returns the full name
|
|
||||||
/// ''' </summary>
|
|
||||||
/// ''' <returns>The full name for the abbreviation in
|
|
||||||
/// ''' question</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ''' Gets the state object based on the full name
|
|
||||||
/// ''' </summary>
|
|
||||||
/// ''' <param name="name">The full name of the state to
|
|
||||||
/// ''' retrieve</param>
|
|
||||||
/// ''' <returns>A State object for the name given</returns>
|
|
||||||
public static state getStateByName(ref string name)
|
|
||||||
{
|
|
||||||
// if (myCache[stateKey + name] == null)
|
|
||||||
PopulateCache();
|
|
||||||
//return state[stateKey + name];
|
|
||||||
|
|
||||||
return (state)Convert.ChangeType(stateKey, typeof(state[]));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ''' Gets the state object based on the abbreviation
|
|
||||||
/// ''' </summary>
|
|
||||||
/// ''' <param name="abbreviation">The abbreviation of the state
|
|
||||||
/// ''' to retrieve</param>
|
|
||||||
/// ''' <returns>A State object for the abbreviation
|
|
||||||
/// ''' given</returns>
|
|
||||||
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 */;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>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.
|
|
||||||
/// ''' </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -56,112 +56,7 @@ namespace Database3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
205
Database3/frmEdit.Designer.cs
generated
205
Database3/frmEdit.Designer.cs
generated
@ -31,215 +31,12 @@ namespace Database3
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.lblDisStuID = new System.Windows.Forms.Label();
|
this.components = new System.ComponentModel.Container();
|
||||||
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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
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.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
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,122 +1,12 @@
|
|||||||
using System;
|
using System.Windows.Forms;
|
||||||
using System.Data;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using Traffic;
|
|
||||||
|
|
||||||
namespace Database3
|
namespace Database3
|
||||||
{
|
{
|
||||||
public partial class frmEdit : Form
|
public partial class frmEdit : Form
|
||||||
{
|
{
|
||||||
|
public frmEdit()
|
||||||
private frmSearch forminstance;
|
|
||||||
public frmEdit(frmSearch there)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
52
Database3/frmSearch.Designer.cs
generated
52
Database3/frmSearch.Designer.cs
generated
@ -29,14 +29,8 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
this.lblDisStID = new System.Windows.Forms.Label();
|
this.lblDisStID = new System.Windows.Forms.Label();
|
||||||
this.dgvStudents = new System.Windows.Forms.DataGridView();
|
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.lblDislname = new System.Windows.Forms.Label();
|
||||||
this.lblDisDOB = new System.Windows.Forms.Label();
|
this.lblDisDOB = new System.Windows.Forms.Label();
|
||||||
this.txtStuID = new System.Windows.Forms.TextBox();
|
this.txtStuID = new System.Windows.Forms.TextBox();
|
||||||
@ -44,7 +38,6 @@
|
|||||||
this.txtDOB = new System.Windows.Forms.TextBox();
|
this.txtDOB = new System.Windows.Forms.TextBox();
|
||||||
this.btnSearch = new System.Windows.Forms.Button();
|
this.btnSearch = new System.Windows.Forms.Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dgvStudents)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dgvStudents)).BeginInit();
|
||||||
this.contextMenuStrip1.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// lblDisStID
|
// lblDisStID
|
||||||
@ -59,45 +52,11 @@
|
|||||||
// dgvStudents
|
// dgvStudents
|
||||||
//
|
//
|
||||||
this.dgvStudents.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.dgvStudents.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dgvStudents.ContextMenuStrip = this.contextMenuStrip1;
|
|
||||||
this.dgvStudents.Location = new System.Drawing.Point(77, 250);
|
this.dgvStudents.Location = new System.Drawing.Point(77, 250);
|
||||||
this.dgvStudents.Name = "dgvStudents";
|
this.dgvStudents.Name = "dgvStudents";
|
||||||
this.dgvStudents.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
this.dgvStudents.Size = new System.Drawing.Size(638, 150);
|
this.dgvStudents.Size = new System.Drawing.Size(638, 150);
|
||||||
this.dgvStudents.TabIndex = 1;
|
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
|
// lblDislname
|
||||||
//
|
//
|
||||||
this.lblDislname.Location = new System.Drawing.Point(206, 108);
|
this.lblDislname.Location = new System.Drawing.Point(206, 108);
|
||||||
@ -122,7 +81,6 @@
|
|||||||
this.txtStuID.Name = "txtStuID";
|
this.txtStuID.Name = "txtStuID";
|
||||||
this.txtStuID.Size = new System.Drawing.Size(132, 20);
|
this.txtStuID.Size = new System.Drawing.Size(132, 20);
|
||||||
this.txtStuID.TabIndex = 4;
|
this.txtStuID.TabIndex = 4;
|
||||||
this.txtStuID.TextChanged += new System.EventHandler(this.txtStuID_TextChanged);
|
|
||||||
//
|
//
|
||||||
// txtlname
|
// txtlname
|
||||||
//
|
//
|
||||||
@ -154,7 +112,6 @@
|
|||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
this.ContextMenuStrip = this.contextMenuStrip1;
|
|
||||||
this.Controls.Add(this.btnSearch);
|
this.Controls.Add(this.btnSearch);
|
||||||
this.Controls.Add(this.txtDOB);
|
this.Controls.Add(this.txtDOB);
|
||||||
this.Controls.Add(this.txtlname);
|
this.Controls.Add(this.txtlname);
|
||||||
@ -165,20 +122,11 @@
|
|||||||
this.Controls.Add(this.lblDisStID);
|
this.Controls.Add(this.lblDisStID);
|
||||||
this.Name = "frmSearch";
|
this.Name = "frmSearch";
|
||||||
this.Text = "Form1";
|
this.Text = "Form1";
|
||||||
this.Load += new System.EventHandler(this.frmSearch_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dgvStudents)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dgvStudents)).EndInit();
|
||||||
this.contextMenuStrip1.ResumeLayout(false);
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
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 lblDislname;
|
||||||
private System.Windows.Forms.Label lblDisDOB;
|
private System.Windows.Forms.Label lblDisDOB;
|
||||||
private System.Windows.Forms.TextBox txtStuID;
|
private System.Windows.Forms.TextBox txtStuID;
|
||||||
|
@ -9,38 +9,12 @@ namespace Database3
|
|||||||
{
|
{
|
||||||
public partial class frmSearch : Form
|
public partial class frmSearch : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
public static string myID = "";
|
|
||||||
|
|
||||||
public frmSearch()
|
public frmSearch()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
dgvStudents.DoubleClick += new EventHandler(dgvStudents_DoubleClick);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dgvStudents_DoubleClick(object sender, EventArgs e)
|
private void btnSearch_Click(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 studentid = "9999999999";
|
||||||
string lname = "9999999999";
|
string lname = "9999999999";
|
||||||
@ -99,44 +73,6 @@ namespace Database3
|
|||||||
MessageBox.Show($"An error occurred: {ex.Message}");
|
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,4 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
</root>
|
@ -1,50 +0,0 @@
|
|||||||
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;
|
|
||||||
/// <summary>
|
|
||||||
/// used to display the states in 3 different forms
|
|
||||||
/// Name ("Pennsylvania"), Abbreviation ("PA") ,
|
|
||||||
/// name and abbreviation ("Pennsylvania (PA) ")
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="nameArg"></param>
|
|
||||||
/// <param name="abbreviationArg"></param>
|
|
||||||
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 + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user