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/FWA_MAIN.csproj b/FWA_MAIN/FWA_MAIN.csproj index d8c8b0a..741c9f5 100644 --- a/FWA_MAIN/FWA_MAIN.csproj +++ b/FWA_MAIN/FWA_MAIN.csproj @@ -203,6 +203,20 @@ Prescription.aspx + + ASPXCodeBehind + RefEdit.aspx + + + RefEdit.aspx + + + ASPXCodeBehind + Refills.aspx + + + Refills.aspx + ASPXCodeBehind testpage.aspx @@ -239,6 +253,8 @@ + + diff --git a/FWA_MAIN/PharmactDataTier.cs b/FWA_MAIN/PharmactDataTier.cs index 0998d96..d8298cc 100644 --- a/FWA_MAIN/PharmactDataTier.cs +++ b/FWA_MAIN/PharmactDataTier.cs @@ -1081,7 +1081,7 @@ namespace FWA_MAIN } } - public static double GetNextRefillID() + public static string GetNextRefillID() { try { @@ -1109,9 +1109,15 @@ namespace FWA_MAIN // MessageBox.Show("Error Getting next Refill ID", "ERROR", MessageBoxButtons.OK); } + string stringval = value.ToString(); + + while (stringval.Length < 10) + { + stringval = "0" + stringval; + } // return dataSet - return value; + return stringval; } catch (Exception ex) { @@ -1154,6 +1160,7 @@ namespace FWA_MAIN myConn.Close(); } } + public static void UpdateRefill(string refillID, DateTime date, string patientID, string medicationID, string rxNum) { @@ -1216,6 +1223,38 @@ namespace FWA_MAIN } } + + public static void DeleteAllRefill(string PrescriptionID) + { + + try + { + // open connection + myConn.Open(); + //clear any parameters + cmdString.Parameters.Clear(); + // command + cmdString.Connection = myConn; + cmdString.CommandType = CommandType.StoredProcedure; + cmdString.CommandTimeout = 1500; + cmdString.CommandText = "DeleteAllRefill"; + // Define input parameter + cmdString.Parameters.Add("@RxID", SqlDbType.Char, 11).Value = PrescriptionID; + + cmdString.ExecuteNonQuery(); + } + catch (Exception ex) + { + throw new ArgumentException(ex.Message); + } + finally + { + myConn.Close(); + } + + } + + public static void PastRefills(string rxNum) { @@ -1244,6 +1283,34 @@ namespace FWA_MAIN myConn.Close(); } } + + public static void RefreshRefill(string rxNum) + { + try + { + myConn.Open(); + + cmdString.Parameters.Clear(); + + cmdString.Connection = myConn; + cmdString.CommandType = CommandType.StoredProcedure; + cmdString.CommandTimeout = 1500; + + cmdString.CommandText = "RefreshRefill"; + + cmdString.Parameters.Add("@Prescription_id", SqlDbType.VarChar, 11).Value = rxNum; + + cmdString.ExecuteNonQuery(); + } + catch (Exception ex) + { + throw new ArgumentException(ex.Message); + } + finally + { + myConn.Close(); + } + } public static void DecrementPastRefills(string rxNum) { diff --git a/FWA_MAIN/Prescription.aspx b/FWA_MAIN/Prescription.aspx index 2c68393..6b95ceb 100644 --- a/FWA_MAIN/Prescription.aspx +++ b/FWA_MAIN/Prescription.aspx @@ -97,6 +97,12 @@
  • +
  • + +
  • +
  • + +
  • <%-- --%> diff --git a/FWA_MAIN/Prescription.aspx.cs b/FWA_MAIN/Prescription.aspx.cs index 1b31679..62c038a 100644 --- a/FWA_MAIN/Prescription.aspx.cs +++ b/FWA_MAIN/Prescription.aspx.cs @@ -85,6 +85,7 @@ namespace FWA_MAIN { } } + } protected void gvPatient_OnRowDataBound(object sender, GridViewRowEventArgs e) @@ -194,6 +195,7 @@ namespace FWA_MAIN try { + PharmacyDataTier.DeleteAllRefill(gvPrescription.SelectedRow.Cells[0].Text); PharmacyDataTier.DeletePrescription(gvPrescription.SelectedRow.Cells[0].Text); BindData(); } @@ -204,6 +206,31 @@ namespace FWA_MAIN } + protected void btnPreView_OnClick(object sender, EventArgs e) + { + string refillID = "0"; + try + { + refillID = Crypt.Encrypt(gvPrescription.SelectedRow.Cells[0].Text); + Response.Redirect("Refills.aspx" + "?" + "ID=" + refillID, false); + } + catch (Exception exception) + { + } + } + + protected void btnPreRefill_OnClick(object sender, EventArgs e) + { + var ds = new DataSet(); + ds = PharmacyDataTier.PrescriptionInfoSearch(gvPrescription.SelectedRow.Cells[0].Text); + + if (int.Parse(ds.Tables[0].Rows[0]["test2"].ToString()) < int.Parse(ds.Tables[0].Rows[0]["test"].ToString())) + { + PharmacyDataTier.AddRefill(PharmacyDataTier.GetNextRefillID().ToString(), DateTime.Now, gvPrescription.SelectedRow.Cells[5].Text,gvPrescription.SelectedRow.Cells[4].Text,gvPrescription.SelectedRow.Cells[0].Text); + } + PharmacyDataTier.RefreshRefill(gvPrescription.SelectedRow.Cells[0].Text); + BindData(); + } } } \ No newline at end of file diff --git a/FWA_MAIN/Prescription.aspx.designer.cs b/FWA_MAIN/Prescription.aspx.designer.cs index 5633c9f..539841a 100644 --- a/FWA_MAIN/Prescription.aspx.designer.cs +++ b/FWA_MAIN/Prescription.aspx.designer.cs @@ -95,6 +95,24 @@ namespace FWA_MAIN /// protected global::System.Web.UI.WebControls.Button btnPreDelete; + /// + /// btnPreRefill control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnPreRefill; + + /// + /// btnPreView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnPreView; + /// /// Master property. /// diff --git a/FWA_MAIN/RefEdit.aspx b/FWA_MAIN/RefEdit.aspx new file mode 100644 index 0000000..d2ce242 --- /dev/null +++ b/FWA_MAIN/RefEdit.aspx @@ -0,0 +1,43 @@ +<%@ Page Title="EditRefill" Language="C#" MasterPageFile="main.master" CodeBehind="RefEdit.aspx.cs" Inherits="FWA_MAIN.RefEdit" %> + + + + + + +

    Edit Refill

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/FWA_MAIN/RefEdit.aspx.cs b/FWA_MAIN/RefEdit.aspx.cs new file mode 100644 index 0000000..7766c0c --- /dev/null +++ b/FWA_MAIN/RefEdit.aspx.cs @@ -0,0 +1,65 @@ +using System; +using System.Data; +using System.Diagnostics; +using System.Web.UI; + +namespace FWA_MAIN +{ + public partial class RefEdit : Page + { + + protected string refID; + + protected void Page_Load(object sender, EventArgs e) + { + + txtMedID.Enabled = false; + txtPatID.Enabled = false; + txtPreID.Enabled = false; + txtRefillID.Enabled = false; + + + + if (!IsPostBack) + { + refID = Crypt.Decrypt(Request.QueryString["ID"]); + + FillRefill(); + } + + } + + protected void FillRefill() + { + + var ds = new DataSet(); + ds = PharmacyDataTier.RefillSearch(refID); + + + txtRefillID.Text = ds.Tables[0].Rows[0]["Refill_id"].ToString(); + DateTime date = DateTime.Parse(ds.Tables[0].Rows[0]["RefillDate"].ToString()); + txtDate.Text = date.ToString("d"); + txtPatID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString(); + txtMedID.Text = ds.Tables[0].Rows[0]["Medication_id"].ToString(); + txtPreID.Text = ds.Tables[0].Rows[0]["RxNum_id"].ToString(); + + } + + protected void btnSaveRef_OnClick(object sender, EventArgs e) + { + PharmacyDataTier.UpdateRefill( + txtRefillID.Text, + Val.Date(txtDate), + txtPatID.Text, + txtMedID.Text, + txtPreID.Text + ); + Response.Redirect("Refills.aspx" + "?" + "ID=" + Crypt.Encrypt(txtPreID.Text), false); + } + + protected void btnCancelRef_OnClick(object sender, EventArgs e) + { + Response.Redirect("Refills.aspx" + "?" + "ID=" + Crypt.Encrypt(txtPreID.Text), false); + } + } +} \ No newline at end of file diff --git a/FWA_MAIN/RefEdit.aspx.designer.cs b/FWA_MAIN/RefEdit.aspx.designer.cs new file mode 100644 index 0000000..1975d64 --- /dev/null +++ b/FWA_MAIN/RefEdit.aspx.designer.cs @@ -0,0 +1,94 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace FWA_MAIN +{ + + + public partial class RefEdit + { + + /// + /// txtRefillID control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtRefillID; + + /// + /// txtDate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDate; + + /// + /// 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; + + /// + /// txtMedID control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMedID; + + /// + /// txtPreID control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPreID; + + /// + /// btnSaveRef control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSaveRef; + + /// + /// btnCancelRef control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancelRef; + + /// + /// Master property. + /// + /// + /// Auto-generated property. + /// + public new FWA_MAIN.main Master + { + get + { + return ((FWA_MAIN.main)(base.Master)); + } + } + } +} diff --git a/FWA_MAIN/Refills.aspx b/FWA_MAIN/Refills.aspx new file mode 100644 index 0000000..13bad2b --- /dev/null +++ b/FWA_MAIN/Refills.aspx @@ -0,0 +1,113 @@ +<%@ Page Title="Refills" Language="C#" EnableEventValidation="false" MasterPageFile="main.master" CodeBehind="Refills.aspx.cs" Inherits="FWA_MAIN.Refills" %> + + + + +

    + Refills +

    + +
    + + + + + + + + +
    + +
    +
    +
    +
    +
    +
    + + + + + + + +
    \ No newline at end of file diff --git a/FWA_MAIN/Refills.aspx.cs b/FWA_MAIN/Refills.aspx.cs new file mode 100644 index 0000000..947dc30 --- /dev/null +++ b/FWA_MAIN/Refills.aspx.cs @@ -0,0 +1,98 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FWA_MAIN +{ + public partial class Refills : Page + { + protected string preID; + + protected void Page_Load(object sender, EventArgs e) + { + preID = Crypt.Decrypt(Request.QueryString["ID"]); + + + + + Fill(); + + } + + protected void Fill() + { + + var ds = new DataSet(); + ds = PharmacyDataTier.GetRefill(preID); + gvRefills.DataSource = ds; + gvRefills.DataBind(); + + } + + protected void btnRefEdit_OnClick(object sender, EventArgs e) + { + string refillID = "0"; + try + { + + refillID = Crypt.Encrypt(gvRefills.SelectedRow.Cells[0].Text); + Response.Redirect("RefEdit.aspx" + "?" + "ID=" + refillID, false); + } + catch (Exception exception) + { + } + + } + + protected void btnRefDelete_OnClick(object sender, EventArgs e) + { + PharmacyDataTier.DeleteRefill(gvRefills.SelectedRow.Cells[0].Text); + PharmacyDataTier.RefreshRefill(gvRefills.SelectedRow.Cells[4].Text); + Fill(); + } + + protected void gvRefills_OnRowCommand(object sender, GridViewCommandEventArgs e) + { + if (e.CommandName == "Select") + { + // Determine the index of the selected row + int index = Convert.ToInt32(e.CommandArgument); + + // Check if the selected row index is the same as the previous selected row index + if (gvRefills.SelectedIndex == index) + { + // Deselect the row + gvRefills.SelectedIndex = -1; + } + else + { + // Select the row + gvRefills.SelectedIndex = index; + } + + // Refresh the GridView to update the style + gvRefills.DataBind(); + } + } + + protected void gvRefills_OnRowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvRefills, "Select$" + e.Row.RowIndex); + e.Row.ToolTip = "Click to select this row."; + } + } + + protected void gvRefills_SelectedIndexChanged(object sender, EventArgs e) + { + Fill(); + } + + protected void btnBack_OnClick(object sender, EventArgs e) + { + Response.Redirect("Prescription.aspx"); + } + } +} \ No newline at end of file diff --git a/FWA_MAIN/Refills.aspx.designer.cs b/FWA_MAIN/Refills.aspx.designer.cs new file mode 100644 index 0000000..6df2af4 --- /dev/null +++ b/FWA_MAIN/Refills.aspx.designer.cs @@ -0,0 +1,67 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace FWA_MAIN +{ + + + public partial class Refills + { + + /// + /// gvRefills control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvRefills; + + /// + /// btnBack control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnBack; + + /// + /// btnRefEdit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnRefEdit; + + /// + /// btnRefDelete control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnRefDelete; + + /// + /// Master property. + /// + /// + /// Auto-generated property. + /// + public new FWA_MAIN.main Master + { + get + { + return ((FWA_MAIN.main)(base.Master)); + } + } + } +} diff --git a/FWA_MAIN/bin/FWA_MAIN.dll b/FWA_MAIN/bin/FWA_MAIN.dll index ba68137..757f26c 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 1522103..608474c 100644 Binary files a/FWA_MAIN/bin/FWA_MAIN.pdb and b/FWA_MAIN/bin/FWA_MAIN.pdb differ diff --git a/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.AssemblyReference.cache b/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.AssemblyReference.cache index 406c024..c4fc5be 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 8d86d9e..a464a6c 100644 --- a/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.CoreCompileInputs.cache +++ b/FWA_MAIN/obj/Debug/FWA_MAIN.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -5479b0a2d9bb058bd3c97a17c7db049615ea9c4f5a1d67c3c95c0256920315d2 +8e9911070208912cc09443f3ed39db28706d92c028ebb520b053693deaaf19ef diff --git a/FWA_MAIN/obj/Debug/FWA_MAIN.dll b/FWA_MAIN/obj/Debug/FWA_MAIN.dll index ba68137..757f26c 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 1522103..608474c 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/preEdit.aspx.cs b/FWA_MAIN/preEdit.aspx.cs index e21d22b..227f7f2 100644 --- a/FWA_MAIN/preEdit.aspx.cs +++ b/FWA_MAIN/preEdit.aspx.cs @@ -50,6 +50,7 @@ namespace FWA_MAIN DateTime end = Val.Date(txtEnd); PharmacyDataTier.UpdatePrescription(rxnum,patid,medid,phyid,used,allow,start,end); + PharmacyDataTier.RefreshRefill(rxnum); Response.Redirect("Prescription.aspx"); diff --git a/FWA_MAIN/preNew.aspx b/FWA_MAIN/preNew.aspx index 724f99d..06d4979 100644 --- a/FWA_MAIN/preNew.aspx +++ b/FWA_MAIN/preNew.aspx @@ -1,7 +1,17 @@ <%@ Page Title="New Prescription" Language="C#" MasterPageFile="main.master" CodeBehind="preNew.aspx.cs" Inherits="FWA_MAIN.preNew" %> - + +

    New Prescription

    diff --git a/FWA_MAIN/preNew.aspx.cs b/FWA_MAIN/preNew.aspx.cs index 522a045..1c1b176 100644 --- a/FWA_MAIN/preNew.aspx.cs +++ b/FWA_MAIN/preNew.aspx.cs @@ -32,6 +32,7 @@ namespace FWA_MAIN DateTime end = Val.Date(txtEnd); PharmacyDataTier.CreatePrescription2(rxnum,patid,medid,phyid,used,allow,start,end); + PharmacyDataTier.RefreshRefill(rxnum); Response.Redirect("Prescription.aspx"); }