public Conditions[] GetMedicalHistory(Stream message) { Conditions objInput = JSonHelper.JsonDeserialize<Conditions>(new StreamReader(message).ReadToEnd()); if (System.Configuration.ConfigurationManager.AppSettings[objInput.Pin] == null) { var colconds = new Conditions[1]; Conditions cond = new Conditions(); cond.Condition = ""; cond.ConditionCheck = ""; cond.DateOfOnset = ""; cond.ICDCode = ""; cond.MessengerMessage = "Invalid PIN"; colconds[0] = cond; return colconds; } if (objInput.Pin != null && objInput.Pin.Length > 0) { if (objInput.PatientID > 0) { IList<GHPMedicalHistoryInfo> objcol = new List<GHPMedicalHistoryInfo>(); GHPMedicalHistoryInfo obj = new GHPMedicalHistoryInfo(); GHPMedicalHistoryBLL objbll = new GHPMedicalHistoryBLL(); obj.PatientId = objInput.PatientID; obj.Pin = System.Configuration.ConfigurationManager.AppSettings[objInput.Pin].ToString(); objcol = objbll.GetGHPMedicalHistoryInfo(obj); var colConditions = new Conditions[objcol.Count]; var autoPopUpdata = new List<string>(objcol.Count); if (objcol.Count > 0) { for (var i = 0; i < objcol.Count; i++) { GHPMedicalHistoryInfo medinfo = objcol[i]; Conditions cond = new Conditions(); cond.ConditionID = medinfo.MedicalHistoryId; cond.Condition = medinfo.Condition; cond.ConditionCheck = medinfo.ConditionCheck; cond.DateOfOnset = medinfo.DateofOnset; cond.ICDCode = medinfo.ICDCode; colConditions[i] = cond; //var elementAtOrDefault = objcol.ElementAtOrDefault(i); //if (elementAtOrDefault != null) // autoPopUpdata.Add(string.Format("{0}-{1}-{2}-{3}" // , elementAtOrDefault.Condition, // elementAtOrDefault.ConditionCheck, // elementAtOrDefault.DateofOnset, // elementAtOrDefault.ICDCode // )); } } return colConditions; } else { var colconds = new Conditions[1]; Conditions cond = new Conditions(); cond.Condition = ""; cond.ConditionCheck = ""; cond.DateOfOnset = ""; cond.ICDCode = ""; cond.MessengerMessage = "Patient id is a required field"; colconds[0] = cond; return colconds; } } else { var colconds = new Conditions[1]; Conditions cond = new Conditions(); cond.Condition = ""; cond.ConditionCheck = ""; cond.DateOfOnset = ""; cond.ICDCode = ""; cond.MessengerMessage = "Pin is a required field"; colconds[0] = cond; return colconds; } }
public string UpdateMedicalHistory(Stream message) { Conditions objInput = JSonHelper.JsonDeserialize<Conditions>(new StreamReader(message).ReadToEnd()); if (System.Configuration.ConfigurationManager.AppSettings[objInput.Pin] == null) { return "Invalid PIN"; } if (objInput.Pin != null && objInput.Pin.Length > 0) { if (objInput.PatientID > 0 && objInput.Condition.Length > 0) { IList<GHPMedicalHistoryInfo> objcol = new List<GHPMedicalHistoryInfo>(); GHPMedicalHistoryInfo obj = new GHPMedicalHistoryInfo(); GHPMedicalHistoryBLL objbll = new GHPMedicalHistoryBLL(); obj.MedicalHistoryId = objInput.ConditionID; obj.PatientId = objInput.PatientID; obj.Condition = objInput.Condition; obj.ConditionCheck = objInput.ConditionCheck; obj.DateofOnset = objInput.DateOfOnset; obj.ICDCode = objInput.ICDCode; obj.ActionItem = "INSERT"; DataTransactionReturn ret = objbll.InsertGHPMedicalHistoryInfo(obj); return ret.MedicalHistoryId.ToString(); } else { return "PatientID and Condition is required field"; } } else { return "PIN is a required field"; } }