Added search function to Medication Search Page with working gridview
This commit is contained in:
parent
2680e87e2c
commit
39023fcdf8
@ -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\caschick221\RiderProjects\FWA_MAIN\FWA_MAIN" />
|
<virtualDirectory path="/" physicalPath="C:\Users\cmoore\RiderProjects\FWA_MAIN\FWA_MAIN" />
|
||||||
</application>
|
</application>
|
||||||
<bindings>
|
<bindings>
|
||||||
<binding protocol="http" bindingInformation="*:5000:localhost" />
|
<binding protocol="http" bindingInformation="*:5000:localhost" />
|
||||||
|
@ -2,26 +2,21 @@
|
|||||||
|
|
||||||
<asp:Content runat="server" ContentPlaceHolderID="cph1">
|
<asp:Content runat="server" ContentPlaceHolderID="cph1">
|
||||||
|
|
||||||
<link type="text/css" href="main.css"/>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
<script type="text/javascript">
|
||||||
var inputElements = document.getElementsByTagName('input');
|
$(document).ready(function() {
|
||||||
for (var i = 0; i < inputElements.length; i++) {
|
$(document).keypress(function(e) {
|
||||||
var input = inputElements[i];
|
if (e.which === 13) { // Enter key = keycode 13
|
||||||
if (input.type === 'text') {
|
e.preventDefault(); // Prevent the default Enter action
|
||||||
input.addEventListener('keydown', function (event) {
|
$("#<%= btnMediSearch.ClientID %>").click(); // Trigger the search button click
|
||||||
if (event.keyCode === 13) { // 13 is the Enter key
|
|
||||||
event.preventDefault(); // Prevent the default action
|
|
||||||
document.getElementById('<%= btnMediSearch.ClientID %>').click(); // Trigger button click
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<link type="text/css" href="main.css"/>
|
||||||
|
|
||||||
<h1 style="text-align: center; font-size: 44px">
|
<h1 style="text-align: center; font-size: 44px">
|
||||||
Medications
|
Medications
|
||||||
@ -61,15 +56,23 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<asp:GridView runat="server" ID="gvMedication" BorderColor="white" AutoGenerateColumns="False" OnSelectedIndexChanged="gvMedication_OnSelectedIndexChanged"
|
<asp:GridView runat="server" ID="gvMedication" CssClass="gridview"
|
||||||
OnRowDataBound="gvMedication_OnRowDataBound">
|
HeaderStyle-CssClass="headerstyle"
|
||||||
|
RowStyle-CssClass="rowstyle"
|
||||||
|
AlternatingRowStyle-CssClass="alternatingrowstyle"
|
||||||
|
SelectedRowStyle-CssClass="selectedrowstyle"
|
||||||
|
OnRowCommand="gvMedication_OnRowCommand"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
OnRowDataBound="gvMedication_OnRowDataBound"
|
||||||
|
OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:BoundField DataField="Medication_id" HeaderText="Medication ID" ItemStyle-Width="100px"/>
|
<asp:BoundField DataField="Medication_id" HeaderText="Medication ID" ItemStyle-Width="100px"/>
|
||||||
<asp:BoundField DataField="FirstName" HeaderText="First Name" ItemStyle-Width="100px"/>
|
<asp:BoundField DataField="MedicationName" HeaderText="Medication Name" ItemStyle-Width="100px"/>
|
||||||
<asp:BoundField DataField="LastName" HeaderText="Last Name" ItemStyle-Width="100px"/>
|
<asp:BoundField DataField="IntakeMethod" HeaderText="Intake Method" ItemStyle-Width="100px"/>
|
||||||
<asp:BoundField DataField="DOB" HeaderText="Date of Birth" ItemStyle-Width="100px"/>
|
<asp:BoundField DataField="Frequency" HeaderText="Frequency" ItemStyle-Width="100px"/>
|
||||||
<asp:BoundField DataField="PhoneNumber" HeaderText="Phone Number" ItemStyle-Width="100px"/>
|
<asp:BoundField DataField="Dosage" HeaderText="Dosage" ItemStyle-Width="100px"/>
|
||||||
<asp:BoundField DataField="Gender" HeaderText="Gender" ItemStyle-Width="100px"/>
|
<asp:BoundField DataField="Purpose" HeaderText="Purpose" ItemStyle-Width="100px"/>
|
||||||
|
<asp:BoundField DataField="RxNum" HeaderText="RxNum" ItemStyle-Width="100px"/>
|
||||||
</Columns>
|
</Columns>
|
||||||
</asp:GridView>
|
</asp:GridView>
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Data;
|
||||||
using System.Web.UI;
|
using System.Web.UI;
|
||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
|
|
||||||
@ -8,20 +9,120 @@ namespace FWA_MAIN
|
|||||||
{
|
{
|
||||||
protected void Page_Load(object sender, EventArgs e)
|
protected void Page_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (!IsPostBack)
|
||||||
|
{
|
||||||
|
|
||||||
|
txtMedID.Text = Convert.ToString(Session["vMedID"]);
|
||||||
|
txtMedName.Text = Convert.ToString(Session["vMedName"]);
|
||||||
|
txtRxNum.Text = Convert.ToString(Session["vRxNum"]);
|
||||||
|
|
||||||
|
btnMediSearch_OnClick(sender,e);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void BindData()
|
||||||
|
{
|
||||||
|
|
||||||
|
DataSet ds = new DataSet();
|
||||||
|
|
||||||
|
string medID = Convert.ToString(Session["vMedID"]);
|
||||||
|
string medicationname = Convert.ToString(Session["vMedName"]);
|
||||||
|
//string RxNum = Convert.ToString(Session["vRxNum"]);
|
||||||
|
|
||||||
|
txtMedID.Text = medID;
|
||||||
|
txtMedName.Text = medicationname;
|
||||||
|
//txtRxNum.Text = RxNum;
|
||||||
|
|
||||||
|
// if (textHasValues)
|
||||||
|
// {
|
||||||
|
ds = PharmacyDataTier.MedicationInfoSearch(medID, medicationname);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// ds = dt.GetStudents();
|
||||||
|
gvMedication.DataSource = ds.Tables[0];
|
||||||
|
|
||||||
|
if (Cache["StudentData"] == null)
|
||||||
|
{
|
||||||
|
Cache.Add("StudentData", new DataView(ds.Tables[0]),
|
||||||
|
null,System.Web.Caching.Cache.NoAbsoluteExpiration,
|
||||||
|
System.TimeSpan.FromMinutes(10), System.Web.Caching.CacheItemPriority.Default,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
gvMedication.DataBind();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void btnMediSearch_OnClick(object sender, EventArgs e)
|
protected void btnMediSearch_OnClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (txtMedID.Text.Trim().Length > 0 || txtMedName.Text.Trim().Length > 0 || txtRxNum.Text.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
Session["vMedID"] = txtMedID.Text.Trim();
|
||||||
|
Session["vMedName"] = txtMedName.Text.Trim();
|
||||||
|
Session["vRxNum"] = txtRxNum.Text.Trim();
|
||||||
|
|
||||||
|
Cache.Remove("StudentData");
|
||||||
|
BindData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void gvMedication_OnSelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void gvMedication_OnRowDataBound(object sender, GridViewRowEventArgs e)
|
protected void gvMedication_OnRowDataBound(object sender, GridViewRowEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||||
|
{
|
||||||
|
e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvMedication, "Select$" + e.Row.RowIndex);
|
||||||
|
e.Row.ToolTip = "Click to select this row.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void gvMedication_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 (gvMedication.SelectedIndex == index)
|
||||||
|
{
|
||||||
|
// Deselect the row
|
||||||
|
gvMedication.SelectedIndex = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Select the row
|
||||||
|
gvMedication.SelectedIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refresh the GridView to update the style
|
||||||
|
gvMedication.DataBind();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
8e9911070208912cc09443f3ed39db28706d92c028ebb520b053693deaaf19ef
|
5c5d3543aa3df97a4bf6915d78123652c5cfa939186f89192a82bb6d5f3ed9b9
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user