211 lines
6.1 KiB
C#
211 lines
6.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FWA_MAIN
|
|
{
|
|
public partial class physician : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
|
|
txtPhysID.Text = Convert.ToString(Session["vPhysPhysID"]);
|
|
txtFNAME.Text = Convert.ToString(Session["vPhysFNAME"]);
|
|
txtLNAME.Text = Convert.ToString(Session["vPhysLNAME"]);
|
|
|
|
btnPhySearch_OnClick(sender,e);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void BindData()
|
|
{
|
|
|
|
DataSet ds = new DataSet();
|
|
|
|
string physID = Convert.ToString(Session["vPhysPhysID"]);
|
|
string LNAME = Convert.ToString(Session["vPhysLNAME"]);
|
|
string FNAME = Convert.ToString(Session["vPhysFNAME"]);
|
|
|
|
txtPhysID.Text = physID;
|
|
txtFNAME.Text = FNAME;
|
|
txtLNAME.Text = LNAME;
|
|
|
|
// if (textHasValues)
|
|
// {
|
|
ds = PharmacyDataTier.PhysicianInfoSearch(FNAME, LNAME, physID);
|
|
// }
|
|
|
|
|
|
// ds = dt.GetStudents();
|
|
gvPhysician.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);
|
|
}
|
|
gvPhysician.DataBind();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnPhysDelete_OnClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
|
|
PharmacyDataTier.DeletePhysician(gvPhysician.SelectedRow.Cells[0].Text);
|
|
BindData();
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
protected void bntPhysEdit_OnClick(object sender, EventArgs e)
|
|
{
|
|
string physicianID = "0";
|
|
Int64 mEditedRecord = 0;
|
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
|
|
|
try
|
|
{
|
|
Session["vPhysPhysID"] = txtPhysID.Text.Trim();
|
|
Session["vPhysFNAME"] = txtFNAME.Text.Trim();
|
|
Session["vPhysLNAME"] = txtLNAME.Text.Trim();
|
|
|
|
|
|
try
|
|
{
|
|
|
|
physicianID = Crypt.Encrypt(gvPhysician.SelectedRow.Cells[0].Text);
|
|
Response.Redirect("physedit.aspx" + "?" + "ID=" + physicianID, false);
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
}
|
|
|
|
// Use the patientID value as needed
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.Message, ex.InnerException);
|
|
}
|
|
}
|
|
|
|
protected void btnPhysNew_OnClick(object sender, EventArgs e)
|
|
{
|
|
string physicianID;
|
|
|
|
try
|
|
{
|
|
Session["vPhysPhysID"] = txtPhysID.Text.Trim();
|
|
Session["vPhysFNAME"] = txtFNAME.Text.Trim();
|
|
Session["vPhysLNAME"] = txtLNAME.Text.Trim();
|
|
|
|
// Use the patientID value as needed
|
|
try
|
|
{
|
|
|
|
physicianID = PharmacyDataTier.GetNextPhysicianID();
|
|
physicianID = Crypt.Encrypt(physicianID);
|
|
Response.Redirect("physnew02.aspx" + "?" + "ID=" + physicianID, false);
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
}
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
protected void btnPhySearch_OnClick(object sender, EventArgs e)
|
|
{
|
|
if (txtPhysID.Text.Trim().Length > 0 || txtFNAME.Text.Trim().Length > 0 || txtLNAME.Text.Trim().Length > 0)
|
|
{
|
|
|
|
|
|
try
|
|
{
|
|
|
|
Session["vPhysPhysID"] = txtPhysID.Text.Trim();
|
|
Session["vPhysFNAME"] = txtFNAME.Text.Trim();
|
|
Session["vPhysLNAME"] = txtLNAME.Text.Trim();
|
|
|
|
Cache.Remove("StudentData");
|
|
BindData();
|
|
|
|
|
|
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void gvPhysician_OnRowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvPhysician, "Select$" + e.Row.RowIndex);
|
|
e.Row.ToolTip = "Click to select this row.";
|
|
}
|
|
}
|
|
|
|
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
BindData();
|
|
}
|
|
|
|
protected void gvPhysician_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 (gvPhysician.SelectedIndex == index)
|
|
{
|
|
// Deselect the row
|
|
gvPhysician.SelectedIndex = -1;
|
|
}
|
|
else
|
|
{
|
|
// Select the row
|
|
gvPhysician.SelectedIndex = index;
|
|
}
|
|
|
|
// Refresh the GridView to update the style
|
|
gvPhysician.DataBind();
|
|
}
|
|
}
|
|
}
|
|
} |