public string GetByHN(string hn) { try { using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls()) { DataTable dt = ws.GetAllergyByHN(hn); string StrAllery = ""; foreach (DataRow dr in dt.Rows) { if (StrAllery == "") { StrAllery = dr["AlgEng_Desc"].ToString(); } else { StrAllery += Environment.NewLine + dr["AlgEng_Desc"].ToString(); } } if (StrAllery == "") { StrAllery = "No Know Allergy"; } return(StrAllery); } } catch (Exception ex) { Program.MessageError("FunctionDataCls", "GetAllergyByHN(String HN)", ex, false); return(""); } }
public string ByGetAllergyByHN(string hn) { try { using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls()) { var result = ws.GetAllergyByHN(hn).AsEnumerable(); var strs = result.Select(x => x.Field <string>("AlgEng_Desc")).Where(x => x != null && x.Trim() != "").ToList(); return(string.Join(Environment.NewLine, strs)); } } catch (Exception ex) { Class.globalCls.MessageError("GetAllergyCls", "ByGetAllergyByHN", ex.Message); throw ex; } }