public string addOneTimeEventsTracker(string Stage1DateValue, string Stage2DateValue, string Stage3DateValue,
                                              string SexPartnerDateValue, string INHStartDateValue, string INHCompletion, string CompletionDate, string adultVaccine, string vaccines)
        {
            try
            {
                var jss = new JavaScriptSerializer();
                IList <ListVaccination> data = jss.Deserialize <IList <ListVaccination> >(vaccines);

                var dataAdult = jss.Deserialize <IList <Object> >(adultVaccine);


                PatientDisclosureManager  disclosure         = new PatientDisclosureManager();
                INHProphylaxisManager     inhProphylaxis     = new INHProphylaxisManager();
                PatientVaccinationManager patientVaccination = new PatientVaccinationManager();

                int patientId = int.Parse(HttpContext.Current.Session["PatientPK"].ToString());
                //int patientId = int.Parse(Session["PatientId"].ToString());
                int patientMasterVisitId = int.Parse(Session["PatientMasterVisitId"].ToString());

                if (String.IsNullOrEmpty(INHCompletion) || String.IsNullOrWhiteSpace(INHCompletion) ||
                    INHCompletion == "null")
                {
                    INHCompletion = "false";
                }

                if (String.IsNullOrEmpty(CompletionDate))
                {
                    IsCompletionDate = null;
                }
                else
                {
                    IsCompletionDate = DateTime.Parse(CompletionDate);
                }

                if (String.IsNullOrEmpty(INHStartDateValue))
                {
                    IsINHStartDateValue = null;
                }
                else
                {
                    IsINHStartDateValue = DateTime.Parse(INHStartDateValue);
                }


                if (!String.IsNullOrWhiteSpace(Stage1DateValue))
                {
                    List <PatientDisclosure> patientDisclosures = disclosure.GetPatientDisclosure(patientId, "Adolescents", "Stage1");
                    if (patientDisclosures.Count > 0)
                    {
                        patientDisclosures[0].DisclosureDate = DateTime.Parse(Stage1DateValue);
                        disclosure.UpdatePatientDisclosure(patientDisclosures[0]);
                    }
                    else
                    {
                        disclosure.AddPatientDisclosure(patientId, patientMasterVisitId, "Adolescents", "Stage1", DateTime.Parse(Stage1DateValue));
                    }
                }

                if (!String.IsNullOrWhiteSpace(Stage2DateValue))
                {
                    List <PatientDisclosure> patientDisclosures = disclosure.GetPatientDisclosure(patientId, "Adolescents", "Stage2");
                    if (patientDisclosures.Count > 0)
                    {
                        patientDisclosures[0].DisclosureDate = DateTime.Parse(Stage2DateValue);
                        disclosure.UpdatePatientDisclosure(patientDisclosures[0]);
                    }
                    else
                    {
                        disclosure.AddPatientDisclosure(patientId, patientMasterVisitId, "Adolescents", "Stage2", DateTime.Parse(Stage2DateValue));
                    }
                }

                if (!String.IsNullOrWhiteSpace(Stage3DateValue))
                {
                    List <PatientDisclosure> patientDisclosures = disclosure.GetPatientDisclosure(patientId, "Adolescents", "Stage3");
                    if (patientDisclosures.Count > 0)
                    {
                        patientDisclosures[0].DisclosureDate = DateTime.Parse(Stage3DateValue);
                        disclosure.UpdatePatientDisclosure(patientDisclosures[0]);
                    }
                    else
                    {
                        disclosure.AddPatientDisclosure(patientId, patientMasterVisitId, "Adolescents", "Stage3", DateTime.Parse(Stage3DateValue));
                    }
                }

                if (!String.IsNullOrWhiteSpace(SexPartnerDateValue))
                {
                    List <PatientDisclosure> patientDisclosures = disclosure.GetPatientDisclosure(patientId, "Adolescents", "SexPartner");
                    if (patientDisclosures.Count > 0)
                    {
                        patientDisclosures[0].DisclosureDate = DateTime.Parse(SexPartnerDateValue);
                        disclosure.UpdatePatientDisclosure(patientDisclosures[0]);
                    }
                    else
                    {
                        disclosure.AddPatientDisclosure(patientId, patientMasterVisitId, "Adolescents", "SexPartner", DateTime.Parse(SexPartnerDateValue));
                    }
                }

                List <INHProphylaxis> inhListsProphylaxes = inhProphylaxis.GetPatientProphylaxes(patientId);
                if (inhListsProphylaxes.Count > 0)
                {
                    inhListsProphylaxes[0].StartDate      = IsINHStartDateValue;
                    inhListsProphylaxes[0].CompletionDate = IsCompletionDate;
                    inhListsProphylaxes[0].Complete       = Boolean.Parse(INHCompletion);
                    inhProphylaxis.updateINHProphylaxis(inhListsProphylaxes[0]);
                }
                else
                {
                    INHProphylaxis prophylaxis = new INHProphylaxis()
                    {
                        PatientId            = patientId,
                        PatientMasterVisitId = patientMasterVisitId,
                        StartDate            = IsINHStartDateValue,
                        Complete             = Boolean.Parse(INHCompletion),
                        CompletionDate       = IsCompletionDate
                    };

                    inhProphylaxis.addINHProphylaxis(prophylaxis);
                }
                var lookup = new LookupLogic();

                for (var i = 0; i < data.Count; i++)
                {
                    PatientVaccination patientVaccine = new PatientVaccination()
                    {
                        PatientId            = patientId,
                        PatientMasterVisitId = patientMasterVisitId,
                        Vaccine      = lookup.GetItemIdByGroupAndDisplayName(data[i].vaccineType, data[i].vaccineStage)[0].ItemId,// LookupLogic.GetLookUpMasterId(data[i].vaccineType),
                        VaccineStage = data[i].vaccineStage
                    };
                    var vaccineExistsChild =
                        patientVaccination.VaccineExists(patientId, patientVaccine.Vaccine, data[i].vaccineStage);
                    if (vaccineExistsChild.Count == 0)
                    {
                        patientVaccination.addPatientVaccination(patientVaccine);
                    }
                }

                for (var i = 0; i < dataAdult.Count; i++)
                {
                    int vaccine = 0;
                    if (dataAdult[i].ToString() == "FluVaccine" || dataAdult[i].ToString() == "HBV")
                    {
                        vaccine = lookup.GetItemIdByGroupAndDisplayName(dataAdult[i].ToString(),
                                                                        dataAdult[i].ToString())[0]
                                  .ItemId; //LookupLogic.GetLookUpMasterId(dataAdult[i].ToString());
                    }

                    if (dataAdult[i].ToString() != "")
                    {
                        PatientVaccination patientVaccine = new PatientVaccination()
                        {
                            PatientId            = patientId,
                            PatientMasterVisitId = patientMasterVisitId,
                            Vaccine      = vaccine,
                            VaccineStage = dataAdult[i].ToString()
                        };

                        var vaccineExists = patientVaccination.VaccineExists(patientId, vaccine, dataAdult[i].ToString());
                        if (vaccineExists.Count == 0)
                        {
                            patientVaccination.addPatientVaccination(patientVaccine);
                        }
                    }
                }

                Msg = "Successfully Added OnIime Event Tracker";
            }
            catch (SoapException ex)
            {
                Msg = ex.Message + ' ' + ex.InnerException;
            }
            return(Msg);
        }
        public string GetOneTimeEventsTrackerDetails()
        {
            try
            {
                int patientId = int.Parse(HttpContext.Current.Session["PatientPK"].ToString());
                PatientDisclosureManager  disclosure           = new PatientDisclosureManager();
                INHProphylaxisManager     inhProphylaxis       = new INHProphylaxisManager();
                PatientVaccinationManager vaccinationManager   = new PatientVaccinationManager();
                OneTimeEventsDetails      oneTimeEventsDetails = new OneTimeEventsDetails();
                oneTimeEventsDetails.ChildVaccination = new List <object>();

                List <PatientDisclosure> patientDisclosures  = disclosure.GetAllPatientDisclosures(patientId);
                List <INHProphylaxis>    inhListsProphylaxes = inhProphylaxis.GetPatientProphylaxes(patientId);
                var vaccinations = vaccinationManager.GetPatientVaccinations(patientId);
                oneTimeEventsDetails.PatientId = 0;

                int checkOneTimeEventsdone = 0;

                if (patientDisclosures.Count > 0)
                {
                    checkOneTimeEventsdone++;
                    foreach (var itemDisclosure in patientDisclosures)
                    {
                        if (itemDisclosure.Category == "Adolescents" && itemDisclosure.DisclosureStage == "Stage1")
                        {
                            oneTimeEventsDetails.Stage1Date = itemDisclosure.DisclosureDate.ToString();
                        }

                        if (itemDisclosure.Category == "Adolescents" && itemDisclosure.DisclosureStage == "Stage2")
                        {
                            oneTimeEventsDetails.Stage2Date = itemDisclosure.DisclosureDate.ToString();
                        }

                        if (itemDisclosure.Category == "Adolescents" && itemDisclosure.DisclosureStage == "Stage3")
                        {
                            oneTimeEventsDetails.Stage3Date = itemDisclosure.DisclosureDate.ToString();
                        }

                        if (itemDisclosure.Category == "Adolescents" && itemDisclosure.DisclosureStage == "SexPartner")
                        {
                            oneTimeEventsDetails.SexPartner = itemDisclosure.DisclosureDate.ToString();
                        }
                    }
                }

                if (inhListsProphylaxes.Count > 0)
                {
                    checkOneTimeEventsdone++;
                    oneTimeEventsDetails.StartDate      = inhListsProphylaxes[0].StartDate.ToString();
                    oneTimeEventsDetails.Complete       = Convert.ToInt32(inhListsProphylaxes[0].Complete);
                    oneTimeEventsDetails.CompletionDate = inhListsProphylaxes[0].CompletionDate.ToString();
                }

                if (vaccinations.Count > 0)
                {
                    checkOneTimeEventsdone++;
                    foreach (var itemVaccination in vaccinations)
                    {
                        if (itemVaccination.VaccineStage == "FluVaccine")
                        {
                            oneTimeEventsDetails.FluVaccine = "1";
                        }
                        else if (itemVaccination.VaccineStage == "HBV")
                        {
                            oneTimeEventsDetails.HBV = "1";
                        }
                        else if (itemVaccination.Vaccine == 0)
                        {
                            oneTimeEventsDetails.OtherVaccination = itemVaccination.VaccineStage;
                        }
                        else
                        {
                            //var lookuplogic = new LookupLogic();
                            itemVaccination.Name = LookupLogic.GetLookupMasterNameByMasterIdDisplayName(itemVaccination.Vaccine, itemVaccination.VaccineStage);
                            //var ItemId = lookuplogic.GetItemIdByGroupAndItemName("Vaccinations", itemVaccination.Name);
                            itemVaccination.Id = itemVaccination.Vaccine;
                            oneTimeEventsDetails.AddChildVaccination(itemVaccination);
                            //oneTimeEventsDetails.ChildVaccination.Add(oneTimeEventsDetails);
                        }
                    }
                }

                if (checkOneTimeEventsdone > 0)
                {
                    oneTimeEventsDetails.PatientId = patientId;
                }

                //Msg = JsonConvert.SerializeObject(oneTimeEventsDetails);
                Msg = new JavaScriptSerializer().Serialize(oneTimeEventsDetails);
            }
            catch (Exception e)
            {
                Msg = e.Message;
            }
            return(Msg);
        }