Example #1
0
        public ActionResult Edit(CordBloodUnit cordbloodunit)
        {
            if (ModelState.IsValid)
            {
                db.Entry(cordbloodunit).State = EntityState.Modified;
                db.SaveChanges();
                return PartialView("GridData", new CordBloodUnit[] { cordbloodunit });
            }

            return PartialView(cordbloodunit);
        }
Example #2
0
        public ActionResult Create(CordBloodUnit cordbloodunit)
        {
            if (ModelState.IsValid)
            {
                db.CordBloodUnits.Add(cordbloodunit);
                db.SaveChanges();
                return PartialView("GridData", new CordBloodUnit[] { cordbloodunit });
            }

            return PartialView("Edit", cordbloodunit);
        }
Example #3
0
 public ActionResult SendMail(PatientInfo requestInfo, CordBloodUnit cordBloodUnit)
 {
     var viewModel = new RequestInfoViewModel() { PatientInfo = requestInfo, HLAType = cordBloodUnit };
     Mailer.Welcome(viewModel).Send();
     return new EmptyResult();
 }
Example #4
0
        //
        // GET: /RequestInfo/HLAMatches
        public ActionResult HLAMatches(PatientInfo info, CordBloodUnit cordBloodUnit)
        {
            try
            {
                var searchResults = db.CordBloodUnits.Select(c => c)
                                                   .Where(unit =>
                                                             unit.DRB_1 == cordBloodUnit.DRB_1
                                                          && unit.DRB_2 == cordBloodUnit.DRB_2
                                                          &&(
                                                              (cordBloodUnit.HLA_A1.HasValue ? unit.HLA_A1 == cordBloodUnit.HLA_A1 : true)
                                                              || (cordBloodUnit.HLA_A2.HasValue ? unit.HLA_A2 == cordBloodUnit.HLA_A2 : true)
                                                              || (cordBloodUnit.HLA_B1.HasValue ? unit.HLA_B1 == cordBloodUnit.HLA_B1 : true)
                                                              || (cordBloodUnit.HLA_B2.HasValue ? unit.HLA_B2 == cordBloodUnit.HLA_B2 : true)
                                                            )
                                                          ).ToList();

                var model = new HLASearchResultsViewModel() { _5Matches = searchResults.Where(x => x.GetMatchCount(cordBloodUnit) == 5), _6Matches = searchResults.Where(x => x.GetMatchCount(cordBloodUnit) == 6) };

                return PartialView("_SearchResults", model);
            }
            catch
            {
                return View();
            }
        }
Example #5
0
 public void ShouldGetMatchCount()
 {
     var other = new CordBloodUnit() { HLA_A1 = 1, HLA_A2 = null, HLA_B1 = 2, HLA_B2 = 2, DRB_1 = 3, DRB_2 = 3 };
     int result = unit.GetMatchCount(other);
     Assert.AreEqual(5, result);
 }
Example #6
0
 public void Setup()
 {
     unit = new CordBloodUnit(){HLA_A1 = 1, HLA_A2 = 1, HLA_B1 = 2, HLA_B2 = 2, DRB_1 = 3, DRB_2 = 3};
 }
Example #7
0
        public int GetMatchCount(CordBloodUnit other)
        {
            int matchCount = 0;
            if (this.HLA_A1 == other.HLA_A1)
                matchCount++;
            if (this.HLA_A2 == other.HLA_A2)
                matchCount++;
            if (this.HLA_B1 == other.HLA_B1)
                matchCount++;
            if (this.HLA_B2 == other.HLA_B2)
                matchCount++;
            if (this.DRB_1 == other.DRB_1)
                matchCount++;
            if (this.DRB_2 == other.DRB_2)
                matchCount++;

            return matchCount;
        }