public string AddPatientIcf(int patientId, int patientMasterVisitId, int cough, int fever, int nightSweats, int weightLoss, int onAntiTbDrugs, int onIpt, int everBeenOnIpt)
        {
            LookupLogic lookUp = new LookupLogic();
            //cough
            bool?_cough = null;

            if (lookUp.GetLookupItemNameById(cough) == "Yes")
            {
                _cough = true;
            }
            else if (lookUp.GetLookupItemNameById(cough) == "No")
            {
                _cough = false;
            }
            //fever
            bool?_fever = null;

            if (lookUp.GetLookupItemNameById(fever) == "Yes")
            {
                _fever = true;
            }
            else if (lookUp.GetLookupItemNameById(fever) == "No")
            {
                _fever = false;
            }
            //night sweat
            bool?_nightSweat = null;

            if (lookUp.GetLookupItemNameById(nightSweats) == "Yes")
            {
                _nightSweat = true;
            }
            else if (lookUp.GetLookupItemNameById(nightSweats) == "No")
            {
                _nightSweat = false;
            }
            //weight loss
            bool?_WeightLoss = null;

            if (lookUp.GetLookupItemNameById(weightLoss) == "Yes")
            {
                _WeightLoss = true;
            }
            else if (lookUp.GetLookupItemNameById(weightLoss) == "No")
            {
                _WeightLoss = false;
            }
            //onAntiTBdrugs
            bool   _onAntiTbDrugs = false;
            string passedValue    = lookUp.GetLookupItemNameById(onAntiTbDrugs);

            if (passedValue == "Yes")
            {
                _onAntiTbDrugs = true;
            }
            else if (lookUp.GetLookupItemNameById(onAntiTbDrugs) == "No")
            {
                _onAntiTbDrugs = false;
            }
            //onIPT
            bool _onIpt = false;

            if (lookUp.GetLookupItemNameById(onIpt) == "Yes")
            {
                _onIpt = true;
            }
            else if (lookUp.GetLookupItemNameById(onIpt) == "No")
            {
                _onIpt = false;
            }
            //everBeenOnIpt
            bool?_everBeenOnIpt = null;

            if (lookUp.GetLookupItemNameById(everBeenOnIpt) == "Yes")
            {
                _everBeenOnIpt = true;
            }
            else if (lookUp.GetLookupItemNameById(everBeenOnIpt) == "No")
            {
                _everBeenOnIpt = false;
            }
            PatientIcf patientIcf = new PatientIcf()
            {
                PatientId            = patientId,
                PatientMasterVisitId = patientMasterVisitId,
                Cough         = _cough,
                Fever         = _fever,
                NightSweats   = _nightSweat,
                WeightLoss    = _WeightLoss,
                OnIpt         = _onIpt,
                OnAntiTbDrugs = _onAntiTbDrugs,
                EverBeenOnIpt = _everBeenOnIpt
            };

            try
            {
                var icf = new PatientIcfManager();
                var x   = icf.GetByPatientId(patientId).FirstOrDefault(m => m.PatientMasterVisitId == patientMasterVisitId);
                if (x == null)
                {
                    Result = icf.AddPatientIcf(patientIcf);
                }
                else
                {
                    patientIcf.Id = x.Id;
                    Result        = icf.UpdatePatientIcf(patientIcf);
                }
                if (Result > 0)
                {
                    Msg = "Patient ICF saved successfully!";
                }
            }
            catch (Exception e)
            {
                Msg = e.Message;
            }
            return(Msg);
        }
Exemplo n.º 2
0
        public string AddPatientIcf(int patientId, int patientMasterVisitId, string cough, string fever, string nightSweats, string weightLoss, bool onAntiTbDrugs, bool onIpt, bool everBeenOnIpt)
        {
            bool?_cough = null;

            if (cough.Trim().ToLower() == "true")
            {
                _cough = true;
            }
            else if (cough.Trim().ToLower() == "false")
            {
                _cough = false;
            }
            bool?_fever = null;

            if (fever.Trim().ToLower() == "true")
            {
                _fever = true;
            }
            else if (fever.Trim().ToLower() == "false")
            {
                _fever = false;
            }

            bool?_nightSweat = null;

            if (nightSweats.Trim().ToLower() == "true")
            {
                _nightSweat = true;
            }
            else if (nightSweats.Trim().ToLower() == "false")
            {
                _nightSweat = false;
            }

            bool?_WeightLoss = null;

            if (weightLoss.Trim().ToLower() == "true")
            {
                _WeightLoss = true;
            }
            else if (weightLoss.Trim().ToLower() == "false")
            {
                _WeightLoss = false;
            }
            PatientIcf patientIcf = new PatientIcf()
            {
                PatientId            = patientId,
                PatientMasterVisitId = patientMasterVisitId,
                Cough         = _cough,
                Fever         = _fever,
                NightSweats   = _nightSweat,
                WeightLoss    = _WeightLoss,
                OnIpt         = onIpt,
                OnAntiTbDrugs = onAntiTbDrugs,
                EverBeenOnIpt = everBeenOnIpt
            };

            try
            {
                var icf = new PatientIcfManager();
                var x   = icf.GetByPatientId(patientId).FirstOrDefault(m => m.PatientMasterVisitId == patientMasterVisitId);
                if (x == null)
                {
                    Result = icf.AddPatientIcf(patientIcf);
                }
                else
                {
                    patientIcf.Id = x.Id;
                    Result        = icf.UpdatePatientIcf(patientIcf);
                }
                if (Result > 0)
                {
                    Msg = "Patient ICF saved successfully!";
                }
            }
            catch (Exception e)
            {
                Msg = e.Message;
            }
            return(Msg);
        }