Med edit work
This commit is contained in:
parent
a393631e61
commit
4a3239073d
@ -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">
|
||||
|
||||
@ -87,16 +87,16 @@
|
||||
</script>
|
||||
|
||||
<div id="contextMenu" class="context-menu"
|
||||
style="display: none">
|
||||
style="display: none; width: auto">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="medNew.aspx">New</a>
|
||||
<li style="height: 25px">
|
||||
<asp:Button runat="server" CssClass="standardbtn" ID="btnMedNew" Text="New" OnClick="btnMedNew_OnClick"/>
|
||||
</li>
|
||||
<li>
|
||||
<a href="medEdit.aspx">Edit</a>
|
||||
<li style="height: 25px">
|
||||
<asp:Button runat="server" CssClass="standardbtn" ID="bntMedEdit" Text="Edit" OnClick="bntMedEdit_OnClick"/>
|
||||
</li>
|
||||
<li>
|
||||
<a href="medDelete.aspx">Delete</a>
|
||||
<li style="height: 25px">
|
||||
<asp:Button runat="server" CssClass="standardbtn" ID="btnMedDelete" Text="Delete" OnClick="btnMedDelete_OnClick"/>
|
||||
</li>
|
||||
|
||||
<%-- <asp:Button runat="server" Text="New" OnClick="btnNew_OnClick" /> --%>
|
||||
@ -137,14 +137,15 @@
|
||||
.context-menu ul {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
min-width: 150px;
|
||||
/*min-width: 150px; */
|
||||
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.context-menu ul li {
|
||||
padding-bottom: 7px;
|
||||
padding-top: 7px;
|
||||
border: 1px solid black;
|
||||
/*padding-bottom: 7px; */
|
||||
/*padding-top: 7px; */
|
||||
/*border: 1px solid black; */
|
||||
}
|
||||
|
||||
.context-menu ul li a {
|
||||
@ -156,17 +157,17 @@
|
||||
background: darkgray;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = function() {
|
||||
var grid = document.getElementById("<%= gvMedication.ClientID %>");
|
||||
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
|
||||
var id = this.cells[0].innerText;
|
||||
__doPostBack('Select$', id);
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<%-- <script type="text/javascript"> --%>
|
||||
<%-- window.onload = function() { --%>
|
||||
<%-- var grid = document.getElementById("<%= gvMedication.ClientID %>"); --%>
|
||||
<%-- 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 --%>
|
||||
<%-- var id = this.cells[0].innerText; --%>
|
||||
<%-- __doPostBack('Select$', id); --%>
|
||||
<%-- }; --%>
|
||||
<%-- } --%>
|
||||
<%-- }; --%>
|
||||
<%-- </script> --%>
|
||||
</asp:Content>
|
||||
|
@ -123,6 +123,50 @@ namespace FWA_MAIN
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
27
FWA_MAIN/MediSearch.aspx.designer.cs
generated
27
FWA_MAIN/MediSearch.aspx.designer.cs
generated
@ -59,6 +59,33 @@ namespace FWA_MAIN
|
||||
/// </remarks>
|
||||
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>
|
||||
/// Master property.
|
||||
/// </summary>
|
||||
|
@ -236,6 +236,7 @@ namespace FWA_MAIN
|
||||
string Medication_id,
|
||||
string MedicationName,
|
||||
string IntakeMethod,
|
||||
string Patient_id,
|
||||
string Frequency,
|
||||
string Dosage,
|
||||
string Purpose,
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,7 +1,17 @@
|
||||
<%@ Page Title="Edit Medication" Language="C#" MasterPageFile="main.master" CodeBehind="medEdit.aspx.cs" Inherits="FWA_MAIN.medEdit" %>
|
||||
|
||||
<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">Edit Medication</h1>
|
||||
@ -32,7 +42,7 @@
|
||||
</div>
|
||||
<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="Save"/></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="Save" 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>
|
@ -1,18 +1,71 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Web.UI;
|
||||
|
||||
namespace FWA_MAIN
|
||||
{
|
||||
public partial class medEdit : Page
|
||||
{
|
||||
|
||||
protected string medID;
|
||||
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");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
8
FWA_MAIN/medEdit.aspx.designer.cs
generated
8
FWA_MAIN/medEdit.aspx.designer.cs
generated
@ -87,22 +87,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.
Loading…
Reference in New Issue
Block a user