CNSA-216-FP/FWA_MAIN/medEdit.aspx.cs
2024-04-03 10:01:25 -04:00

71 lines
2.3 KiB
C#

using System;
using System.Data;
using System.Web.UI;
namespace FWA_MAIN
{
public partial class medEdit : Page
{
protected string medID;
protected void Page_Load(object sender, EventArgs e)
{
medID = Crypt.Decrypt(Request.QueryString["ID"]);
txtMedID.Enabled = false;
if (!IsPostBack)
{
FillMedication(medID);
}
}
protected void FillMedication(string id)
{
var ds = new DataSet();
ds = PharmacyDataTier.MedicationInfoSearch(medID);
txtMedID.Text = ds.Tables[0].Rows[0]["Medication_id"].ToString();
txtMedName.Text = ds.Tables[0].Rows[0]["MedicationName"].ToString();
txtIntake.Text = ds.Tables[0].Rows[0]["IntakeMethod"].ToString();
txtPatID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString();
txtFrequency.Text = ds.Tables[0].Rows[0]["Frequency"].ToString();
txtDosage.Text = ds.Tables[0].Rows[0]["Dosage"].ToString();
txtPurpose.Text = ds.Tables[0].Rows[0]["Purpose"].ToString();
txtRxNum.Text = ds.Tables[0].Rows[0]["RxNum"].ToString();
}
protected void btnCancelMed_OnClick(object sender, EventArgs e)
{
Response.Redirect("mediSearch.aspx");
}
protected void btnSaveMed_OnClick(object sender, EventArgs e)
{
string id = Val.varchar(txtMedID, 7);
string medName = Val.varchar(txtMedName, 60);
string intake = Val.varchar(txtIntake, 30);
string patID = Val.varchar(txtPatID, 1);
string frequency = Val.varchar(txtFrequency, length:30);
string dosage = Val.varchar(txtDosage, length:30);
string purpose = Val.varchar(txtPurpose, length:100);
string rxNum = Val.varchar(txtRxNum, 30);
PharmacyDataTier.UpdateMedication(id, MedicationName:medName, IntakeMethod: intake, Patient_id:patID, Frequency: frequency, Dosage: dosage, Purpose: purpose, RxNum: rxNum);
Response.Redirect("mediSearch.aspx");
}
}
}