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

64 lines
2.2 KiB
C#
Raw Normal View History

using System;
using System.Web.UI;
using System.Data;
namespace FWA_MAIN
{
public partial class preEdit : Page
{
protected string preID;
protected void Page_Load(object sender, EventArgs e)
{
preID = Crypt.Decrypt(Request.QueryString["ID"]);
txtRxNum.Enabled = false;
if (!IsPostBack)
{
FillPrescription(preID);
}
}
protected void FillPrescription(string id)
{
var ds = new DataSet();
ds = PharmacyDataTier.PrescriptionInfoSearch(id);
txtRxNum.Text = ds.Tables[0].Rows[0]["RxNum_id"].ToString();
txtAllowed.Text = ds.Tables[0].Rows[0]["numRefills"].ToString();
txtUsed.Text = ds.Tables[0].Rows[0]["pastNumRefills"].ToString();
txtMedID.Text = ds.Tables[0].Rows[0]["Medication_id"].ToString();
txtPhysID.Text = ds.Tables[0].Rows[0]["Physician_id"].ToString();
txtPatID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString();
DateTime date1 = DateTime.Parse(ds.Tables[0].Rows[0]["PrescriptionStart"].ToString());
txtStart.Text = date1.ToString("d");
DateTime date2 = DateTime.Parse(ds.Tables[0].Rows[0]["PrescriptionEnd"].ToString());
txtEnd.Text = date2.ToString("d");
}
protected void btnSavePre_OnClick(object sender, EventArgs e)
{
string rxnum = Val.varchar(txtRxNum, 11);
int allow = Val.IntType(txtAllowed);
int used = Val.IntType(txtUsed);
string medid = Val.MedID(txtMedID);
string phyid = Val.PhyID(txtPhysID);
string patid = Val.PatID(txtPatID);
DateTime start = Val.Date(txtStart);
DateTime end = Val.Date(txtEnd);
PharmacyDataTier.UpdatePrescription(rxnum,patid,medid,phyid,used,allow,start,end);
2024-04-01 13:02:24 -07:00
PharmacyDataTier.RefreshRefill(rxnum);
Response.Redirect("Prescription.aspx");
}
protected void btnCancelPre_OnClick(object sender, EventArgs e)
{
Response.Redirect("Prescription.aspx");
}
}
}