Esempio n. 1
0
 public IActionResult Create(Result model)
 {
     if (ModelState.IsValid)
     {
         _Result.Add(model);
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Esempio n. 2
0
        public int SeedResult()
        {
            // ** DEV NOTES ** Will encounter threading error if the ToList() method is not called in here
            // -- on the foreach loops. This loads data into memory ...
            // OR the SaveChanges() could be performed at the end of the cycle.

            // initialize objects
            var sessions = _sessionUser.GetAll().ToList();   // 1000 sessions for 10 surveys
            //var surveys = _surveyMaster.GetAll();   // 10
            //var questions = _question.GetAll();     // 25 questions/survey
            //var answerOption = _answerOption.Get(0);
            Random rnd = new Random();

            //for (var x = 1; x <= sessions.Count(); x++)
            foreach (var s in sessions)
            {
                // get the session and survey
                var session = _sessionUser.Get(s.Id);
                var survey  = _surveyMaster.Get(s.SurveyMaster.Id);

                // get all questions for (each) survey
                var questions = _surveyQuestion.GetAllBySurveyId(s.SurveyMaster.Id).ToList();
                foreach (var q in questions)
                {
                    // create a single question object
                    var question = _question.Get(q.Question.Id);

                    // get a random answer 1-5
                    int option       = rnd.Next(1, 5);
                    var answerOption = _answerOption.Get(option);

                    var newResult = new Result
                    {
                        Session      = session,
                        SurveyMaster = survey,
                        Question     = question,
                        AnswerOption = answerOption
                    };

                    _result.Add(newResult);
                }
            }
            return(1);
        }
Esempio n. 3
0
 public IResult Add(IResult result)
 {
     _inner.Add(result);
     return(this);
 }
Esempio n. 4
0
        public ActionResult Create(TSH model_TSH, T3T4 model_T3T4, Mocz model_Mocz, Szpik model_Szpik, BetaHCG model_HCG,
                                   Krzywa model_Krzywa, OGTT model_OGTT, Glukoza model_Glukoza, Morf model_Morf, Morf5 model_Morf5,
                                   Progesteron model_Progesteron, Testosteron model_Testosteron, Estrogen model_Estrogen,
                                   USGPiersi model_Piersi, USGSerca model_Serca, USGSzyi model_Szyi)
        {
            Result one = new Result();

            if (ModelState.IsValid)
            {
                if (model_TSH.isTSH == true)
                {
                    one.DoctorName = model_TSH.DocName;
                    one.TSHTest    = model_TSH;
                    one.ResultType = "Badanie TSH";
                }

                if (model_Glukoza.isGlukoza == true)
                {
                    one.DoctorName  = model_Glukoza.DocName;
                    one.GlukozaTest = model_Glukoza;
                    one.ResultType  = "Badanie poziomu glukozy";
                }

                if (model_Mocz.isMocz == true)
                {
                    one.DoctorName = model_Mocz.DocName;
                    one.MoczTest   = model_Mocz;
                    one.ResultType = "Posiew moczu";
                }

                if (model_Szpik.isSzpik == true)
                {
                    one.DoctorName = model_Szpik.DocName;
                    one.SzpikTest  = model_Szpik;
                    one.ResultType = "Barwienie szpiku";
                }


                if (model_HCG.isBeta == true)
                {
                    one.DoctorName  = model_HCG.DocName;
                    one.BetaHCGTest = model_HCG;
                    one.ResultType  = "Badanie hormonu BetaHCG";
                }

                if (model_Krzywa.isKrzywa == true)
                {
                    one.DoctorName = model_Krzywa.DocName;
                    one.KrzywaTest = model_Krzywa;
                    one.ResultType = "Krzywa cukrowa";
                }

                if (model_OGTT.isOGTT == true)
                {
                    one.DoctorName = model_OGTT.DocName;
                    one.OGTTTest   = model_OGTT;
                    one.ResultType = "Badanie obciążenia glukozy";
                }

                if (model_Morf.isMorf == true)
                {
                    one.DoctorName = model_Morf.DocName;
                    one.MorfTest   = model_Morf;
                    one.ResultType = "Morfologia krwi";
                }

                if (model_Morf5.isMorf5 == true)
                {
                    one.DoctorName = model_Morf5.DocName;
                    one.Morf5Test  = model_Morf5;
                    one.ResultType = "Morfologia krwi z rozmazem";
                }

                if (model_Progesteron.isProgesteron == true)
                {
                    one.DoctorName      = model_Progesteron.DocName;
                    one.ProgesteronTest = model_Progesteron;
                    one.ResultType      = "Badanie poziomu progesteronu";
                }

                if (model_Estrogen.isEstrogen == true)
                {
                    one.DoctorName   = model_Estrogen.DocName;
                    one.EstrogenTest = model_Estrogen;
                    one.ResultType   = "Badanie poziomu estrogenów";
                }

                if (model_Testosteron.isTestosteron == true)
                {
                    one.DoctorName      = model_Testosteron.DocName;
                    one.TestosteronTest = model_Testosteron;
                    one.ResultType      = "Badanie poziomu testosteronu";
                }

                if (model_Serca.isUSGSerca == true)
                {
                    one.DoctorName = model_Serca.DocName;

                    var files = HttpContext.Request.Form.Files;
                    foreach (var Image in files)
                    {
                        if (Image != null && Image.Length > 0)
                        {
                            var file    = Image;
                            var uploads = Path.Combine(_appEnvironment.WebRootPath, "uploads\\img");
                            if (file.Length > 0)
                            {
                                var fileName = Guid.NewGuid().ToString().Replace("-", "") + Path.GetExtension(file.FileName);
                                using (var fileStream = new FileStream(Path.Combine(uploads, fileName), FileMode.Create))
                                {
                                    file.CopyTo(fileStream);
                                    model_Serca.ImageName = fileName;
                                }
                            }
                        }
                    }
                    one.USGSercaTest = model_Serca;
                    one.ResultType   = "USG serca";
                }

                if (model_Piersi.isUSGPiersi == true)
                {
                    one.DoctorName = model_Piersi.DocName;

                    var files = HttpContext.Request.Form.Files;
                    foreach (var Image in files)
                    {
                        if (Image != null && Image.Length > 0)
                        {
                            var file    = Image;
                            var uploads = Path.Combine(_appEnvironment.WebRootPath, "uploads\\img");
                            if (file.Length > 0)
                            {
                                var fileName = Guid.NewGuid().ToString().Replace("-", "") + Path.GetExtension(file.FileName);
                                using (var fileStream = new FileStream(Path.Combine(uploads, fileName), FileMode.Create))
                                {
                                    file.CopyTo(fileStream);
                                    model_Piersi.ImageName = fileName;
                                }
                            }
                        }
                    }
                    one.USGPiersiTest = model_Piersi;
                    one.ResultType    = "USG piersi";
                }


                if (model_Szyi.isUSGSzyi == true)
                {
                    one.DoctorName = model_Szyi.DocName;

                    var files = HttpContext.Request.Form.Files;
                    foreach (var Image in files)
                    {
                        if (Image != null && Image.Length > 0)
                        {
                            var file    = Image;
                            var uploads = Path.Combine(_appEnvironment.WebRootPath, "uploads\\img");
                            if (file.Length > 0)
                            {
                                var fileName = Guid.NewGuid().ToString().Replace("-", "") + Path.GetExtension(file.FileName);
                                using (var fileStream = new FileStream(Path.Combine(uploads, fileName), FileMode.Create))
                                {
                                    file.CopyTo(fileStream);
                                    model_Szyi.ImageName = fileName;
                                }
                            }
                        }
                    }
                    one.USGSzyiTest = model_Szyi;
                    one.ResultType  = "USG szyi";
                }

                if (model_T3T4.isT3T4 == true)
                {
                    one.DoctorName = model_T3T4.DocName;
                    one.T3T4Test   = model_T3T4;
                    one.ResultType = "Badanie poziomu T3 i T4";
                }
                one.visit = _visits.GetById(CartHelper.GetVisitId());
                _result.Add(one);
            }
            return(RedirectToAction("ChooseRes", new { id = one.visit.Id }));
        }