protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["visitId"] != null) { Session["ExistingRecordPatientMasterVisitID"] = Request.QueryString["visitId"].ToString(); } else { Session["ExistingRecordPatientMasterVisitID"] = "0"; } if (!IsPostBack) { LookupLogic lookUp = new LookupLogic(); var dataTable = lookUp.GetCouncellingTypes(); ddlCounsellingType.Items.Add(new ListItem("Select", "0")); foreach (DataRow row in dataTable.Rows) { var ID = row["ID"].ToString(); var Name = row["Name"].ToString(); ddlCounsellingType.Items.Add(new ListItem(Name, ID)); } } }
public List <CounsellingData> GetPatientFollowupEducationData() { LookupLogic lookupLogic = new LookupLogic(); PatientManager patientManager = new PatientManager(); int patientId = Convert.ToInt32(Session["PatientPK"]); PatientEntity patient = patientManager.GetPatientEntity(patientId); int ptn_pk = patient.ptn_pk.HasValue ? patient.ptn_pk.Value : 0; HIVEducationLogic hivEducationLogic = new HIVEducationLogic(); var types = lookupLogic.GetCouncellingTypes(); var topics = lookupLogic.GetCouncellingTopics(); var data = hivEducationLogic.GetPatientFollowupEducationData(ptn_pk); List <CounsellingData> counsellingData = new List <CounsellingData>(); foreach (DataRow row in data.Rows) { var councellingTypeId = Convert.ToInt32(row["CouncellingTypeId"].ToString()); var councellingTopicId = Convert.ToInt32(row["CouncellingTopicId"].ToString()); var visitDate = row["VisitDate"].ToString(); var comments = row["Comments"].ToString(); DataRow dr = types.AsEnumerable().SingleOrDefault(r => r.Field <int>("ID") == councellingTypeId); DataRow dataRow = topics.AsEnumerable().SingleOrDefault(r => r.Field <int>("ID") == councellingTopicId); counsellingData.Add(new CounsellingData() { CouncellingType = dr["Name"].ToString(), CouncellingTopic = dataRow["Name"].ToString(), VisitDate = visitDate, Comments = comments }); } return(counsellingData); }