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.varchar(txtMedID, 7); string phyid = Val.varchar(txtPhysID, 8); string patid = Val.varchar(txtPatID, 8); DateTime start = Val.Date(txtStart); DateTime end = Val.Date(txtEnd); PharmacyDataTier.UpdatePrescription(rxnum,patid,medid,phyid,used,allow,start,end); Response.Redirect("Prescription.aspx"); } protected void btnCancelPre_OnClick(object sender, EventArgs e) { Response.Redirect("Prescription.aspx"); } } }