private string GetZScoreDetails(int ptn_pk, int visitPK, int locationId) { string result = string.Empty; try { IClinicalEncounter clinicalencounter = (IClinicalEncounter)ObjectFactory.CreateInstance("HIVCE.BusinessLayer.BLClinicalEncounter, HIVCE.BusinessLayer"); HIVCE.Common.Entities.ClinicalEncounter cl = clinicalencounter.GetData(ptn_pk, visitPK, locationId); DataSet ZScoreDS = new DataSet(); IKNHStaticForms KNHS = (IKNHStaticForms)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BKNHStaticForms, BusinessProcess.Clinical"); string height = string.IsNullOrEmpty(cl.PatientVitals.Height) == true ? "0" : cl.PatientVitals.Height; ZScoreDS = KNHS.GetZScoreNewImplementation(ptn_pk, Session["PatientSex"].ToString(), height.ToString()); ZScoreDetails zs = new ZScoreDetails(); zs.WFA = new ZScore(); zs.WFH = new ZScore(); zs.BMIz = new ZScore(); if (ZScoreDS.Tables[0].Rows.Count > 0) { DataColumnCollection columns = ZScoreDS.Tables[0].Columns; if (columns.Contains("L")) { zs.WFA.L = Convert.ToDouble(ZScoreDS.Tables[0].Rows[0]["L"].ToString()); zs.WFA.M = Convert.ToDouble(ZScoreDS.Tables[0].Rows[0]["M"].ToString()); zs.WFA.S = Convert.ToDouble(ZScoreDS.Tables[0].Rows[0]["S"].ToString()); } } if (ZScoreDS.Tables[1].Rows.Count > 0) { DataColumnCollection columns = ZScoreDS.Tables[1].Columns; if (columns.Contains("L")) { zs.WFH.L = Convert.ToDouble(ZScoreDS.Tables[1].Rows[0]["L"].ToString()); zs.WFH.M = Convert.ToDouble(ZScoreDS.Tables[1].Rows[0]["M"].ToString()); zs.WFH.S = Convert.ToDouble(ZScoreDS.Tables[1].Rows[0]["S"].ToString()); } } if (ZScoreDS.Tables[2].Rows.Count > 0) { DataColumnCollection columns = ZScoreDS.Tables[2].Columns; if (columns.Contains("L")) { zs.BMIz.L = Convert.ToDouble(ZScoreDS.Tables[2].Rows[0]["L"].ToString()); zs.BMIz.M = Convert.ToDouble(ZScoreDS.Tables[2].Rows[0]["M"].ToString()); zs.BMIz.S = Convert.ToDouble(ZScoreDS.Tables[2].Rows[0]["S"].ToString()); } } ZScoreDS.Dispose(); result = SerializerUtil.ConverToJson <HIVCE.Common.Entities.ZScoreDetails>(zs); } catch (Exception ex) { CLogger.WriteLog(ELogLevel.ERROR, "GetZScoreDetails() exception: " + ex.ToString()); ResponseType response = new ResponseType() { Success = EnumUtil.GetEnumDescription(Success.False) }; result = SerializerUtil.ConverToJson <ResponseType>(response); } finally { } return(result); }
private string GetZScoreDetails(int ptn_pk, int visitPK, int locationId) { string result = string.Empty; try { IPrEP iPrepFacility = (IPrEP)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPrEP, BusinessProcess.Clinical"); Entities.Common.PrEP pz = iPrepFacility.GetPrEPTriageData(ptn_pk, visitPK, locationId); DataSet zscoreds = new DataSet(); IKNHStaticForms knhs = (IKNHStaticForms)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BKNHStaticForms, BusinessProcess.Clinical"); string height = string.IsNullOrEmpty(pz.PatientVitals.Height) == true ? "0" : pz.PatientVitals.Height; zscoreds = knhs.GetZScoreNewImplementation(ptn_pk, Session["patientsex"].ToString(), height.ToString()); ZScoreDetails zs = new ZScoreDetails(); zs.WFA = new ZScore(); zs.WFH = new ZScore(); zs.BMIz = new ZScore(); if (zscoreds.Tables[0].Rows.Count > 0) { DataColumnCollection columns = zscoreds.Tables[0].Columns; if (columns.Contains("L")) { zs.WFA.L = Convert.ToDouble(zscoreds.Tables[0].Rows[0]["L"].ToString()); zs.WFA.M = Convert.ToDouble(zscoreds.Tables[0].Rows[0]["M"].ToString()); zs.WFA.S = Convert.ToDouble(zscoreds.Tables[0].Rows[0]["S"].ToString()); } } if (zscoreds.Tables[1].Rows.Count > 0) { DataColumnCollection columns = zscoreds.Tables[1].Columns; if (columns.Contains("L")) { zs.WFH.L = Convert.ToDouble(zscoreds.Tables[1].Rows[0]["L"].ToString()); zs.WFH.M = Convert.ToDouble(zscoreds.Tables[1].Rows[0]["M"].ToString()); zs.WFH.S = Convert.ToDouble(zscoreds.Tables[1].Rows[0]["S"].ToString()); } } if (zscoreds.Tables[2].Rows.Count > 0) { DataColumnCollection columns = zscoreds.Tables[2].Columns; if (columns.Contains("L")) { zs.BMIz.L = Convert.ToDouble(zscoreds.Tables[2].Rows[0]["L"].ToString()); zs.BMIz.M = Convert.ToDouble(zscoreds.Tables[2].Rows[0]["M"].ToString()); zs.BMIz.S = Convert.ToDouble(zscoreds.Tables[2].Rows[0]["S"].ToString()); } } zscoreds.Dispose(); result = SerializerUtil.ConverToJson <Entities.Common.ZScoreDetails>(zs); } catch (Exception ex) { CLogger.WriteLog(ELogLevel.ERROR, "getzscoredetails() exception: " + ex.ToString()); ResponseType response = new ResponseType() { Success = EnumUtil.GetEnumDescription(Success.False) }; result = SerializerUtil.ConverToJson <ResponseType>(response); } finally { } return(result); }