// GET: Deceaseds/Edit/5
        public ActionResult Edit(int id)
        {
            Deceased deceased = db.Deceaseds.Find(id);

            ViewBag.deceased_citizenId = new SelectList(db.Citizens, "citizen_id", "citizen_national_id", deceased.deceased_citizenId);
            return(View(deceased));
        }
예제 #2
0
        public ActionResult Edit(Deceased deceased)
        {
            if (ModelState.IsValid)
            {
                //New Files
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    var file = Request.Files[i];

                    if (file != null && file.ContentLength > 0)
                    {
                        var        fileName   = Path.GetFileName(file.FileName);
                        FileDetail fileDetail = new FileDetail()
                        {
                            FileName  = fileName,
                            Extension = Path.GetExtension(fileName),
                            Id        = Guid.NewGuid(),
                            deceasedN = deceased.deceasedNo
                        };
                        var path = Path.Combine(Server.MapPath("~/App_Data/Upload/"), fileDetail.Id + fileDetail.Extension);
                        file.SaveAs(path);

                        db.Entry(fileDetail).State = EntityState.Added;
                    }
                }

                db.Entry(deceased).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(deceased));
        }
예제 #3
0
        public ActionResult EditBurial(int Id)
        {
            ViewBag.Categories = deceasedDal.GetAllCategories();
            Deceased deceased = deceasedDal.GetDeceased(Id);

            return(View(deceased));
        }
        public async Task <IActionResult> PutDeceased(int id, Deceased deceased)
        {
            if (id != deceased.DeceasedId)
            {
                return(BadRequest());
            }

            _context.Entry(deceased).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DeceasedExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #5
0
        [HttpPost]//Принимаюший метод
        public ActionResult AddDeceased(string LastName, string FirstName, string Parcicle, DateTime?DateBirth, DateTime?DateDead, string Descript, HttpPostedFileBase upload, int[] selectedCateg)
        {
            //получаем файл
            if (upload != null)
            {
                fileName = System.IO.Path.GetFileName(upload.FileName);              //получам путь файла
                upload.SaveAs(Server.MapPath("/Content/Images/Photos/" + fileName)); // сохраняем файл в папку Files в проекте
            }
            else
            {
                fileName = "notphoto.jpg";// Если файл отсутсвует, загрузить картинку, нет фото.
            }

            #region Конструктор

            Deceased man = new Deceased
            {
                FName       = FirstName,
                LName       = LastName,
                SName       = Parcicle,
                DOB         = DateBirth,
                DateDeath   = DateDead,
                Description = Descript,
                Photo       = "/Content/Images/Photos/" + fileName
            };

            #endregion


            deceasedDal.AddDeceased(man, selectedCateg);

            return(RedirectToAction("Search"));//Возврат на страницу
        }
        public async Task <ActionResult <Deceased> > PostDeceased(Deceased deceased)
        {
            _context.Deceased.Add(deceased);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDeceased", new { id = deceased.DeceasedId }, deceased));
        }
    public override IDeepCopyable CopyTo(IDeepCopyable other)
    {
      var dest = other as FamilyMemberHistory;

      if (dest == null)
      {
        throw new ArgumentException("Can only copy to an object of the same type", "other");
      }

      base.CopyTo(dest);
      if(Identifier != null) dest.Identifier = new List<Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
      if(InstantiatesCanonicalElement != null) dest.InstantiatesCanonicalElement = new List<Hl7.Fhir.Model.Canonical>(InstantiatesCanonicalElement.DeepCopy());
      if(InstantiatesUriElement != null) dest.InstantiatesUriElement = new List<Hl7.Fhir.Model.FhirUri>(InstantiatesUriElement.DeepCopy());
      if(StatusElement != null) dest.StatusElement = (Code<Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus>)StatusElement.DeepCopy();
      if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopy();
      if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
      if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy();
      if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
      if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopy();
      if(Sex != null) dest.Sex = (Hl7.Fhir.Model.CodeableConcept)Sex.DeepCopy();
      if(Born != null) dest.Born = (Hl7.Fhir.Model.Element)Born.DeepCopy();
      if(Age != null) dest.Age = (Hl7.Fhir.Model.Element)Age.DeepCopy();
      if(EstimatedAgeElement != null) dest.EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)EstimatedAgeElement.DeepCopy();
      if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.Element)Deceased.DeepCopy();
      if(ReasonCode != null) dest.ReasonCode = new List<Hl7.Fhir.Model.CodeableConcept>(ReasonCode.DeepCopy());
      if(ReasonReference != null) dest.ReasonReference = new List<Hl7.Fhir.Model.ResourceReference>(ReasonReference.DeepCopy());
      if(Note != null) dest.Note = new List<Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
      if(Condition != null) dest.Condition = new List<Hl7.Fhir.Model.FamilyMemberHistory.ConditionComponent>(Condition.DeepCopy());
      return dest;
    }
예제 #8
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as FamilyMemberHistory;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (Patient != null)
            {
                dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
            }
            if (DateElement != null)
            {
                dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy();
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus>)StatusElement.DeepCopy();
            }
            if (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
            }
            if (Relationship != null)
            {
                dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopy();
            }
            if (GenderElement != null)
            {
                dest.GenderElement = (Code <Hl7.Fhir.Model.AdministrativeGender>)GenderElement.DeepCopy();
            }
            if (Born != null)
            {
                dest.Born = (Hl7.Fhir.Model.DataType)Born.DeepCopy();
            }
            if (Age != null)
            {
                dest.Age = (Hl7.Fhir.Model.DataType)Age.DeepCopy();
            }
            if (Deceased != null)
            {
                dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopy();
            }
            if (Note != null)
            {
                dest.Note = (Hl7.Fhir.Model.Annotation)Note.DeepCopy();
            }
            if (Condition != null)
            {
                dest.Condition = new List <Hl7.Fhir.Model.FamilyMemberHistory.ConditionComponent>(Condition.DeepCopy());
            }
            return(dest);
        }
예제 #9
0
            public override ErrorList Validate()
            {
                var result = new ErrorList();

                result.AddRange(base.Validate());

                if (NameElement != null)
                {
                    result.AddRange(NameElement.Validate());
                }
                if (Relationship != null)
                {
                    result.AddRange(Relationship.Validate());
                }
                if (Deceased != null)
                {
                    result.AddRange(Deceased.Validate());
                }
                if (NoteElement != null)
                {
                    result.AddRange(NoteElement.Validate());
                }
                if (Condition != null)
                {
                    Condition.ForEach(elem => result.AddRange(elem.Validate()));
                }

                return(result);
            }
예제 #10
0
        public void UpdateDeceased(Deceased edited)
        {
            Deceased current = null;

            using (DataContext DB = new DataContext())
            {
                current = DB.Deceaseds.Include(b => b.BurialPlace).Include(c => c.Categories).FirstOrDefault(i => i.Id == edited.Id);
                if (current != null)
                {
                    current.LName = edited.LName;
                    current.FName = edited.FName;
                    current.SName = edited.SName;

                    current.DOB       = edited.DOB;
                    current.DateDeath = edited.DateDeath;

                    current.Photo = edited.Photo;

                    current.BurialPlace = edited.BurialPlace;
                    current.Categories  = edited.Categories;

                    current.Description = edited.Description;

                    current.Confirmed     = edited.Confirmed;
                    current.UnknownBurial = edited.UnknownBurial;


                    DB.SaveChanges();
                }
            }
        }
예제 #11
0
        public void PeopleKilledOnYoB_Correctly_Return_TargetCounts(int ageOfDeath, int yearOfDeath, int expectedNumberOfPeopleKilled)
        {
            // arrange
            var deceased = new Deceased(ageOfDeath, yearOfDeath);

            // act and assert
            Assert.Equal(expectedNumberOfPeopleKilled, deceased.PeopleKilledOnYoB());
        }
예제 #12
0
        public void YearOfBirth_Calculated_Correctly_Given_Valid_Data(int ageOfDeath, int yearOfDeath, int expectedYearOfBirth)
        {
            // arrange
            var deceased = new Deceased(ageOfDeath, yearOfDeath);

            // act and assert
            Assert.Equal(expectedYearOfBirth, deceased.YearOfBirth);
        }
예제 #13
0
        public ActionResult DeleteConfirmed(int id)
        {
            Deceased deceased = db.Deceaseds.Find(id);

            db.Deceaseds.Remove(deceased);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #14
0
        /// <summary>
        /// Возвращает захоронение по его Id
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public Deceased GetDeceased(int Id)
        {
            Deceased deceased = null;

            using (DataContext Db = new DataContext())
            {
                deceased = Db.Deceaseds.Include(b => b.BurialPlace).Include(c => c.Categories).FirstOrDefault(i => i.Id == Id);
            }
            return(deceased);
        }
예제 #15
0
        public ActionResult ConfirmBurial(int Id)
        {
            Deceased deceased = deceasedDal.GetDeceased(Id);

            if (deceased == null)
            {
                return(HttpNotFound());
            }
            return(View(deceased));
        }
예제 #16
0
        public ActionResult DeleteBurial(int Id)
        {
            Deceased choice = deceasedDal.GetDeceased(Id);

            if (choice == null)
            {
                return(HttpNotFound("Захоронение не найдено, повторите попытку позже"));
            }
            return(View(choice));
        }
예제 #17
0
 public ActionResult Edit([Bind(Include = "deceasedNo,firstName,lastName,idNo,age,gender,causeOfDeath,DateOfDeath,policyNo")] Deceased deceased)
 {
     if (ModelState.IsValid)
     {
         db.Entry(deceased).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(deceased));
 }
예제 #18
0
 public DeceasedModel(Deceased deceased)
 {
     Id          = deceased.Id;
     FName       = deceased.FName;
     LName       = deceased.LName;
     SName       = deceased.SName;
     DOB         = deceased.DOB;
     DateDeath   = deceased.DateDeath;
     Description = deceased.Description;
     Confirmed   = deceased.Confirmed;
     Photo       = deceased.Photo;
 }
예제 #19
0
    public void WhoDieThisMonth()
    {
        // Number of corpses is biased to be more around the high boundary the more the time passed
        // If there is already corpses in the morgue the high boundary is obviously smaller.
        int numberOfDeath = Mathf.RoundToInt(Utils.RandomBiased(1f, 4f - deceasedMonth.Count, 24f / (monthsPassed + 1)));

        for (int i = 0; i < numberOfDeath; i++)
        {
            Deceased newCorpse = new Deceased();
            deceasedMonth.Add(newCorpse);
        }
        DisplayDeath();
    }
 public ActionResult Edit([Bind(Include = "CattleID,CattleNumber,DeceasedDate,DairyID,FeedlotID,EmployeeID")] Deceased deceased)
 {
     if (ModelState.IsValid)
     {
         db.Entry(deceased).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DairyID    = new SelectList(db.Dairy, "dairyID", "dName", deceased.DairyID);
     ViewBag.EmployeeID = new SelectList(db.Employee, "EmployeeID", "EmpFname", deceased.EmployeeID);
     ViewBag.FeedlotID  = new SelectList(db.Feedlot, "feedlotID", "fName", deceased.FeedlotID);
     return(View(deceased));
 }
예제 #21
0
        // GET: Deceaseds/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Deceased deceased = db.Deceaseds.Find(id);

            if (deceased == null)
            {
                return(HttpNotFound());
            }
            return(View(deceased));
        }
예제 #22
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Deceased deceased = db.Deceaseds.Include(s => s.FileDetails).SingleOrDefault(x => x.deceasedNo == id);

            if (deceased == null)
            {
                return(HttpNotFound());
            }
            return(View(deceased));
        }
예제 #23
0
        public ActionResult Create(Deceased deceased)
        {
            //if (ModelState.IsValid)
            //{
            Deceased dec = db.Deceaseds.ToList().Find(x => x.deceasedNo == deceased.deceasedNo);

            if (dec != null)
            {
                Session["Response"]   = "**This person has already been declared as deceased**";
                Session["DeceasedNo"] = deceased.deceasedNo;
            }
            else
            {
                deceased.firstName = Session["First Name"].ToString();
                deceased.lastName  = Session["Last Name"].ToString();
                deceased.idNo      = Session["ID Number"].ToString();
                deceased.age       = Convert.ToInt32(Session["Age"].ToString());
                //deceased.gender = Session["Gender"].ToString();
                deceased.policyNo = Session["PolicyNo"].ToString();
                List <FileDetail> fileDetails = new List <FileDetail>();
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    var file = Request.Files[i];

                    if (file != null && file.ContentLength > 0)
                    {
                        var        fileName   = Path.GetFileName(file.FileName);
                        FileDetail fileDetail = new FileDetail()
                        {
                            FileName  = fileName,
                            Extension = Path.GetExtension(fileName),
                            Id        = Guid.NewGuid()
                        };
                        fileDetails.Add(fileDetail);

                        var path = Path.Combine(Server.MapPath("~/App_Data/Upload/"), fileDetail.Id + fileDetail.Extension);
                        file.SaveAs(path);
                    }
                }

                deceased.FileDetails = fileDetails;
                db.Deceaseds.Add(deceased);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }


            ////}
            return(View(deceased));
        }
        public ActionResult Create([Bind(Include = "CattleNumber,DeceasedDate,DairyID,FeedlotID,EmployeeID")] Deceased deceased)
        {
            if (ModelState.IsValid)
            {
                db.Deceased.Add(deceased);
                db.SaveChanges();
                return(RedirectToAction("Create", "Deceased", new { feedlotID = deceased.FeedlotID }));
            }

            ViewBag.DairyID    = new SelectList(db.Dairy, "dairyID", "dName", deceased.DairyID);
            ViewBag.EmployeeID = new SelectList(db.Employee, "EmployeeID", "EmpFname", deceased.EmployeeID);
            ViewBag.FeedlotID  = new SelectList(db.Feedlot, "feedlotID", "fName", deceased.FeedlotID);
            return(View(deceased));
        }
        public ActionResult DeceaseResident(string residentID)
        {
            try
            {
                if (residentID == null)
                {
                    return(RedirectToAction("Index"));
                }

                ResidentsInformation resident = entities.ResidentsInformations.Where(m => m.ResidentId == residentID).FirstOrDefault();

                if (resident == null)
                {
                    TempData["alert-type"]   = "alert-info";
                    TempData["alert-header"] = "Information";
                    TempData["alert-msg"]    = "User cannot be found.";
                    return(RedirectToAction("Index"));
                }

                int age = CalculateAge(resident.Birthday);

                Deceased deceased = new Deceased()
                {
                    DeceasedId = KeyGenerator.GenerateId(resident.FirstName + resident.LastName + resident.Birthday),
                    ResidentId = resident.ResidentId,
                    DeathDate  = DateTime.Now.Date,
                    Age        = age
                };

                entities.Deceaseds.Add(deceased);
                entities.SaveChanges();

                TempData["alert-type"]   = "alert-success";
                TempData["alert-header"] = "Success";
                TempData["alert-msg"]    = resident.FirstName + " " + resident.LastName + " is set as a deceased Sinisian resident.";

                // Audit Trail
                string userId = User.Identity.GetUserId();
                new AuditTrailer().Record(resident.FirstName + " " + resident.LastName + " is set as a deceased resident.", AuditTrailer.RESIDENT_TYPE, userId);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                TempData["alert-type"]   = "alert-danger";
                TempData["alert-header"] = "Error";
                TempData["alert-msg"]    = "Something went wrong, please try again later.";
                return(RedirectToAction("Index"));
            }
        }
예제 #26
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (Identifier != null)
            {
                Identifier.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Name != null)
            {
                Name.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Telecom != null)
            {
                Telecom.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Gender != null)
            {
                result.AddRange(Gender.Validate());
            }
            if (BirthDate != null)
            {
                result.AddRange(BirthDate.Validate());
            }
            if (Deceased != null)
            {
                result.AddRange(Deceased.Validate());
            }
            if (Address != null)
            {
                Address.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Photo != null)
            {
                Photo.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (MaritalStatus != null)
            {
                result.AddRange(MaritalStatus.Validate());
            }
            if (Language != null)
            {
                Language.ForEach(elem => result.AddRange(elem.Validate()));
            }

            return(result);
        }
예제 #27
0
        public ActionResult ConfirmDeleteBurial(int Id)
        {
            Deceased choice = null;

            using (DataContext DB = new DataContext())
            {
                choice = DB.Deceaseds.Find(Id);
                if (choice == null)
                {
                    return(HttpNotFound("Захоронение не найдено, повторите попытку позже"));
                }
                DB.Deceaseds.Remove(choice);
                DB.SaveChanges();
            }
            return(RedirectToAction("UnknownBurials"));
        }
예제 #28
0
 /// <summary>
 /// Добавляет захоронение в список неподтвержденных
 /// </summary>
 /// <param name="Add"></param>
 public void AddDeceased(Deceased Add, int CategoryId = 0)
 {
     using (DataContext Context = new DataContext())
     {
         if (CategoryId == 0)
         {
             Context.Deceaseds.Add(Add);
         }
         else
         {
             Add.Categories = new List <Category>();
             Add.Categories.Add(Context.Categories.Find(CategoryId));
             Context.Deceaseds.Add(Add);
         }
         Context.SaveChanges();
     }
 }
예제 #29
0
 public void AddDeceased(Deceased Add, int[] CategoriesId)
 {
     using (DataContext Db = new DataContext())
     {
         Add.Categories = new List <Category>();
         if (CategoriesId != null)
         {
             //получаем выбранные курсы
             foreach (var c in Db.Categories.Where(co => CategoriesId.Contains(co.Id)))
             {
                 Add.Categories.Add(c);
             }
         }
         Db.Deceaseds.Add(Add);
         Db.SaveChanges();
     }
 }
        // GET: Deceaseds/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Deceased deceased = db.Deceased.Find(id);

            if (deceased == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DairyID    = new SelectList(db.Dairy, "dairyID", "dName", deceased.DairyID);
            ViewBag.EmployeeID = new SelectList(db.Employee, "EmployeeID", "EmpFname", deceased.EmployeeID);
            ViewBag.FeedlotID  = new SelectList(db.Feedlot, "feedlotID", "fName", deceased.FeedlotID);
            return(View(deceased));
        }