/// <summary>
        /// Confirms all relation requests to the citizen whose Id matches the given citizenId
        /// </summary>
        /// <param name="citizenId">Citizen Id</param>
        public void ConfirmAllRelatives(long citizenId)
        {
            var relatives = GetRelatives(citizenId);

            foreach (var relative in relatives)
            {
                DBEntities.Entry(relative).State = EntityState.Modified;
                relative.CitizenConfirmed        = true;
                relative.RelativeConfirmed       = true;
            }
            DBEntities.SaveChanges();
        }
示例#2
0
        /// <summary>
        /// update available rooms count for specific medical place
        /// and update time to be last time updated
        /// </summary>
        /// <param name="careUnits">care units that are being updated</param>
        public void UpdateAvailableRoomCount(List <CareUnit> careUnits)
        {
            DateTime time = DateTime.Now;

            foreach (CareUnit careUnit in careUnits)
            {
                careUnit.LastUpdate = time;

                DBEntities.CareUnits.Attach(careUnit);

                DBEntities.Entry(careUnit).Property(unit => unit.LastUpdate).IsModified         = true;
                DBEntities.Entry(careUnit).Property(unit => unit.AvailableRoomCount).IsModified = true;
            }
            DBEntities.SaveChanges();
        }
        /// <summary>
        ///  medical place accept sos request
        /// </summary>
        /// <param name="sosID">a long value</param>
        /// <param name="hopsitalID">a long value</param>
        public void AcceptSOS(long sosID, long hopsitalID)
        {
            SOSs s = DBEntities.SOSses.Single(sos => sos.ID == sosID);

            s.MedicalPlaceID = hopsitalID;
            s.StatusID       = 2; // accepted
            s.IsAccepted     = true;
            DBEntities.SOSses.Attach(s);
            DBEntities.Entry(s).State = System.Data.Entity.EntityState.Modified;
            DBEntities.SaveChanges();
        }
示例#4
0
 /// <summary>
 /// Updates a specific Service
 /// </summary>
 /// <param name="service">Service</param>
 public void UpdateService(Service service)
 {
     DBEntities.Services.Attach(service);
     DBEntities.Entry(service).State = System.Data.Entity.EntityState.Modified;
     DBEntities.SaveChanges();
 }