Exemple #1
0
        public IActionResult EditBurial(BurialViewModel b, int LocationId, DateTime date, int BurialId)
        {
            Burial newB = context.Burial.Single(bur => bur.BurialId == BurialId);

            newB.LocationId                = LocationId;
            newB.BurialNumber              = b.Burial.BurialNumber;
            newB.SouthToHead               = b.Burial.SouthToHead;
            newB.SouthToFeet               = b.Burial.SouthToFeet;
            newB.WestToHead                = b.Burial.WestToHead;
            newB.WestToFeet                = b.Burial.WestToFeet;
            newB.LengthOfRemains           = b.Burial.LengthOfRemains;
            newB.BurialDepth               = b.Burial.BurialDepth;
            newB.ArtifactFound             = b.Burial.ArtifactFound;
            newB.TextileTaken              = b.Burial.TextileTaken;
            newB.HairColor                 = b.Burial.HairColor;
            newB.AgeCodeSingle             = b.Burial.AgeCodeSingle;
            newB.HeadDirection             = b.Burial.HeadDirection;
            newB.InitialsOfDataEntryExpert = b.Burial.InitialsOfDataEntryExpert;
            if (date.ToString("yyyy") != "0001")
            {
                newB.DayFound   = date.ToString("dd");
                newB.MonthFound = date.ToString("MM");
                newB.YearFound  = date.ToString("yyyy");
            }
            context.SaveChanges();
            //Might be good to do a changes made success page.
            return(RedirectToAction("SingleBurial", new { BurialId = BurialId }));
        }
Exemple #2
0
        public IActionResult CreatePerson([FromBody] BurialViewModel person)
        {
            // Create new burial
            Burial newBurial = new Burial()
            {
                Surname    = person.Surname,
                Name       = person.Name,
                Patronymic = person.Patronymic,
                DeathDate  = person.DeathDate,
                BirthDate  = person.BirthDate,
                BurialDate = person.BurialDate,
                imgs       = person.imgs,
                ChangeDate = person.ChangeDate,
                CreateDate = person.CreateDate,
                FuneralUrn = person.FuneralUrn,
                PlaceId    = person.PlaceId,
            };

            // New other info about new burial
            Other other = new Other()
            {
                CertificateNumber   = person.CertificateNumber,
                RegistryOffice      = person.RegistryOffice,
                DateOfReference     = person.DateOfReference,
                RegistrationAddress = person.RegistrationAddress,
                ArchivedNumber      = person.ArchivedNumber,
                CremationPlace      = person.CremationPlace,
                GraveDepth          = person.GraveDepth,
                DitcherSurname      = person.DitcherSurname,
                SoilType            = person.SoilType,
            };

            // New relatives about new burial
            Relative relative = new Relative
            {
                RelativeFullName = person.RelativeFullName,
                Address          = person.Address,
                Contacts         = person.Contacts,
            };

            newBurial.Other    = other;
            newBurial.Relative = relative;

            db.Burials.Add(newBurial);
            db.SaveChanges();

            return(Ok(person));
        }
Exemple #3
0
        //Main controller to pull all the burial records.
        public IActionResult BurialRecords(int pageNum = 1, bool isPagination = false)
        {
            ViewBag.FilterSubmitted = false;

            if (User.IsInRole("Admin")) //Checks the role
            {
                ViewBag.Admin = true;
            }
            if (User.IsInRole("Researcher"))
            {
                ViewBag.Researcher = true;
            }
            int pageSize = 12; //numebr of cards on a page

            List <Burial> listToView = new List <Burial>();

            if (TempData["isDataStored"] != null && isPagination == true)
            {
                FilterData filterData = TempData.Get <FilterData>("filterData");
                listToView = _filterService.FilterAllData(filterData);

                TempData.Keep("isDataStored");
                TempData.Keep("filterData");
                ViewBag.FilterSubmitted = true;
                ViewBag.FilterDisplay   = _filterService.GetActiveFilterDisplay(filterData);
            }
            else
            {
                listToView = _recordService.GetAllBurials().ToList();
            }

            BurialViewModel bvm = new BurialViewModel
            {
                Burials   = listToView.Skip((pageNum - 1) * pageSize).Take(pageSize).ToList(),
                Locations = _recordService.GetAllLocations().ToList(),

                PageNumInfo = new PageNumInfo
                {
                    NumItemsPerPage = pageSize,
                    CurrentPage     = pageNum,
                    TotalNumItems   = listToView.Count()
                }
            };

            return(View(bvm));
        }
Exemple #4
0
        public IActionResult BurialRecords(IFormCollection form, int pageNum = 1)
        {
            if (User.IsInRole("Admin"))
            {
                ViewBag.Admin = true;
            }
            if (User.IsInRole("Researcher"))
            {
                ViewBag.Researcher = true;
            }

            FilterData filterData = _filterService.ParseFormData(form);

            int pageSize = 12;

            List <Burial> returnList = new List <Burial>();

            returnList = _filterService.FilterAllData(filterData);

            BurialViewModel bvm = new BurialViewModel
            {
                Burials   = returnList.Skip((pageNum - 1) * pageSize).Take(pageSize).ToList(),
                Locations = _recordService.GetAllLocations().ToList(),

                PageNumInfo = new PageNumInfo
                {
                    NumItemsPerPage = pageSize,
                    CurrentPage     = pageNum,
                    TotalNumItems   = returnList.Count()
                }
            };

            TempData["isDataStored"] = "true";
            TempData.Put("filterData", filterData);

            ViewBag.FilterSubmitted = true;
            ViewBag.FilterDisplay   = _filterService.GetActiveFilterDisplay(filterData);

            return(View(bvm));
        }
Exemple #5
0
        public IActionResult AddBurial(BurialViewModel b, int LocationId, DateTime date)
        {
            b.Burial.LocationId = LocationId;
            b.Burial.DayFound   = date.ToString("dd");
            b.Burial.MonthFound = date.ToString("MM");
            b.Burial.YearFound  = date.ToString("yyyy");
            context.Burial.Add(b.Burial);

            //Location l = context.Location.Single(l => l.LocationId == LocationId);
            foreach (Burial burial in context.Burial.Where(b => b.LocationId == LocationId))
            {
                if (burial.BurialNumber == b.Burial.BurialNumber)
                {
                    //return Burial already stored.
                    return(View("ErrorBurial"));
                }
            }
            context.SaveChanges();
            Burial lastBurial = context.Burial.OrderByDescending(b => b.BurialId).First();

            return(RedirectToAction("SingleBurial", new { BurialId = lastBurial.BurialId }));
        }