CNSA-216-FP/FWA_MAIN/RefEdit.aspx.cs

65 lines
1.8 KiB
C#

using System;
using System.Data;
using System.Diagnostics;
using System.Web.UI;
namespace FWA_MAIN
{
public partial class RefEdit : Page
{
protected string refID;
protected void Page_Load(object sender, EventArgs e)
{
txtMedID.Enabled = false;
txtPatID.Enabled = false;
txtPreID.Enabled = false;
txtRefillID.Enabled = false;
if (!IsPostBack)
{
refID = Crypt.Decrypt(Request.QueryString["ID"]);
FillRefill();
}
}
protected void FillRefill()
{
var ds = new DataSet();
ds = PharmacyDataTier.RefillSearch(refID);
txtRefillID.Text = ds.Tables[0].Rows[0]["Refill_id"].ToString();
DateTime date = DateTime.Parse(ds.Tables[0].Rows[0]["RefillDate"].ToString());
txtDate.Text = date.ToString("d");
txtPatID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString();
txtMedID.Text = ds.Tables[0].Rows[0]["Medication_id"].ToString();
txtPreID.Text = ds.Tables[0].Rows[0]["RxNum_id"].ToString();
}
protected void btnSaveRef_OnClick(object sender, EventArgs e)
{
PharmacyDataTier.UpdateRefill(
txtRefillID.Text,
Val.Date(txtDate),
txtPatID.Text,
txtMedID.Text,
txtPreID.Text
);
Response.Redirect("Refills.aspx" + "?" + "ID=" + Crypt.Encrypt(txtPreID.Text), false);
}
protected void btnCancelRef_OnClick(object sender, EventArgs e)
{
Response.Redirect("Refills.aspx" + "?" + "ID=" + Crypt.Encrypt(txtPreID.Text), false);
}
}
}