Med edit work

This commit is contained in:
cadenjmoore 2024-04-03 10:01:25 -04:00
parent a393631e61
commit 4a3239073d
11 changed files with 203 additions and 67 deletions

View File

@ -1,4 +1,4 @@
<%@ Page Title="Medication" Language="C#" MasterPageFile="main.master" CodeBehind="MediSearch.aspx.cs" Inherits="FWA_MAIN.MediSearch" %> <%@ Page Title="Medication" Language="C#" EnableEventValidation="false" MasterPageFile="main.master" CodeBehind="MediSearch.aspx.cs" Inherits="FWA_MAIN.MediSearch" %>
<asp:Content runat="server" ContentPlaceHolderID="cph1"> <asp:Content runat="server" ContentPlaceHolderID="cph1">
@ -87,21 +87,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="medNew.aspx">New</a> <asp:Button runat="server" CssClass="standardbtn" ID="btnMedNew" Text="New" OnClick="btnMedNew_OnClick"/>
</li> </li>
<li> <li style="height: 25px">
<a href="medEdit.aspx">Edit</a> <asp:Button runat="server" CssClass="standardbtn" ID="bntMedEdit" Text="Edit" OnClick="bntMedEdit_OnClick"/>
</li> </li>
<li> <li style="height: 25px">
<a href="medDelete.aspx">Delete</a> <asp:Button runat="server" CssClass="standardbtn" ID="btnMedDelete" Text="Delete" OnClick="btnMedDelete_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;
@ -127,46 +127,47 @@
} }
</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;
}
.context-menu ul li { list-style: none;
padding-bottom: 7px; }
padding-top: 7px;
border: 1px solid black;
}
.context-menu ul li a { .context-menu ul li {
text-decoration: none; /*padding-bottom: 7px; */
color: black; /*padding-top: 7px; */
} /*border: 1px solid black; */
}
.context-menu ul li:hover { .context-menu ul li a {
background: darkgray; text-decoration: none;
} color: black;
</style> }
<script type="text/javascript">
window.onload = function() { .context-menu ul li:hover {
var grid = document.getElementById("<%= gvMedication.ClientID %>"); background: darkgray;
var rows = grid.getElementsByTagName("tr"); }
for (var i = 0; i < rows.length; i++) { </style>
rows[i].onclick = function() { <%-- <script type="text/javascript"> --%>
// Assuming the first cell in every row contains the unique ID <%-- window.onload = function() { --%>
var id = this.cells[0].innerText; <%-- var grid = document.getElementById("<%= gvMedication.ClientID %>"); --%>
__doPostBack('Select$', id); <%-- var rows = grid.getElementsByTagName("tr"); --%>
}; <%-- for (var i = 0; i < rows.length; i++) { --%>
} <%-- rows[i].onclick = function() { --%>
}; <%-- // Assuming the first cell in every row contains the unique ID --%>
</script> <%-- var id = this.cells[0].innerText; --%>
<%-- __doPostBack('Select$', id); --%>
<%-- }; --%>
<%-- } --%>
<%-- }; --%>
<%-- </script> --%>
</asp:Content> </asp:Content>

View File

@ -123,6 +123,50 @@ namespace FWA_MAIN
} }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
BindData();
}
protected void btnMedNew_OnClick(object sender, EventArgs e)
{
throw new NotImplementedException();
}
protected void bntMedEdit_OnClick(object sender, EventArgs e)
{
string medicationID = "0";
//Int64 mEditedRecord = 0;
//System.Text.StringBuilder sb = new System.Text.StringBuilder();
try
{
Session["vMedID"] = txtMedID.Text.Trim();
Session["vMedName"] = txtMedName.Text.Trim();
Session["vRxNum"] = txtRxNum.Text.Trim();
try
{
medicationID = Crypt.Encrypt(gvMedication.SelectedRow.Cells[0].Text);
Response.Redirect("patEdit.aspx" + "?" + "ID=" + medicationID, false);
}
catch (Exception exception)
{
}
// Use the patientID value as needed
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex.InnerException);
}
}
protected void btnMedDelete_OnClick(object sender, EventArgs e)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -59,6 +59,33 @@ namespace FWA_MAIN
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.GridView gvMedication; protected global::System.Web.UI.WebControls.GridView gvMedication;
/// <summary>
/// btnMedNew 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 btnMedNew;
/// <summary>
/// bntMedEdit 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 bntMedEdit;
/// <summary>
/// btnMedDelete 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 btnMedDelete;
/// <summary> /// <summary>
/// Master property. /// Master property.
/// </summary> /// </summary>

View File

@ -236,6 +236,7 @@ namespace FWA_MAIN
string Medication_id, string Medication_id,
string MedicationName, string MedicationName,
string IntakeMethod, string IntakeMethod,
string Patient_id,
string Frequency, string Frequency,
string Dosage, string Dosage,
string Purpose, string Purpose,

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,17 @@
<%@ Page Title="Edit Medication" Language="C#" MasterPageFile="main.master" CodeBehind="medEdit.aspx.cs" Inherits="FWA_MAIN.medEdit" %> <%@ Page Title="Edit Medication" Language="C#" MasterPageFile="main.master" CodeBehind="medEdit.aspx.cs" Inherits="FWA_MAIN.medEdit" %>
<asp:Content runat="server" ContentPlaceHolderID="cph1"> <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"/> <link type="text/css" href="main.css"/>
<h1 style="text-align: center; font-size: 44px">Edit Medication</h1> <h1 style="text-align: center; font-size: 44px">Edit Medication</h1>
@ -32,7 +42,7 @@
</div> </div>
<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"/></div> <div style="margin-right: 10px; display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnSaveMed" Text="Save" OnClick="btnSaveMed_OnClick"/></div>
<div style="display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnCancelPat" Text="Cancel" OnClick="btnCancelPat_OnClick"/></div> <div style="display: inline-block"><asp:Button runat="server" CssClass="standardbtn" ID="btnCancelMed" Text="Cancel" OnClick="btnCancelMed_OnClick"/></div>
</div> </div>
</asp:Content> </asp:Content>

View File

@ -1,18 +1,71 @@
using System; using System;
using System.Data;
using System.Web.UI; using System.Web.UI;
namespace FWA_MAIN namespace FWA_MAIN
{ {
public partial class medEdit : Page public partial class medEdit : Page
{ {
protected string medID;
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
medID = Crypt.Decrypt(Request.QueryString["ID"]);
txtMedID.Enabled = false;
if (!IsPostBack)
{
FillMedication(medID);
}
} }
protected void btnCancelPat_OnClick(object sender, EventArgs e)
protected void FillMedication(string id)
{ {
throw new NotImplementedException();
var ds = new DataSet();
ds = PharmacyDataTier.MedicationInfoSearch(medID);
txtMedID.Text = ds.Tables[0].Rows[0]["Medication_id"].ToString();
txtMedName.Text = ds.Tables[0].Rows[0]["MedicationName"].ToString();
txtIntake.Text = ds.Tables[0].Rows[0]["IntakeMethod"].ToString();
txtPatID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString();
txtFrequency.Text = ds.Tables[0].Rows[0]["Frequency"].ToString();
txtDosage.Text = ds.Tables[0].Rows[0]["Dosage"].ToString();
txtPurpose.Text = ds.Tables[0].Rows[0]["Purpose"].ToString();
txtRxNum.Text = ds.Tables[0].Rows[0]["RxNum"].ToString();
}
protected void btnCancelMed_OnClick(object sender, EventArgs e)
{
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 patID = Val.varchar(txtPatID, 1);
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.UpdateMedication(id, MedicationName:medName, IntakeMethod: intake, Patient_id:patID, Frequency: frequency, Dosage: dosage, Purpose: purpose, RxNum: rxNum);
Response.Redirect("mediSearch.aspx");
} }
} }
} }

View File

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

Binary file not shown.

Binary file not shown.