コード例 #1
0
        public void SetFromRoot(DbManagerProxy manager, long idfHumanActual, ContactedCasePerson cp)
        {
            var patient = Patient.Accessor.Instance(null).SelectByKey(manager, idfHumanActual);

            cp.Person = CopyFrom(manager, patient);
            ContactedCasePerson.Accessor.Instance(null).SetupChildHandlers(cp, cp.Person);
        }
コード例 #2
0
        public ActionResult RemoveContactedCasePerson(long rootKey, long contactedCasePersonId)
        {
            var humanCase = (HumanCase)ModelStorage.GetRoot(Session.SessionID, rootKey, null);
            EditableList <ContactedCasePerson> list = humanCase.ContactedPerson;
            ContactedCasePerson item = list.Where(c => c.idfContactedCasePerson == contactedCasePersonId).SingleOrDefault();

            list.Remove(item);
            return(new JsonResult {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = null
            });
        }
コード例 #3
0
        private static void SetAddressString(ContactedCasePerson t, Address obj, string cultureString, bool includeSettlement)
        {
            long?id = includeSettlement
                ? ((t.idfsSettlement ?? t.idfsRayon) ?? t.idfsRegion) ?? obj.idfsCountry
                : (t.idfsRayon ?? t.idfsRegion) ?? obj.idfsCountry;

            string cacheKey = String.Format("{0}_{1}_{2}_WithCountry",
                                            cultureString,
                                            id,
                                            includeSettlement ? "Include" : "Exclude");

            string addressString = (string)HttpContext.Current.Cache[cacheKey];

            if (addressString == null)
            {
                if (obj.RegionLookup.Count() == 0)
                {
                    var ctry = obj.idfsCountry;
                    obj.idfsCountry = null;
                    obj.idfsCountry = ctry;
                }

                obj.idfsRegion     = t.idfsRegion;
                obj.idfsRayon      = t.idfsRayon;
                obj.idfsSettlement = t.idfsSettlement;

                addressString = obj.Country.ToString();
                if (t.idfsRegion.HasValue)
                {
                    addressString += ", " + obj.RegionLookup.Find(r => r.idfsRegion == t.idfsRegion).strRegionName;
                }

                if (t.idfsRayon.HasValue)
                {
                    addressString += ", " + obj.RayonLookup.Find(r => r.idfsRayon == t.idfsRayon).strRayonName;
                }

                if (t.idfsSettlement.HasValue && includeSettlement)
                {
                    addressString += ", " + obj.SettlementLookup.Find(r => r.idfsSettlement == t.idfsSettlement).strSettlementName;
                }

                addressString += ", *";

                HttpContext.Current.Cache[cacheKey] = addressString;
            }

            t.GeoLocationNameWithHiddenPersonalData = addressString;
        }
コード例 #4
0
        public ActionResult SetSelectedPatient(string root, string selectedId)
        {
            long idfHumanActual = long.Parse(selectedId);
            long key            = long.Parse(root);
            long rootKey        = (long)((IObject)ModelStorage.GetRoot(Session.SessionID, key, null)).Key;
            var  rootHumanCase  = ModelStorage.Get(Session.SessionID, rootKey, null) as HumanCase;
            var  data           = new CompareModel();

            using (DbManagerProxy manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance))
            {
                var                 patientAccessor         = Patient.Accessor.Instance(null);
                Patient             patient                 = patientAccessor.SelectByKey(manager, idfHumanActual);
                var                 contactedPersonAccessor = ContactedCasePerson.Accessor.Instance(null);
                ContactedCasePerson contactedPerson         = contactedPersonAccessor.Create(manager, rootHumanCase, rootKey);
                contactedPerson.Person = contactedPerson.Person.CopyFrom(manager, patient);
                long idfPatientRootHuman  = patient.idfRootHuman.HasValue ? patient.idfRootHuman.Value : patient.idfHuman;
                int  contactedPersonCount = rootHumanCase.ContactedPerson.Where(x => x.Person.idfRootHuman.Value == idfPatientRootHuman).Count();
                if (contactedPersonCount > 0)
                {
                    string errorMessage = EidssMessages.Get("errContactedPersonDuplicates");
                    data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false);
                }
                else if (rootHumanCase.Patient.idfRootHuman == idfPatientRootHuman)
                {
                    string errorMessage = EidssMessages.Get("errContactedPersonDuplicateRootHuman");
                    data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false);
                }
                else
                {
                    //rootHumanCase.ContactedPerson.Add(contactedPerson);
                    //TODO: remove previous contact
                    contactedPerson.NewObject = true;
                    ModelStorage.Put(Session.SessionID, key, contactedPerson.idfContactedCasePerson, null, contactedPerson);
                    data.Add("idfContactedCasePerson", "", "", contactedPerson.idfContactedCasePerson.ToString(), false, false, false);
                }
            }
            return(new JsonResult {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = data
            });
        }
コード例 #5
0
 public void SetupChildHandlers(ContactedCasePerson obj, object newobj)
 {
     _SetupChildHandlers(obj, newobj);
     _SetupRequired(obj);
 }