made changes to patsearch, got gridview populating and select funtionality working

This commit is contained in:
EggMan20339 2024-03-28 12:08:12 -04:00
parent 751b9cb1f9
commit b4e4c41887
15 changed files with 241 additions and 43 deletions

7
FWA_MAIN/Crypt.cs Normal file
View File

@ -0,0 +1,7 @@
namespace FWA_MAIN
{
public class Crypt
{
}
}

View File

@ -117,6 +117,7 @@
<Compile Include="App_Start\BundleConfig.cs" /> <Compile Include="App_Start\BundleConfig.cs" />
<Compile Include="App_Start\FilterConfig.cs" /> <Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" /> <Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Crypt.cs" />
<Compile Include="Global.asax.cs"> <Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon> <DependentUpon>Global.asax</DependentUpon>
</Compile> </Compile>
@ -162,11 +163,11 @@
<Compile Include="patEdit.aspx.designer.cs"> <Compile Include="patEdit.aspx.designer.cs">
<DependentUpon>patEdit.aspx</DependentUpon> <DependentUpon>patEdit.aspx</DependentUpon>
</Compile> </Compile>
<Compile Include="patient.aspx.cs"> <Compile Include="patSearch.aspx.cs">
<SubType>ASPXCodeBehind</SubType> <SubType>ASPXCodeBehind</SubType>
<DependentUpon>patient.aspx</DependentUpon> <DependentUpon>patSearch.aspx</DependentUpon>
</Compile> </Compile>
<Compile Include="patient.aspx.designer.cs" /> <Compile Include="patSearch.aspx.designer.cs" />
<Compile Include="patNew.aspx.cs"> <Compile Include="patNew.aspx.cs">
<SubType>ASPXCodeBehind</SubType> <SubType>ASPXCodeBehind</SubType>
<DependentUpon>patNew.aspx</DependentUpon> <DependentUpon>patNew.aspx</DependentUpon>
@ -210,7 +211,7 @@
<Content Include="MediSearch.aspx" /> <Content Include="MediSearch.aspx" />
<Content Include="medNew.aspx" /> <Content Include="medNew.aspx" />
<Content Include="patEdit.aspx" /> <Content Include="patEdit.aspx" />
<Content Include="patient.aspx" /> <Content Include="patSearch.aspx" />
<Content Include="patNew.aspx" /> <Content Include="patNew.aspx" />
<Content Include="physician.aspx" /> <Content Include="physician.aspx" />
<Content Include="Scripts\bootstrap.js" /> <Content Include="Scripts\bootstrap.js" />

Binary file not shown.

View File

@ -14,7 +14,7 @@
</defaultDocument> </defaultDocument>
</system.webServer> </system.webServer>
<connectionStrings> <connectionStrings>
<add name="ConnString" connectionString="Server=sql.eggtech.net;Database=College2;User Id=admin;Password=delirium-purveyor-overall-backboned-approval-amino;" providerName="System.Data.SqlClient"/> <add name="ConnString" connectionString="Server=sql.eggtech.net;Database=FinalProjectOfficialPharmacy;User Id=admin;Password=delirium-purveyor-overall-backboned-approval-amino;" providerName="System.Data.SqlClient"/>
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
<add key="webpages:Version" value="3.0.0.0"/> <add key="webpages:Version" value="3.0.0.0"/>

Binary file not shown.

View File

@ -40,7 +40,7 @@ namespace FWA_MAIN
protected void btnPatient_OnClick(object sender, EventArgs e) protected void btnPatient_OnClick(object sender, EventArgs e)
{ {
Response.Redirect("patient.aspx"); Response.Redirect("patSearch.aspx");
} }

View File

@ -13,6 +13,50 @@
} }
.gridview {
outline-color: black;
margin: 10px;
font-family: Arial, sans-serif;
width: auto;
border-collapse: collapse;
}
.gridview th {
background-color: #101214;
color: #fff;
padding: 5px;
}
.gridview td {
/*background-color: #1D2125;*/
padding: 5px;
width: 120px;
color: #FFFFFF;
}
.gridview tr:hover {
background-color: #101214;
}
.gridview .headerstyle {
background-color: #161A1D;
color: white;
font-weight: bold;
text-align: left;
}
.gridview .rowstyle {
background-color: #1D2125;
}
.gridview .alternatingrowstyle {
background-color: #2C333A;
}
.gridview .selectedrowstyle {
background-color: #09326C;
}
.buttonLabel{ .buttonLabel{
text-align: right; text-align: right;

View File

@ -1 +1 @@
a5116abbacc7a6ecc26eaf26c72d12adb7e0416a1b3d3cb4f7efcb9f903c1aaa 7074ecee9fd5e988b38acde16901b0d6290276e5479ece72dfea267de554eaeb

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
<%@ Page Title="Patients" Language="C#" MasterPageFile="main.master" CodeBehind="patient.aspx.cs" Inherits="FWA_MAIN.patient" %> <%@ Page Title="Patients" EnableEventValidation="false" Language="C#" MasterPageFile="main.master" CodeBehind="~/patSearch.aspx.cs" Inherits="FWA_MAIN.patSearch" %>
<asp:Content runat="server" ContentPlaceHolderID="cph1"> <asp:Content runat="server" ContentPlaceHolderID="cph1">
@ -38,11 +38,35 @@
</div> </div>
<br/> <br/>
<asp:Button runat="server" ID="btnPatSearch" Text="Search" CssClass="btnPatSearch" OnClick="btnPatSearch_OnClick"/> <asp:Button runat="server" ID="btnPatSearch" Text="Search" CssClass="btnPatSearch" OnClick="btnPatSearch_OnClick"/>
</div> </div>
<br/>
<asp:GridView runat="server" ID="gvPatient" BorderColor="red"></asp:GridView> <br/>
<br/>
<br/>
<div style="width: 75%; margin: 0 auto; align-content: center; horiz-align: center">
<asp:GridView runat="server" ID="gvPatient"
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="Patient_id" HeaderText="ID" SortExpression="Patient_id"/>
<asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName"/>
<asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName"/>
<asp:BoundField DataField="DOB" HeaderText="Date of Birth" SortExpression="DOB" DataFormatString="{0:d}" HtmlEncode="False"/>
<asp:BoundField DataField="Gender" HeaderText="Gender" SortExpression="Gender"/>
<asp:BoundField DataField="PhoneNumber" HeaderText="Phone Number" SortExpression="PhoneNumber"/>
<asp:BoundField DataField="Zip" HeaderText="Zip Code" SortExpression="Zip"/>
</Columns>
</asp:GridView></div>
<script type="text/javascript"> <script type="text/javascript">
document.oncontextmenu = rightClick; document.oncontextmenu = rightClick;
@ -53,16 +77,16 @@
</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>
<a href="patNew.aspx">New</a> <asp:Button runat="server" CssClass="standardbtn"/>
</li> </li>
<li> <li>
<a href="patEdit.aspx">Edit</a> <asp:Button runat="server" CssClass="standardbtn"/>
</li> </li>
<li> <li>
<a href="#">Delete</a> <asp:Button runat="server" CssClass="standardbtn"/>
</li> </li>
<%-- <asp:Button runat="server" Text="New" OnClick="btnNew_OnClick" /> --%> <%-- <asp:Button runat="server" Text="New" OnClick="btnNew_OnClick" /> --%>
@ -103,7 +127,8 @@
.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;
} }

146
FWA_MAIN/patSearch.aspx.cs Normal file
View File

@ -0,0 +1,146 @@
using System;
using System.Web.UI;
using System.Data;
using System.Drawing;
using System.Web.UI.WebControls;
namespace FWA_MAIN
{
public partial class patSearch : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnNew_OnClick(object sender, EventArgs e)
{
Response.Redirect("patNew.aspx");
}
private void BindData()
{
DataSet ds = new DataSet();
string patID = Convert.ToString(Session["vPatID"]);
string LNAME = Convert.ToString(Session["vLNAME"]);
string FNAME = Convert.ToString(Session["vFNAME"]);
txtPatID.Text = patID;
txtFNAME.Text = FNAME;
txtLNAME.Text = LNAME;
// if (textHasValues)
// {
ds = PharmacyDataTier.PatientInfoSearch(patID, LNAME, FNAME);
// }
// ds = dt.GetStudents();
gvPatient.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);
}
gvPatient.DataBind();
}
protected void btnPatSearch_OnClick(object sender, EventArgs e)
{
if (txtPatID.Text.Trim().Length > 0 || txtFNAME.Text.Trim().Length > 0 || txtLNAME.Text.Trim().Length > 0)
{
try
{
Session["vPatID"] = txtPatID.Text.Trim();
Session["vFNAME"] = txtFNAME.Text.Trim();
Session["vLNAME"] = txtLNAME.Text.Trim();
Cache.Remove("StudentData");
BindData();
}
catch (Exception exception)
{
}
}
}
protected void gvPatient_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvPatient, "Select$" + e.Row.RowIndex);
e.Row.ToolTip = "Click to select this row.";
}
// if (e.Row.RowType == DataControlRowType.DataRow)
// {
// // Clear any previous selection style
// e.Row.Style.Remove(HtmlTextWriterStyle.BackgroundColor);
//
// if (e.Row.RowIndex == gvPatient.SelectedIndex)
// {
// // Apply the selected style
// e.Row.Style.Add(HtmlTextWriterStyle.BackgroundColor, "LightBlue");
// }
// }
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (GridViewRow row in gvPatient.Rows)
{
// if (row.RowIndex == gvPatient.SelectedIndex)
// {
// row.BackColor = Color.Aqua;
// row.ToolTip = string.Empty;
// }
// else
// {
// row.BackColor = Color.Black;
// row.ToolTip = "Click to select this row.";
// }
}
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 (gvPatient.SelectedIndex == index)
{
// Deselect the row
gvPatient.SelectedIndex = -1;
}
else
{
// Select the row
gvPatient.SelectedIndex = index;
}
// Refresh the GridView to update the style
gvPatient.DataBind();
}
}
}
}

View File

@ -11,7 +11,7 @@ namespace FWA_MAIN
{ {
public partial class patient public partial class patSearch
{ {
/// <summary> /// <summary>

View File

@ -1,25 +0,0 @@
using System;
using System.Web.UI;
namespace FWA_MAIN
{
public partial class patient : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnNew_OnClick(object sender, EventArgs e)
{
Response.Redirect("patNew.aspx");
}
protected void btnPatSearch_OnClick(object sender, EventArgs e)
{
}
}
}