search, new, edit, and delete working for Prescription.aspx

This commit is contained in:
EggMan20339 2024-03-29 09:47:23 -04:00
parent ef6782c5c8
commit 93cbf4a428
20 changed files with 613 additions and 164 deletions

View File

@ -2,7 +2,11 @@
<project version="4"> <project version="4">
<component name="UserContentModel"> <component name="UserContentModel">
<attachedFolders /> <attachedFolders />
<explicitIncludes /> <explicitIncludes>
<Path>FWA_MAIN/Prescription.aspx</Path>
<Path>FWA_MAIN/physNew.aspx</Path>
<Path>FWA_MAIN/preNew.aspx</Path>
</explicitIncludes>
<explicitExcludes /> <explicitExcludes />
</component> </component>
</project> </project>

View File

@ -155,7 +155,7 @@
<virtualDirectoryDefaults allowSubDirConfig="true" /> <virtualDirectoryDefaults allowSubDirConfig="true" />
<site name="FWA_MAIN" id="1"> <site name="FWA_MAIN" id="1">
<application path="/" applicationPool="Clr4IntegratedAppPool"> <application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\cmoore\RiderProjects\FWA_MAIN\FWA_MAIN" /> <virtualDirectory path="/" physicalPath="C:\Users\eggman\Nextcloud\TSCT\2nd Year\SEM 4\RiderProjects\FWA_MAIN\FWA_MAIN" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:5000:localhost" /> <binding protocol="http" bindingInformation="*:5000:localhost" />

View File

@ -237,6 +237,8 @@
<Content Include="patNew.aspx" /> <Content Include="patNew.aspx" />
<Content Include="physician.aspx" /> <Content Include="physician.aspx" />
<Content Include="preEdit.aspx" /> <Content Include="preEdit.aspx" />
<Content Include="preNew.aspx" />
<Content Include="Prescription.aspx" />
<Content Include="Scripts\bootstrap.js" /> <Content Include="Scripts\bootstrap.js" />
<Content Include="Scripts\bootstrap.min.js" /> <Content Include="Scripts\bootstrap.min.js" />
<Content Include="Default.aspx" /> <Content Include="Default.aspx" />

View File

@ -959,7 +959,7 @@ namespace FWA_MAIN
} }
} }
public static double GetNextRxNum() public static string GetNextRxNum()
{ {
try try
{ {
@ -984,10 +984,17 @@ namespace FWA_MAIN
{ {
// MessageBox.Show("Error Getting next Rx Number", "ERROR", MessageBoxButtons.OK); // MessageBox.Show("Error Getting next Rx Number", "ERROR", MessageBoxButtons.OK);
} }
string stringval = value.ToString();
while (stringval.Length < 11)
{
stringval = "0" + stringval;
}
// return dataSet // return dataSet
return value; return stringval;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1307,6 +1314,51 @@ namespace FWA_MAIN
myConn.Close(); myConn.Close();
} }
} }
public static void CreatePrescription2(
string RxNum,
string Patient_id,
string Medication_id,
string Physician_id,
int Completed_refills,
int Max_refills,
DateTime start,
DateTime end)
{
try
{
myConn.Open();
cmdString.Parameters.Clear();
cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "CreatePrescription2";
cmdString.Parameters.Add("@Medication_id", SqlDbType.VarChar, 7).Value = Medication_id;
cmdString.Parameters.Add("@numRefills", SqlDbType.VarChar, 60).Value = Max_refills;
cmdString.Parameters.Add("@pastNumRefills", SqlDbType.VarChar, 30).Value = Completed_refills;
cmdString.Parameters.Add("@Physician_id", SqlDbType.VarChar, 30).Value = Physician_id;
cmdString.Parameters.Add("@Patient_id", SqlDbType.VarChar, 100).Value = Patient_id;
cmdString.Parameters.Add("@RxNum", SqlDbType.VarChar, 30).Value = RxNum;
cmdString.Parameters.Add("@start", SqlDbType.DateTime).Value = start;
cmdString.Parameters.Add("@end", SqlDbType.DateTime).Value = end;
cmdString.ExecuteNonQuery();
}
catch (Exception ex)
{
throw new ArgumentException(ex.Message);
}
finally
{
myConn.Close();
}
}
public static void UpdatePrescription( public static void UpdatePrescription(
string RxNum, string RxNum,
@ -1349,6 +1401,50 @@ namespace FWA_MAIN
myConn.Close(); myConn.Close();
} }
} }
public static void UpdatePrescription(
string RxNum,
string Patient_id,
string Medication_id,
string Physician_id,
int Completed_refills,
int Max_refills,
DateTime start,
DateTime end)
{
try
{
myConn.Open();
cmdString.Parameters.Clear();
cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "UpdatePrescription2";
cmdString.Parameters.Add("@Medication_id", SqlDbType.VarChar, 7).Value = Medication_id;
cmdString.Parameters.Add("@numRefills", SqlDbType.VarChar, 60).Value = Max_refills;
cmdString.Parameters.Add("@pastNumRefills", SqlDbType.VarChar, 30).Value = Completed_refills;
cmdString.Parameters.Add("@Physician_id", SqlDbType.VarChar, 30).Value = Physician_id;
cmdString.Parameters.Add("@Patient_id", SqlDbType.VarChar, 100).Value = Patient_id;
cmdString.Parameters.Add("@RxNum", SqlDbType.VarChar, 30).Value = RxNum;
cmdString.Parameters.Add("@start", SqlDbType.DateTime).Value = start;
cmdString.Parameters.Add("@end", SqlDbType.DateTime).Value = end;
cmdString.ExecuteNonQuery();
}
catch (Exception ex)
{
throw new ArgumentException(ex.Message);
}
finally
{
myConn.Close();
}
}
// public static void FillComboBox(string table, string ValueMember, string displayMember, ComboBox myComboBox) // public static void FillComboBox(string table, string ValueMember, string displayMember, ComboBox myComboBox)
// { // {

View File

@ -1,4 +1,4 @@
<%@ Page Title="Prescription" Language="C#" MasterPageFile="main.master" CodeBehind="Prescription.aspx.cs" Inherits="FWA_MAIN.Prescription" %> <%@ Page Title="Prescription" EnableEventValidation="false" Language="C#" MasterPageFile="main.master" CodeBehind="Prescription.aspx.cs" Inherits="FWA_MAIN.Prescription" %>
<asp:Content runat="server" ContentPlaceHolderID="cph1"> <asp:Content runat="server" ContentPlaceHolderID="cph1">
@ -21,12 +21,11 @@
</div> </div>
<br/> <br/>
<div class="indivPatDiv" style="text-align: right;"> <div class="indivPatDiv" style="text-align: right;">
<label for="txtMedID" class="buttonLabel">Medication ID: </label> <label for="txtMedID" class="buttonLabel">Medication ID: </label>
</div> </div>
<br/> <br/>
</div> </div>
<div class="patDiv" style="width: 400px"> <div class="patDiv" style="width: 400px">
@ -43,23 +42,40 @@
</div> </div>
<br/> <br/>
<div class="indivPatDiv"> <div class="indivPatDiv">
<asp:TextBox runat="server" CssClass="defaultTXT" id="txtMedID"></asp:TextBox> <asp:TextBox runat="server" CssClass="defaultTXT" id="txtMedID"></asp:TextBox>
</div> </div>
<br/> <br/>
</div> </div>
<br/> <br/>
<asp:Button runat="server" ID="btnPatSearch" Text="Search" CssClass="btnPatSearch" OnClick="btnPreSearch_OnClick"/> <asp:Button runat="server" ID="btnPatSearch" Text="Search" CssClass="btnPatSearch" OnClick="btnPreSearch_OnClick"/>
<br/>
</div> </div>
<asp:GridView runat="server" ID="gvPatient" BorderColor="red"></asp:GridView> <div style="width: 80%; margin: 0 auto; align-content: center; horiz-align: center">
<asp:GridView runat="server" ID="gvPrescription"
CssClass="gridview"
HeaderStyle-CssClass="headerstyle"
RowStyle-CssClass="rowstyle"
AlternatingRowStyle-CssClass="alternatingrowstyle"
SelectedRowStyle-CssClass="selectedrowstyle"
OnRowCommand="gvPatient_OnRowCommand"
AutoGenerateColumns="False"
OnRowDataBound="gvPatient_OnRowDataBound"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="RxNum_id" HeaderText="Rx Number" SortExpression="RxNum"/>
<asp:BoundField DataField="numRefills" HeaderText="Allowed Refills" SortExpression="numRefills"/>
<asp:BoundField DataField="pastNumRefills" HeaderText="Refills Used" SortExpression="pastNumRefills"/>
<asp:BoundField DataField="Physician_id" HeaderText="Physician ID" SortExpression="Physician_id"/>
<asp:BoundField DataField="Medication_id" HeaderText="Medication ID" SortExpression="Medication_id"/>
<asp:BoundField DataField="Patient_id" HeaderText="Patient ID" SortExpression="Patient_id"/>
<asp:BoundField DataField="PrescriptionStart" HeaderText="Prescribed Date" SortExpression="PrescriptionStart" DataFormatString="{0:d}" HtmlEncode="False"/>
<asp:BoundField DataField="PrescriptionEnd" HeaderText="Experation Date" SortExpression="PrescriptionEnd" DataFormatString="{0:d}" HtmlEncode="False"/>
</Columns>
</asp:GridView></div>
<script type="text/javascript"> <script type="text/javascript">
document.oncontextmenu = rightClick; document.oncontextmenu = rightClick;
@ -70,21 +86,21 @@
</script> </script>
<div id="contextMenu" class="context-menu" <div id="contextMenu" class="context-menu"
style="display: none"> style="display: none; width: auto">
<ul> <ul>
<li> <li style="height: 25px">
<a href="preNew.aspx">New</a> <asp:Button runat="server" CssClass="standardbtn" ID="btnPreNew" Text="New" OnClick="btnPreNew_OnClick"/>
</li> </li>
<li> <li style="height: 25px">
<a href="preEdit.aspx">Edit</a> <asp:Button runat="server" CssClass="standardbtn" ID="bntPreEdit" Text="Edit" OnClick="bntPreEdit_OnClick"/>
</li> </li>
<li> <li style="height: 25px">
<a href="#">Delete</a> <asp:Button runat="server" CssClass="standardbtn" ID="btnPreDelete" Text="Delete" OnClick="btnPreDelete_OnClick"/>
</li> </li>
<%-- <asp:Button runat="server" Text="New" OnClick="btnNew_OnClick" /> --%> <%-- <asp:Button runat="server" Text="New" OnClick="btnNew_OnClick" /> --%>
</ul> </ul>
</div> </div>
<script> <script>
document.onclick = hideMenu; document.onclick = hideMenu;
document.oncontextmenu = rightClick; document.oncontextmenu = rightClick;
@ -109,35 +125,36 @@
} }
} }
</script> </script>
<style type="text/css"> <style type="text/css">
.context-menu { .context-menu {
position: absolute; position: absolute;
text-align: center; text-align: center;
background: lightgray; background: lightgray;
border: 1px solid black; border: 1px solid black;
} }
.context-menu ul { .context-menu ul {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
min-width: 150px; /*min-width: 150px; */
list-style: none;
} list-style: none;
}
.context-menu ul li {
padding-bottom: 7px; .context-menu ul li {
padding-top: 7px; /*padding-bottom: 7px; */
border: 1px solid black; /*padding-top: 7px; */
} /*border: 1px solid black; */
}
.context-menu ul li a {
text-decoration: none; .context-menu ul li a {
color: black; text-decoration: none;
} color: black;
}
.context-menu ul li:hover {
background: darkgray; .context-menu ul li:hover {
} background: darkgray;
</style> }
</style>
</asp:Content> </asp:Content>

View File

@ -1,5 +1,7 @@
using System; using System;
using System.Web.UI; using System.Web.UI;
using System.Data;
using System.Web.UI.WebControls;
namespace FWA_MAIN namespace FWA_MAIN
{ {
@ -8,19 +10,200 @@ namespace FWA_MAIN
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
if (!IsPostBack)
{
txtRxNum.Text = Convert.ToString(Session["vRxNum"]);
txtPhysID.Text = Convert.ToString(Session["vPhysID"]);
txtPatID.Text = Convert.ToString(Session["vPatID"]);
txtMedID.Text = Convert.ToString(Session["vMedID"]);
btnPreSearch_OnClick(sender,e);
}
} }
private void BindData()
{
DataSet ds = new DataSet();
string RxNum = Convert.ToString(Session["vRxNum"]);
string physID = Convert.ToString(Session["vPhysID"]);
string patID = Convert.ToString(Session["vPatID"]);
string medID = Convert.ToString(Session["vMedID"]);
txtRxNum.Text = RxNum;
txtPhysID.Text = physID;
txtPatID.Text = patID;
txtMedID.Text = medID;
// if (textHasValues)
// {
ds = PharmacyDataTier.PrescriptionInfoSearch(RxNum,patID, medID, physID);
// }
// ds = dt.GetStudents();
gvPrescription.DataSource = ds.Tables[0];
if (Cache["PreData"] == null)
{
Cache.Add("PreData", new DataView(ds.Tables[0]),
null,System.Web.Caching.Cache.NoAbsoluteExpiration,
System.TimeSpan.FromMinutes(10), System.Web.Caching.CacheItemPriority.Default,
null);
}
gvPrescription.DataBind();
}
protected void btnPreSearch_OnClick(object sender, EventArgs e) protected void btnPreSearch_OnClick(object sender, EventArgs e)
{ {
throw new NotImplementedException();
if (txtPatID.Text.Trim().Length > 0 || txtRxNum.Text.Trim().Length > 0 || txtMedID.Text.Trim().Length > 0 ||
txtPhysID.Text.Trim().Length > 0)
{
try
{
Session["vRxNum"] = txtRxNum.Text.Trim();
Session["vPhysID"] = txtPhysID.Text.Trim();
Session["vPatID"] = txtPatID.Text.Trim();
Session["vMedID"] = txtMedID.Text.Trim();
Cache.Remove("PreData");
BindData();
}
catch (Exception exception)
{
}
}
} }
protected void gvPatient_OnRowDataBound(object sender, GridViewRowEventArgs e)
protected void btnNew_OnClick(object sender, EventArgs e) {
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvPrescription, "Select$" + e.Row.RowIndex);
e.Row.ToolTip = "Click to select this row.";
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
BindData();
}
protected void gvPatient_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 (gvPrescription.SelectedIndex == index)
{
// Deselect the row
gvPrescription.SelectedIndex = -1;
}
else
{
// Select the row
gvPrescription.SelectedIndex = index;
}
// Refresh the GridView to update the style
gvPrescription.DataBind();
}
}
protected void btnPreNew_OnClick(object sender, EventArgs e)
{ {
Response.Redirect("preNew.aspx"); string prescriptionID;
try
{
Session["vRxNum"] = txtRxNum.Text.Trim();
Session["vPhysID"] = txtPhysID.Text.Trim();
Session["vPatID"] = txtPatID.Text.Trim();
Session["vMedID"] = txtMedID.Text.Trim();
// Use the patientID value as needed
try
{
prescriptionID = PharmacyDataTier.GetNextRxNum();
prescriptionID = Crypt.Encrypt(prescriptionID);
Response.Redirect("preNew.aspx" + "?" + "ID=" + prescriptionID, false);
}
catch (Exception exception)
{
}
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex.InnerException);
}
} }
protected void bntPreEdit_OnClick(object sender, EventArgs e)
{
string prescriptionID = "0";
Int64 mEditedRecord = 0;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
try
{
Session["vRxNum"] = txtRxNum.Text.Trim();
Session["vPhysID"] = txtPhysID.Text.Trim();
Session["vPatID"] = txtPatID.Text.Trim();
Session["vMedID"] = txtMedID.Text.Trim();
try
{
prescriptionID = Crypt.Encrypt(gvPrescription.SelectedRow.Cells[0].Text);
Response.Redirect("preEdit.aspx" + "?" + "ID=" + prescriptionID, false);
}
catch (Exception exception)
{
}
// Use the patientID value as needed
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex.InnerException);
}
}
protected void btnPreDelete_OnClick(object sender, EventArgs e)
{
try
{
PharmacyDataTier.DeletePrescription(gvPrescription.SelectedRow.Cells[0].Text);
BindData();
}
catch (Exception exception)
{
}
}
} }
} }

View File

@ -42,40 +42,13 @@ namespace FWA_MAIN
protected global::System.Web.UI.WebControls.TextBox txtPatID; protected global::System.Web.UI.WebControls.TextBox txtPatID;
/// <summary> /// <summary>
/// txtNumRefill control. /// txtMedID control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtNumRefill; protected global::System.Web.UI.WebControls.TextBox txtMedID;
/// <summary>
/// txtPastRefill control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPastRefill;
/// <summary>
/// txtStart control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtStart;
/// <summary>
/// txtPreEnd control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPreEnd;
/// <summary> /// <summary>
/// btnPatSearch control. /// btnPatSearch control.
@ -87,13 +60,40 @@ namespace FWA_MAIN
protected global::System.Web.UI.WebControls.Button btnPatSearch; protected global::System.Web.UI.WebControls.Button btnPatSearch;
/// <summary> /// <summary>
/// gvPatient control. /// gvPrescription control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.GridView gvPatient; protected global::System.Web.UI.WebControls.GridView gvPrescription;
/// <summary>
/// btnPreNew control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnPreNew;
/// <summary>
/// bntPreEdit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button bntPreEdit;
/// <summary>
/// btnPreDelete control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnPreDelete;
/// <summary> /// <summary>
/// Master property. /// Master property.

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Data;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
namespace FWA_MAIN namespace FWA_MAIN
@ -62,6 +63,69 @@ namespace FWA_MAIN
} }
} }
public static string PatID(TextBox box)
{
string word = box.Text.Trim();
while (word.Length < 8)
{
word = "0" + word;
}
DataSet ds = PharmacyDataTier.PatientInfoSearch(word);
if (ds.Tables[0].Rows.Count > 0)
{
return word;
}
else
{
return "00000000";
}
}
public static string MedID(TextBox box)
{
string word = box.Text.Trim();
while (word.Length < 7)
{
word = "0" + word;
}
DataSet ds = PharmacyDataTier.MedicationInfoSearch(word);
if (ds.Tables[0].Rows.Count > 0)
{
return word;
}
else
{
return "0000000";
}
}
public static string PhyID(TextBox box)
{
string word = box.Text.Trim();
while (word.Length < 8)
{
word = "0" + word;
}
DataSet ds = PharmacyDataTier.PhysicianInfoSearch(word);
if (ds.Tables[0].Rows.Count > 0)
{
return word;
}
else
{
return "00000000";
}
}
public static DateTime Date(TextBox box) public static DateTime Date(TextBox box)
{ {
try try

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
d2d2a219092f2f86c27fbbb67e6e1855b3e51df134233d4f20d9e880feaa1a41 5479b0a2d9bb058bd3c97a17c7db049615ea9c4f5a1d67c3c95c0256920315d2

Binary file not shown.

Binary file not shown.

View File

@ -17,13 +17,15 @@
<h1 style="text-align: center; font-size: 44px">Edit Prescription</h1> <h1 style="text-align: center; font-size: 44px">Edit Prescription</h1>
<div class="patDiv"> <div class="patDiv">
<div class="patDiv"> <div class="patDiv">
<div class="patDiv" style="padding-left: 150px; padding-right: 5px;width: 100px"> <div class="patDiv" style="padding-left: 450px; padding-right: 30px;width: 100px">
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Rx Number: </label></div> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Rx Number: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Patient ID: </label></div> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Patient ID: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Medication ID: </label></div> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Medication ID: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Physician ID: </label></div> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Physician ID: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Refills Used: </label></div> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Refills Used: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Refills Allowed: </label></div> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Refills Allowed: </label></div>
<div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Date Prescribed: </label></div>
<div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Expiration Date: </label></div>
</div> </div>
<div class="patDiv"> <div class="patDiv">
@ -33,6 +35,8 @@
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPhysID"></asp:TextBox></div> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPhysID"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtUsed"></asp:TextBox></div> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtUsed"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtAllowed"></asp:TextBox></div> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtAllowed"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtStart"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtEnd"></asp:TextBox></div>
</div> </div>
</div> </div>
@ -40,7 +44,7 @@
</div> </div>
<br/> <br/> <br/>
<div class="patDiv" style="margin-left: 500px"> <div class="patDiv" style="margin-left: 500px">
<div style="margin-right: 10px; display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnSavePat" Text="Save" OnClick="btnSavePre_OnClick"/></div> <div style="margin-right: 10px; display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnSavePat" Text="Save" OnClick="btnSavePre_OnClick"/></div>
<div style="display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnCancelPat" Text="Cancel" OnClick="btnCancelPre_OnClick"/></div> <div style="display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnCancelPat" Text="Cancel" OnClick="btnCancelPre_OnClick"/></div>

View File

@ -1,23 +1,63 @@
using System; using System;
using System.Web.UI; using System.Web.UI;
using System.Data;
namespace FWA_MAIN namespace FWA_MAIN
{ {
public partial class preEdit : Page public partial class preEdit : Page
{ {
protected string preID;
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
preID = Crypt.Decrypt(Request.QueryString["ID"]);
txtRxNum.Enabled = false;
if (!IsPostBack)
{
FillPrescription(preID);
}
}
protected void FillPrescription(string id)
{
var ds = new DataSet();
ds = PharmacyDataTier.PrescriptionInfoSearch(id);
txtRxNum.Text = ds.Tables[0].Rows[0]["RxNum_id"].ToString();
txtAllowed.Text = ds.Tables[0].Rows[0]["numRefills"].ToString();
txtUsed.Text = ds.Tables[0].Rows[0]["pastNumRefills"].ToString();
txtMedID.Text = ds.Tables[0].Rows[0]["Medication_id"].ToString();
txtPhysID.Text = ds.Tables[0].Rows[0]["Physician_id"].ToString();
txtPatID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString();
DateTime date1 = DateTime.Parse(ds.Tables[0].Rows[0]["PrescriptionStart"].ToString());
txtStart.Text = date1.ToString("d");
DateTime date2 = DateTime.Parse(ds.Tables[0].Rows[0]["PrescriptionEnd"].ToString());
txtEnd.Text = date2.ToString("d");
} }
protected void btnSavePre_OnClick(object sender, EventArgs e) protected void btnSavePre_OnClick(object sender, EventArgs e)
{ {
throw new NotImplementedException(); string rxnum = Val.varchar(txtRxNum, 11);
int allow = Val.IntType(txtAllowed);
int used = Val.IntType(txtUsed);
string medid = Val.varchar(txtMedID, 7);
string phyid = Val.varchar(txtPhysID, 8);
string patid = Val.varchar(txtPatID, 8);
DateTime start = Val.Date(txtStart);
DateTime end = Val.Date(txtEnd);
PharmacyDataTier.UpdatePrescription(rxnum,patid,medid,phyid,used,allow,start,end);
Response.Redirect("Prescription.aspx");
} }
protected void btnCancelPre_OnClick(object sender, EventArgs e) protected void btnCancelPre_OnClick(object sender, EventArgs e)
{ {
throw new NotImplementedException(); Response.Redirect("Prescription.aspx");
} }
} }
} }

View File

@ -68,6 +68,24 @@ namespace FWA_MAIN
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtAllowed; protected global::System.Web.UI.WebControls.TextBox txtAllowed;
/// <summary>
/// txtStart control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtStart;
/// <summary>
/// txtEnd control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtEnd;
/// <summary> /// <summary>
/// btnSavePat control. /// btnSavePat control.
/// </summary> /// </summary>

View File

@ -7,27 +7,27 @@
<h1 style="text-align: center; font-size: 44px">New Prescription</h1> <h1 style="text-align: center; font-size: 44px">New Prescription</h1>
<div class="patDiv"> <div class="patDiv">
<div class="patDiv"> <div class="patDiv">
<div class="patDiv" style="padding-left: 150px; padding-right: 5px;width: 100px"> <div class="patDiv" style="padding-left: 450px; padding-right: 30px;width: 100px">
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Rx Number: </label></div><br/> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Rx Number: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Number of Refills: </label></div><br/> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Patient ID: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Number of Past Refills: </label></div><br/> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Medication ID: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Physician ID: </label></div><br/> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Physician ID: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Medication ID: </label></div><br/> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Refills Used: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Patient ID: </label></div><br/> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Refills Allowed: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Prescription Start Date: </label></div><br/> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Date Prescribed: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Prescription End Date: </label></div><br/> <div class="indivPatDiv" style="text-align: right; width: 120px"><label class="buttonLabel">Expiration Date: </label></div>
</div> </div>
<div class="patDiv"> <div class="patDiv">
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtRxNum"></asp:TextBox></div><br/> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtRxNum"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtNumRefill"></asp:TextBox></div><br/> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPatID"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPastRefill"></asp:TextBox></div><br/> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtMedID"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPhysID"></asp:TextBox></div><br/> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPhysID"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtMedID"></asp:TextBox></div><br/> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtUsed"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPatID"></asp:TextBox></div><br/> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtAllowed"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPreStart"></asp:TextBox></div><br/> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtStart"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPreEnd"></asp:TextBox></div><br/> <div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtEnd"></asp:TextBox></div>
</div> </div>
</div> </div>
@ -36,7 +36,7 @@
<br/> <br/>
<div class="patDiv" style="margin-left: 500px"> <div class="patDiv" style="margin-left: 500px">
<div style="margin-right: 10px; display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnSavePat" Text="Create"/></div> <div style="margin-right: 10px; display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnSavePat" Text="Create" OnClick="btnSavePat_OnClick"/></div>
<div style="display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnCancelPat" Text="Cancel" OnClick="btnCancelPre_OnClick"/></div> <div style="display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnCancelPat" Text="Cancel" OnClick="btnCancelPre_OnClick"/></div>
</div> </div>
</asp:Content> </asp:Content>

View File

@ -5,14 +5,35 @@ namespace FWA_MAIN
{ {
public partial class preNew : Page public partial class preNew : Page
{ {
protected string preID;
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
preID = Crypt.Decrypt(Request.QueryString["ID"]);
txtRxNum.Enabled = false;
txtRxNum.Text = preID;
} }
protected void btnCancelPre_OnClick(object sender, EventArgs e) protected void btnCancelPre_OnClick(object sender, EventArgs e)
{ {
throw new NotImplementedException(); Response.Redirect("Prescription.aspx");
}
protected void btnSavePat_OnClick(object sender, EventArgs e)
{
string rxnum = Val.varchar(txtRxNum, 11);
int allow = Val.IntType(txtAllowed);
int used = Val.IntType(txtUsed);
string medid = Val.MedID(txtMedID);
string phyid = Val.PhyID(txtPhysID);
string patid = Val.PatID(txtPatID);
DateTime start = Val.Date(txtStart);
DateTime end = Val.Date(txtEnd);
PharmacyDataTier.CreatePrescription2(rxnum,patid,medid,phyid,used,allow,start,end);
Response.Redirect("Prescription.aspx");
} }
} }
} }

View File

@ -24,31 +24,13 @@ namespace FWA_MAIN
protected global::System.Web.UI.WebControls.TextBox txtRxNum; protected global::System.Web.UI.WebControls.TextBox txtRxNum;
/// <summary> /// <summary>
/// txtNumRefill control. /// txtPatID control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtNumRefill; protected global::System.Web.UI.WebControls.TextBox txtPatID;
/// <summary>
/// txtPastRefill control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPastRefill;
/// <summary>
/// txtPhysID control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPhysID;
/// <summary> /// <summary>
/// txtMedID control. /// txtMedID control.
@ -60,31 +42,49 @@ namespace FWA_MAIN
protected global::System.Web.UI.WebControls.TextBox txtMedID; protected global::System.Web.UI.WebControls.TextBox txtMedID;
/// <summary> /// <summary>
/// txtPatID control. /// txtPhysID control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPatID; protected global::System.Web.UI.WebControls.TextBox txtPhysID;
/// <summary> /// <summary>
/// txtPreStart control. /// txtUsed control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPreStart; protected global::System.Web.UI.WebControls.TextBox txtUsed;
/// <summary> /// <summary>
/// txtPreEnd control. /// txtAllowed control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPreEnd; protected global::System.Web.UI.WebControls.TextBox txtAllowed;
/// <summary>
/// txtStart control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtStart;
/// <summary>
/// txtEnd control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtEnd;
/// <summary> /// <summary>
/// btnSavePat control. /// btnSavePat control.