void LoadExistingData() { LookupLogic lookUp = new LookupLogic(); PatientEncounterLogic encounterLogic = new PatientEncounterLogic(); List <Entities.CCC.Encounter.PatientEncounter.PharmacyFields> lst = encounterLogic.getPharmacyFields(Session["ExistingRecordPatientMasterVisitID"].ToString() == "0" ? Session["PatientMasterVisitID"].ToString() : Session["ExistingRecordPatientMasterVisitID"].ToString()); if (lst.Count > 0) { ddlTreatmentProgram.SelectedValue = lst[0].TreatmentProgram; ddlPeriodTaken.SelectedValue = lst[0].PeriodTaken; ddlTreatmentPlan.SelectedValue = lst[0].TreatmentPlan; DataTable theDT = encounterLogic.getPharmacyDrugSwitchInterruptionReason(ddlTreatmentPlan.SelectedValue); ddlSwitchInterruptionReason.Items.Add(new ListItem("Select", "0")); for (int i = 0; i < theDT.Rows.Count; i++) { ddlSwitchInterruptionReason.Items.Add(new ListItem(theDT.Rows[i]["DisplayName"].ToString(), theDT.Rows[i]["LookupItemId"].ToString())); } ddlSwitchInterruptionReason.SelectedValue = lst[0].TreatmentPlanReason; //ScriptManager.RegisterStartupScript(this, this.GetType(), "treatmentPlan", "drugSwitchInterruptionReason(" + ddlTreatmentPlan.SelectedValue + ");", true); regimenLine.SelectedValue = lst[0].RegimenLine; ////////////////////////////////////////////////////////////////////////////////////// //var masterName = Regex.Replace(regimenLine.SelectedItem.Text, @"\s+", ""); var masterName = regimenLine.SelectedItem.Text.Replace(" ", String.Empty); /////////////////////////////////////////////////////////////////////////// PatientEncounterLogic patientEncounter = new PatientEncounterLogic(); DataTable theDTReg = patientEncounter.getPharmacyRegimens(masterName); ddlRegimen.Items.Add(new ListItem("Select", "0")); foreach (DataRow row in theDTReg.Rows) { ddlRegimen.Items.Add(new ListItem(row["DisplayName"].ToString(), row["LookupItemId"].ToString())); } //////////////////////////////////////////// //var result = LookupLogic.GetLookUpItemViewByMasterName(masterName); //JavaScriptSerializer parser = new JavaScriptSerializer(); //var regimen = parser.Deserialize<List<Entities.CCC.Encounter.PatientEncounter.KeyValue>>(result); //ddlRegimen.Items.Add(new ListItem("Select", "0")); //for (int i = 0; i < regimen.Count; i++) //{ // ddlRegimen.Items.Add(new ListItem(regimen[i].DisplayName, regimen[i].ItemId)); //} ///////////////////////////////////////////////////////////////////////////////////////// ddlRegimen.SelectedValue = lst[0].Regimen; txtPrescriptionDate.Text = lst[0].prescriptionDate; txtPrescriptionDate.Text = lst[0].dispenseDate; prescriptionDate = lst[0].prescriptionDate; dispenseDate = lst[0].dispenseDate; //ScriptManager.RegisterStartupScript(this, this.GetType(), "regimen", "selectRegimens(" + regimenLine.SelectedValue + ");", true); } }