private string SaveScreeningData(string nodeJson, int ptn_pk, int visitPK, int locationId, int userId) { string result = string.Empty; ResponseType ObjResponse = new ResponseType(); try { HIVCE.Common.Entities.DBScreeningData obj = SerializerUtil.ConverToObject <HIVCE.Common.Entities.DBScreeningData>(nodeJson); IClinicalEncounter clinicalencounter = (IClinicalEncounter)ObjectFactory.CreateInstance("HIVCE.BusinessLayer.BLClinicalEncounter, HIVCE.BusinessLayer"); obj.Ptn_Pk = ptn_pk; obj.Visit_Id = visitPK; obj.LocationId = locationId; //result = SerializerUtil.ConverToJson<PresentingComplaint>(obj); bool flag = clinicalencounter.SaveUpdateScreeningData(obj, userId, locationId); if (flag) { ObjResponse.Success = EnumUtil.GetEnumDescription(Success.True); } else { ObjResponse.Success = EnumUtil.GetEnumDescription(Success.False); } } catch (Exception ex) { ObjResponse.Success = EnumUtil.GetEnumDescription(Success.False); } finally { } result = SerializerUtil.ConverToJson <ResponseType>(ObjResponse); return(result); }
private string GetScreeningData(int ptn_pk, int visitPK, int locationId) { string result = string.Empty; try { IQCareUtils theUtils = new IQCareUtils(); double age = Convert.ToDouble(Session["patientageinyearmonth"].ToString()); List <CodeDeCodeTables> collections = new List <CodeDeCodeTables>(); DataSet theDSXML = new DataSet(); theDSXML.ReadXml(MapPath("..\\XMLFiles\\AllMasters.con")); DataView theCodeDV = new DataView(oCommonData.getAllMSTCode()); if (age <= 15) { theCodeDV.RowFilter = "DeleteFlag=0 and Name in ('TBICFPaeds','TBFindings','IPT','CXR','TBRegimen','SputumSmear','GeneExpert','SputumDST','IPTAdherence','IPTContraindication','IPTDiscontinued')"; } else { theCodeDV.RowFilter = "DeleteFlag=0 and Name in ('TBAssessmentICF','TBFindings','IPT','CXR','TBRegimen','SputumSmear','GeneExpert','SputumDST','IPTAdherence','IPTContraindication','IPTDiscontinued')"; } DataTable theCodeDT = (DataTable)theUtils.CreateTableFromDataView(theCodeDV); DataTable theDT = new DataTable(); if (theCodeDT.Rows.Count > 0) { foreach (DataRow row in theCodeDT.Rows) { //DataView theDV = new DataView(theDSXML.Tables["MST_DECODE"]); DataView theDV = new DataView(oCommonData.getMSTDecode(Convert.ToInt32(row["CodeId"]))); theDV.RowFilter = "DeleteFlag=0 and CodeID=" + row["CodeId"] + " and Name Not in ('Transferred out')"; theDT = (DataTable)theUtils.CreateTableFromDataView(theDV); List <CodeDeCodeTables> collections1 = new List <CodeDeCodeTables>(); collections1 = (from dt in theDT.AsEnumerable() select new CodeDeCodeTables() { CodeId = Convert.ToInt32(row["CodeId"]), CodeName = Convert.ToString(row["Name"]), DeCodeId = dt.Field <int>("Id"), DeCodeName = dt.Field <string>("NAME") }).ToList(); collections.AddRange(collections1); } } theCodeDV = new DataView(theDSXML.Tables["MST_BLUECODE"]); theCodeDV.RowFilter = "DeleteFlag=0 and Name in ('TB Status')"; theCodeDT = (DataTable)theUtils.CreateTableFromDataView(theCodeDV); theDT = new DataTable(); if (theCodeDT.Rows.Count > 0) { foreach (DataRow row in theCodeDT.Rows) { DataView theDV = new DataView(theDSXML.Tables["MST_BLUEDECODE"]); theDV.RowFilter = "DeleteFlag=0 and CodeID=" + row["CodeId"] + ""; theDT = (DataTable)theUtils.CreateTableFromDataView(theDV); List <CodeDeCodeTables> collections1 = new List <CodeDeCodeTables>(); collections1 = (from dt in theDT.AsEnumerable() select new CodeDeCodeTables() { CodeId = dt.Field <int>("codeid"), CodeName = "TBStatus", DeCodeId = dt.Field <int>("Id"), DeCodeName = dt.Field <string>("NAME") }).ToList(); collections.AddRange(collections1); } } IClinicalEncounter clinicalencounter = (IClinicalEncounter)ObjectFactory.CreateInstance("HIVCE.BusinessLayer.BLClinicalEncounter, HIVCE.BusinessLayer"); HIVCE.Common.Entities.DBScreeningData obj = clinicalencounter.GetScreeningData(ptn_pk, visitPK, locationId); obj.Collections = new List <CodeDeCodeTables>(); if (collections.Count > 0) { obj.Collections = collections; } result = SerializerUtil.ConverToJson <HIVCE.Common.Entities.DBScreeningData>(obj); } catch (Exception ex) { ///CLogger.WriteLog(ELogLevel.ERROR, "GetAnnouncements() exception: " + ex.ToString()); ResponseType response = new ResponseType() { Success = EnumUtil.GetEnumDescription(Success.False) }; result = SerializerUtil.ConverToJson <ResponseType>(response); } finally { } return(result); }