//[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)] public ArrayList GetCounsellingTopics(int counsellingtopics) { LookupLogic lookupLogic = new LookupLogic(); var data = lookupLogic.GetLnkCouncellingTypeTopics(); var topics = lookupLogic.GetCouncellingTopics(); var drows = data.AsEnumerable().Where(r => r.Field <int>("CouncellingTypeId") == counsellingtopics); ArrayList arrayList = new ArrayList(); foreach (var row in drows) { var topic = topics.AsEnumerable() .SingleOrDefault(y => y.Field <int>("ID") == Convert.ToInt32(row["CouncellingTopicId"])); string topicName = topic["Name"].ToString(); int topicId = Convert.ToInt32(topic["ID"].ToString()); arrayList.Add(new { Id = topicId, Value = topicName.Replace("\'", "") }); } return(arrayList); }
protected void ddlCounsellingType_SelectedIndexChanged(object sender, EventArgs e) { LookupLogic lookUp = new LookupLogic(); var dataTable = lookUp.GetCouncellingTopics(); ddlCounsellingTopic.Items.Add(new ListItem("Select", "0")); foreach (DataRow row in dataTable.Rows) { var ID = row["ID"].ToString(); var Name = row["Name"].ToString(); ddlCounsellingTopic.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); }