106 lines
2.9 KiB
C#
106 lines
2.9 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FWA_MAIN
|
|
{
|
|
public partial class Refills : Page
|
|
{
|
|
protected string preID;
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
preID = Crypt.Decrypt(Request.QueryString["ID"]);
|
|
|
|
|
|
|
|
|
|
Fill();
|
|
|
|
}
|
|
|
|
protected void Fill()
|
|
{
|
|
|
|
var ds = new DataSet();
|
|
ds = PharmacyDataTier.GetRefill(preID);
|
|
gvRefills.DataSource = ds;
|
|
gvRefills.DataBind();
|
|
|
|
}
|
|
|
|
protected void btnRefEdit_OnClick(object sender, EventArgs e)
|
|
{
|
|
string refillID = "0";
|
|
try
|
|
{
|
|
|
|
refillID = Crypt.Encrypt(gvRefills.SelectedRow.Cells[0].Text);
|
|
Response.Redirect("RefEdit.aspx" + "?" + "ID=" + refillID, false);
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
}
|
|
|
|
}
|
|
|
|
protected void btnRefDelete_OnClick(object sender, EventArgs e)
|
|
{
|
|
|
|
try
|
|
{
|
|
|
|
PharmacyDataTier.DeleteRefill(gvRefills.SelectedRow.Cells[0].Text);
|
|
PharmacyDataTier.RefreshRefill(gvRefills.SelectedRow.Cells[4].Text);
|
|
Fill();
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
}
|
|
}
|
|
|
|
protected void gvRefills_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 (gvRefills.SelectedIndex == index)
|
|
{
|
|
// Deselect the row
|
|
gvRefills.SelectedIndex = -1;
|
|
}
|
|
else
|
|
{
|
|
// Select the row
|
|
gvRefills.SelectedIndex = index;
|
|
}
|
|
|
|
// Refresh the GridView to update the style
|
|
gvRefills.DataBind();
|
|
}
|
|
}
|
|
|
|
protected void gvRefills_OnRowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvRefills, "Select$" + e.Row.RowIndex);
|
|
e.Row.ToolTip = "Click to select this row.";
|
|
}
|
|
}
|
|
|
|
protected void gvRefills_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Fill();
|
|
}
|
|
|
|
protected void btnBack_OnClick(object sender, EventArgs e)
|
|
{
|
|
Response.Redirect("Prescription.aspx");
|
|
}
|
|
}
|
|
} |