Almost working New medi

This commit is contained in:
cadenjmoore 2024-04-03 15:21:33 -04:00
parent a5c4b903e3
commit f699063d2e
8 changed files with 66 additions and 21 deletions

View File

@ -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)

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,17 @@
<%@ Page Title="New Medication" Language="C#" MasterPageFile="main.master" CodeBehind="medNew.aspx.cs" Inherits="FWA_MAIN.medNew" %>
<asp:Content runat="server" ContentPlaceHolderID="cph1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(document).keypress(function(e) {
if (e.which === 13) { // Enter key = keycode 13
e.preventDefault(); // Prevent the default Enter action
$("#<%= btnSaveMed.ClientID %>").click(); // Trigger the search button click
}
});
});
</script>
<link type="text/css" href="main.css"/>
<h1 style="text-align: center; font-size: 44px">New Medication</h1>
@ -11,7 +21,6 @@
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Medication ID: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Medication Name: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Intake Method: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Patient ID: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Frequency: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Dosage: </label></div>
<div class="indivPatDiv" style="text-align: right"><label class="buttonLabel">Purpose: </label></div>
@ -22,7 +31,7 @@
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtMedID"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtMedName"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtIntake"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPatID"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtFrequency"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtDosage"></asp:TextBox></div>
<div class="indivPatDiv"><asp:TextBox runat="server" CssClass="defaultTXT" ID="txtPurpose"></asp:TextBox></div>
@ -35,7 +44,7 @@
</div>
<br/><br/>
<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="display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnCancelPat" Text="Cancel" OnClick="btnCancelPat_OnClick"/></div>
<div style="margin-right: 10px; display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnSaveMed" Text="Create" OnClick="btnSaveMed_OnClick"/></div>
<div style="display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnCancelMed" Text="Cancel" OnClick="btnCancelMed_OnClick"/></div>
</div>
</asp:Content>

View File

@ -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");
}
}
}

View File

@ -41,15 +41,6 @@ namespace FWA_MAIN
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtIntake;
/// <summary>
/// txtPatID 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 txtPatID;
/// <summary>
/// txtFrequency control.
/// </summary>
@ -87,22 +78,22 @@ namespace FWA_MAIN
protected global::System.Web.UI.WebControls.TextBox txtRxNum;
/// <summary>
/// btnSavePat control.
/// btnSaveMed 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 btnSavePat;
protected global::System.Web.UI.WebControls.Button btnSaveMed;
/// <summary>
/// btnCancelPat control.
/// btnCancelMed 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 btnCancelPat;
protected global::System.Web.UI.WebControls.Button btnCancelMed;
/// <summary>
/// Master property.

Binary file not shown.

Binary file not shown.