2024-03-28 12:08:12 -04:00
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
|
2024-03-28 15:04:52 -04:00
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
txtPatID.Text = Convert.ToString(Session["vPatID"]);
|
|
|
|
|
txtFNAME.Text = Convert.ToString(Session["vFNAME"]);
|
|
|
|
|
txtLNAME.Text = Convert.ToString(Session["vLNAME"]);
|
|
|
|
|
|
|
|
|
|
btnPatSearch_OnClick(sender,e);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-28 12:08:12 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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.";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-28 15:04:52 -04:00
|
|
|
|
|
|
|
|
|
protected void btnPatNew_OnClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
string patientID;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Session["vPatID"] = txtPatID.Text.Trim();
|
|
|
|
|
Session["vFNAME"] = txtFNAME.Text.Trim();
|
|
|
|
|
Session["vLNAME"] = txtLNAME.Text.Trim();
|
|
|
|
|
|
|
|
|
|
patientID = PharmacyDataTier.GetNextPatientID();
|
|
|
|
|
patientID = Crypt.Encrypt(patientID);
|
|
|
|
|
// Use the patientID value as needed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Response.Redirect("patNew.aspx" + "?" + "ID=" + patientID, false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(ex.Message, ex.InnerException);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void bntPatEdit_OnClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string patientID = "0";
|
|
|
|
|
Int64 mEditedRecord = 0;
|
|
|
|
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Session["vPatID"] = txtPatID.Text.Trim();
|
|
|
|
|
Session["vFNAME"] = txtFNAME.Text.Trim();
|
|
|
|
|
Session["vLNAME"] = txtLNAME.Text.Trim();
|
|
|
|
|
|
|
|
|
|
if (gvPatient.SelectedIndex >= 0) // Check if a row is selected
|
|
|
|
|
{
|
|
|
|
|
patientID = Crypt.Encrypt(gvPatient.SelectedRow.Cells[0].Text);
|
|
|
|
|
// Use the patientID value as needed
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw new Exception();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Response.Redirect("patEdit.aspx" + "?" + "ID=" + patientID, false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(ex.Message, ex.InnerException);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnPatDelete_OnClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2024-03-28 12:08:12 -04:00
|
|
|
|
}
|
|
|
|
|
}
|