diff --git a/.idea/.idea.FWA_MAIN/.idea/dataSources.xml b/.idea/.idea.FWA_MAIN/.idea/dataSources.xml
new file mode 100644
index 0000000..9c698e4
--- /dev/null
+++ b/.idea/.idea.FWA_MAIN/.idea/dataSources.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ sqlserver.jb
+ true
+ true
+ com.jetbrains.jdbc.sqlserver.SqlServerDriver
+ Server=sql.eggtech.net;Database=College2;User Id=admin;Password=delirium-purveyor-overall-backboned-approval-amino;
+ $ProjectFileDir$
+
+
+ sqlserver.jb
+ true
+ true
+ com.jetbrains.jdbc.sqlserver.SqlServerDriver
+ Server=sql.eggtech.net;Database=FinalProjectOfficialPharmacy;User Id=admin;Password=delirium-purveyor-overall-backboned-approval-amino;
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/.idea/config/applicationhost.config b/.idea/config/applicationhost.config
index 15916dc..6aca535 100644
--- a/.idea/config/applicationhost.config
+++ b/.idea/config/applicationhost.config
@@ -155,7 +155,7 @@
-
+
diff --git a/FWA_MAIN/Crypt.cs b/FWA_MAIN/Crypt.cs
index 538a055..c5fe444 100644
--- a/FWA_MAIN/Crypt.cs
+++ b/FWA_MAIN/Crypt.cs
@@ -1,7 +1,77 @@
-namespace FWA_MAIN
+using System;
+using System.Data;
+using System.Data.SqlClient;
+using System.Configuration;
+using System.Web.UI.WebControls;
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+using System.Web;
+
+namespace FWA_MAIN
{
public class Crypt
{
-
+ static private string encryptKey =
+ "CXvA@xsFmBik#E4#7tf4zY7JK^qaTUwFYw^QuC7sipSyBPfkS$qFFU%ZQmRb5GY85unfCmEw@dK7Bhiyt%3asL62yygk6x6D@@D8CUnJfF8@F$C9vtJgGwNhmSxvo#Lh";
+
+ static private string encryptSalt =
+ "gab-purgatory-studio-atlantic-ladle-challenge-slaw-unshaken-eastward-caring-deftly-devious-crudeness-walrus-glorifier-unsteady-sauciness-feminist-jailbreak-upside";
+
+ static public string Encrypt(string cleartext)
+ {
+ byte[] plainText = Encoding.UTF8.GetBytes(cleartext);
+
+ using (RijndaelManaged rijndaelCipher = new RijndaelManaged())
+ {
+ PasswordDeriveBytes secretKey = new PasswordDeriveBytes(Encoding.ASCII.GetBytes(encryptKey),
+ Encoding.ASCII.GetBytes(encryptSalt));
+ using (ICryptoTransform encryptor =
+ rijndaelCipher.CreateEncryptor(secretKey.GetBytes(32), secretKey.GetBytes(16)))
+ {
+ using (MemoryStream memoryStream = new MemoryStream())
+ {
+ using (CryptoStream cryptoStream =
+ new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))
+ {
+ cryptoStream.Write(plainText, 0, plainText.Length);
+ cryptoStream.FlushFinalBlock();
+ string base64 = Convert.ToBase64String(memoryStream.ToArray());
+
+ // Generate a string that won't get screwed up when passed as a query string.
+ string urlEncoded = HttpUtility.UrlEncode(base64);
+ return urlEncoded;
+ }
+ }
+ }
+ }
+ }
+
+ static public string Decrypt(string cleartext)
+ {
+ byte[] encryptedData = Convert.FromBase64String(cleartext);
+ PasswordDeriveBytes secretKey = new PasswordDeriveBytes(Encoding.ASCII.GetBytes(encryptKey),
+ Encoding.ASCII.GetBytes(encryptSalt));
+
+ using (RijndaelManaged rijndaelCipher = new RijndaelManaged())
+ {
+ using (ICryptoTransform decryptor =
+ rijndaelCipher.CreateDecryptor(secretKey.GetBytes(32), secretKey.GetBytes(16)))
+ {
+ using (MemoryStream memoryStream = new MemoryStream(encryptedData))
+ {
+ using (CryptoStream cryptoStream =
+ new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read))
+ {
+ byte[] plainText = new byte[encryptedData.Length];
+ cryptoStream.Read(plainText, 0, plainText.Length);
+ string utf8 = Encoding.UTF8.GetString(plainText);
+ return utf8.Trim('\0');
+ }
+ }
+ }
+ }
+ }
}
}
\ No newline at end of file
diff --git a/FWA_MAIN/FWA_MAIN.csproj b/FWA_MAIN/FWA_MAIN.csproj
index 8d4c557..9682d3b 100644
--- a/FWA_MAIN/FWA_MAIN.csproj
+++ b/FWA_MAIN/FWA_MAIN.csproj
@@ -207,6 +207,7 @@
Default.aspx
+
diff --git a/FWA_MAIN/PharmactDataTier.cs b/FWA_MAIN/PharmactDataTier.cs
index 90a3087..76e6464 100644
--- a/FWA_MAIN/PharmactDataTier.cs
+++ b/FWA_MAIN/PharmactDataTier.cs
@@ -831,7 +831,7 @@ namespace FWA_MAIN
}
- public static double GetNextPatientID()
+ public static string GetNextPatientID()
{
try
{
@@ -845,7 +845,6 @@ namespace FWA_MAIN
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "GetNextPatientID";
// Define input parameter
- cmdString.Parameters.Add("@TableName", SqlDbType.NVarChar, 128).Value = "PATIENT";
object result = cmdString.ExecuteScalar();
double value = 0;
@@ -858,10 +857,16 @@ namespace FWA_MAIN
{
// MessageBox.Show("Error Getting next Patient ID","ERROR",MessageBoxButtons.OK);
}
-
+
+ string stringval = value.ToString();
+
+ while (stringval.Length < 8)
+ {
+ stringval = "0" + stringval;
+ }
// return dataSet
- return value;
+ return stringval;
}
catch (Exception ex)
{
diff --git a/FWA_MAIN/Val.cs b/FWA_MAIN/Val.cs
new file mode 100644
index 0000000..80d9d8f
--- /dev/null
+++ b/FWA_MAIN/Val.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Web.UI.WebControls;
+
+namespace FWA_MAIN
+{
+ public class Val
+ {
+
+ public static string varchar(TextBox box, int length)
+ {
+
+ if (box.Text.Length <= length)
+ {
+ return box.Text.Trim();
+ }
+ else
+ {
+ return "";
+ }
+
+ }
+
+ public static int IntType(TextBox box)
+ {
+
+ return int.Parse(box.Text.Trim());
+
+ }
+
+ public static short SmallIntType(TextBox box)
+ {
+ try
+ {
+
+ if (box.Text.Length > 0)
+ {
+ if (double.Parse(box.Text) < 65535 && double.Parse(box.Text) >= 0)
+ {
+ return short.Parse(box.Text.Trim());
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ catch (Exception e)
+ {
+ return 0;
+ }
+ }
+
+ public static DateTime Date(TextBox box)
+ {
+ try
+ {
+
+ DateTime date = DateTime.Parse(box.Text.Trim());
+
+ return date;
+
+ }
+ catch (Exception e)
+ {
+ return new DateTime(3000, 1, 1);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/FWA_MAIN/bin/FWA_MAIN.dll b/FWA_MAIN/bin/FWA_MAIN.dll
index 3ba6e6e..970dbd1 100644
Binary files a/FWA_MAIN/bin/FWA_MAIN.dll and b/FWA_MAIN/bin/FWA_MAIN.dll differ
diff --git a/FWA_MAIN/bin/FWA_MAIN.pdb b/FWA_MAIN/bin/FWA_MAIN.pdb
index 84a6245..c01e1c1 100644
Binary files a/FWA_MAIN/bin/FWA_MAIN.pdb and b/FWA_MAIN/bin/FWA_MAIN.pdb differ
diff --git a/FWA_MAIN/main.css b/FWA_MAIN/main.css
index 5edf0b0..4a4e123 100644
--- a/FWA_MAIN/main.css
+++ b/FWA_MAIN/main.css
@@ -114,7 +114,7 @@
font-size: 16px;
color: white;
/*border: 2px solid #0056b3;*/
-
+
}
diff --git a/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.AssemblyReference.cache b/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.AssemblyReference.cache
index 3bde82b..2ae3ac5 100644
Binary files a/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.AssemblyReference.cache and b/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.AssemblyReference.cache differ
diff --git a/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.CoreCompileInputs.cache b/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.CoreCompileInputs.cache
index 4c3eb63..2e69a80 100644
--- a/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.CoreCompileInputs.cache
+++ b/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-7074ecee9fd5e988b38acde16901b0d6290276e5479ece72dfea267de554eaeb
+e89e31cdadf20fe7db48ef132bf217873437f194debfb0966ea84327b2ae8615
diff --git a/FWA_MAIN/obj/Debug/FWA_MAIN.dll b/FWA_MAIN/obj/Debug/FWA_MAIN.dll
index 3ba6e6e..970dbd1 100644
Binary files a/FWA_MAIN/obj/Debug/FWA_MAIN.dll and b/FWA_MAIN/obj/Debug/FWA_MAIN.dll differ
diff --git a/FWA_MAIN/obj/Debug/FWA_MAIN.pdb b/FWA_MAIN/obj/Debug/FWA_MAIN.pdb
index 84a6245..c01e1c1 100644
Binary files a/FWA_MAIN/obj/Debug/FWA_MAIN.pdb and b/FWA_MAIN/obj/Debug/FWA_MAIN.pdb differ
diff --git a/FWA_MAIN/patEdit.aspx b/FWA_MAIN/patEdit.aspx
index f3eee35..9e8766b 100644
--- a/FWA_MAIN/patEdit.aspx
+++ b/FWA_MAIN/patEdit.aspx
@@ -47,7 +47,7 @@
\ No newline at end of file
diff --git a/FWA_MAIN/patEdit.aspx.cs b/FWA_MAIN/patEdit.aspx.cs
index 140477a..93a4b9b 100644
--- a/FWA_MAIN/patEdit.aspx.cs
+++ b/FWA_MAIN/patEdit.aspx.cs
@@ -1,18 +1,78 @@
using System;
using System.Web.UI;
+using System.Data;
namespace FWA_MAIN
{
public partial class patEdit : Page
{
+
+ protected string patID;
+
protected void Page_Load(object sender, EventArgs e)
{
+
+ patID = Crypt.Decrypt(Request.QueryString["ID"]);
+
+ txtPatID.Enabled = false;
+ if (!IsPostBack)
+ {
+
+ FillPatient(patID);
+ }
+
+ }
+
+ protected void FillPatient(string id)
+ {
+
+ var ds = new DataSet();
+ ds = PharmacyDataTier.PatientInfoSearch(patID);
+
+ txtPatID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString();
+ txtFNAME.Text = ds.Tables[0].Rows[0]["FirstName"].ToString();
+ txtLNAME.Text = ds.Tables[0].Rows[0]["LastName"].ToString();
+ txtMidInit.Text = ds.Tables[0].Rows[0]["MiddleIntials"].ToString();
+ txtWeight.Text = ds.Tables[0].Rows[0]["lbs"].ToString();
+ txtHeightFt.Text = ds.Tables[0].Rows[0]["Height_feet"].ToString();
+ txtHeightIn.Text = ds.Tables[0].Rows[0]["Height_inches"].ToString();
+ DateTime date = DateTime.Parse(ds.Tables[0].Rows[0]["DOB"].ToString());
+ txtDOB.Text = date.ToString("d");
+ txtGender.Text = ds.Tables[0].Rows[0]["Gender"].ToString();
+ txtCity.Text = ds.Tables[0].Rows[0]["City"].ToString();
+ txtZip.Text = ds.Tables[0].Rows[0]["Zip"].ToString();
+ txtState.Text = ds.Tables[0].Rows[0]["UsState"].ToString();
+ txtPhoneNum.Text = ds.Tables[0].Rows[0]["PhoneNumber"].ToString();
+
}
protected void btnCancelPat_OnClick(object sender, EventArgs e)
{
- Response.Redirect("patient.aspx");
+ Response.Redirect("patSearch.aspx");
+ }
+
+ protected void btnSavePat_OnClick(object sender, EventArgs e)
+ {
+
+ string id = Val.varchar(txtPatID, 8);
+ string FNAME = Val.varchar(txtFNAME, 30);
+ string LNAME = Val.varchar(txtLNAME, 30);
+ string MidInit = Val.varchar(txtMidInit, 1);
+ int Weight = Val.IntType(txtWeight);
+ int HeightFt = Val.IntType(txtHeightFt);
+ int HeightIn = Val.IntType(txtHeightIn);
+ DateTime date = Val.Date(txtDOB);
+ string gender = Val.varchar(txtGender, 1);
+ string city = Val.varchar(txtCity, 30);
+ short zip = Val.SmallIntType(txtZip);
+ string state = Val.varchar(txtState, 2);
+ string phone = Val.varchar(txtPhoneNum, 14);
+
+ PharmacyDataTier.UpdatePatient(id,FNAME,LNAME,MidInit,Weight,HeightFt,HeightIn,date,gender,city,zip,state,phone);
+
+ Response.Redirect("patSearch.aspx");
+
}
}
}
\ No newline at end of file
diff --git a/FWA_MAIN/patSearch.aspx b/FWA_MAIN/patSearch.aspx
index 5311a69..bd6f00f 100644
--- a/FWA_MAIN/patSearch.aspx
+++ b/FWA_MAIN/patSearch.aspx
@@ -79,14 +79,14 @@