diff --git a/FWA_MAIN/MediSearch.aspx.cs b/FWA_MAIN/MediSearch.aspx.cs index 05b535c..50d044e 100644 --- a/FWA_MAIN/MediSearch.aspx.cs +++ b/FWA_MAIN/MediSearch.aspx.cs @@ -129,7 +129,32 @@ namespace FWA_MAIN protected void btnMedNew_OnClick(object sender, EventArgs e) { - throw new NotImplementedException(); + string medicationID; + + try + { + Session["vMedID"] = txtMedID.Text.Trim(); + Session["vMedName"] = txtMedName.Text.Trim(); + Session["vRxNum"] = txtRxNum.Text.Trim(); + + // Use the patientID value as needed + try + { + + medicationID = PharmacyDataTier.GetNextPatientID(); + medicationID = Crypt.Encrypt(medicationID); + Response.Redirect("medNew.aspx" + "?" + "ID=" + medicationID, false); + } + catch (Exception exception) + { + } + + + } + catch (Exception ex) + { + throw new Exception(ex.Message, ex.InnerException); + } } protected void bntMedEdit_OnClick(object sender, EventArgs e) diff --git a/FWA_MAIN/bin/FWA_MAIN.dll b/FWA_MAIN/bin/FWA_MAIN.dll index 3d47163..38b05c9 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 6879472..a7808ab 100644 Binary files a/FWA_MAIN/bin/FWA_MAIN.pdb and b/FWA_MAIN/bin/FWA_MAIN.pdb differ diff --git a/FWA_MAIN/medNew.aspx b/FWA_MAIN/medNew.aspx index 371452c..24f797c 100644 --- a/FWA_MAIN/medNew.aspx +++ b/FWA_MAIN/medNew.aspx @@ -1,7 +1,17 @@ <%@ Page Title="New Medication" Language="C#" MasterPageFile="main.master" CodeBehind="medNew.aspx.cs" Inherits="FWA_MAIN.medNew" %> - + +

New Medication

@@ -11,7 +21,6 @@
-
@@ -22,7 +31,7 @@
-
+
@@ -35,7 +44,7 @@

-
-
+
+
\ No newline at end of file diff --git a/FWA_MAIN/medNew.aspx.cs b/FWA_MAIN/medNew.aspx.cs index 7df47ba..6734f13 100644 --- a/FWA_MAIN/medNew.aspx.cs +++ b/FWA_MAIN/medNew.aspx.cs @@ -5,14 +5,34 @@ namespace FWA_MAIN { public partial class medNew : Page { + protected string medID; protected void Page_Load(object sender, EventArgs e) { + medID = Crypt.Decrypt(Request.QueryString["ID"]); + txtMedID.Enabled = false; + txtMedID.Text = medID; } - protected void btnCancelPat_OnClick(object sender, EventArgs e) + protected void btnCancelMed_OnClick(object sender, EventArgs e) { - throw new NotImplementedException(); + Response.Redirect("MediSearch.aspx"); + } + + protected void btnSaveMed_OnClick(object sender, EventArgs e) + { + string id = Val.varchar(txtMedID, 7); + string medName = Val.varchar(txtMedName, 60); + string intake = Val.varchar(txtIntake, 30); + + string frequency = Val.varchar(txtFrequency, length:30); + string dosage = Val.varchar(txtDosage, length:30); + string purpose = Val.varchar(txtPurpose, length:100); + string rxNum = Val.varchar(txtRxNum, 30); + + + PharmacyDataTier.CreateMedication(id, medName, intake,frequency, dosage, purpose, rxNum); + Response.Redirect("mediSearch.aspx"); } } } \ No newline at end of file diff --git a/FWA_MAIN/medNew.aspx.designer.cs b/FWA_MAIN/medNew.aspx.designer.cs index 0963c38..d862f8e 100644 --- a/FWA_MAIN/medNew.aspx.designer.cs +++ b/FWA_MAIN/medNew.aspx.designer.cs @@ -41,15 +41,6 @@ namespace FWA_MAIN /// protected global::System.Web.UI.WebControls.TextBox txtIntake; - /// - /// txtPatID control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtPatID; - /// /// txtFrequency control. /// @@ -87,22 +78,22 @@ namespace FWA_MAIN protected global::System.Web.UI.WebControls.TextBox txtRxNum; /// - /// btnSavePat control. + /// btnSaveMed control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Button btnSavePat; + protected global::System.Web.UI.WebControls.Button btnSaveMed; /// - /// btnCancelPat control. + /// btnCancelMed control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Button btnCancelPat; + protected global::System.Web.UI.WebControls.Button btnCancelMed; /// /// Master property. diff --git a/FWA_MAIN/obj/Debug/FWA_MAIN.dll b/FWA_MAIN/obj/Debug/FWA_MAIN.dll index 3d47163..38b05c9 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 6879472..a7808ab 100644 Binary files a/FWA_MAIN/obj/Debug/FWA_MAIN.pdb and b/FWA_MAIN/obj/Debug/FWA_MAIN.pdb differ