Beispiel #1
0
        public ActionResult ContactDetails(long rootKey, long contactedCasePersonId, bool getFromSession = true)
        {
            HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null);
            ViewBag.CanUpdate = humanCaseAccessor.CanUpdate;

            ViewBag.RootKey = rootKey;

            if (getFromSession)
            {
                var contactedCasePerson =
                    (ContactedCasePerson)ModelStorage.Get(Session.SessionID, contactedCasePersonId, null);
                return(View(contactedCasePerson));
            }

            var humanCase = (HumanCase)ModelStorage.GetRoot(Session.SessionID, rootKey, null);
            EditableList <ContactedCasePerson> list = humanCase.ContactedPerson;
            var root = (long)((HumanCase)ModelStorage.GetRoot(Session.SessionID, rootKey, null)).Key;
            ContactedCasePerson item;

            if (contactedCasePersonId == 0)
            {
                using (DbManagerProxy manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance))
                {
                    var accessor = ContactedCasePerson.Accessor.Instance(null);
                    item           = accessor.Create(manager, humanCase, rootKey);
                    item.NewObject = true;
                    ModelStorage.Put(Session.SessionID, root, item.idfContactedCasePerson, null, item);
                    return(View(item));
                }
            }

            item = list.SingleOrDefault(c => c.idfContactedCasePerson == contactedCasePersonId);
            ModelStorage.Put(Session.SessionID, root, item.idfContactedCasePerson, null, item);
            return(View(item));
        }
Beispiel #2
0
        public ActionResult Notification(long id, bool getFromSession = true)
        {
            HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null);
            ViewBag.CanUpdate = humanCaseAccessor.CanUpdate;
            if (getFromSession)
            {
                var humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, id, null);
                Session["IdfCase"] = humanCase.idfCase;
                return(View(humanCase));
            }

            using (DbManagerProxy manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance))
            {
                var acc       = HumanCase.Accessor.Instance(null);
                var humanCase = id.Equals(0) ? acc.CreateNewT(manager, null) : acc.SelectByKey(manager, id); //TODO extender helper для проверки
                if (id.Equals(0))
                {
                    humanCase.datNotificationDate         = humanCase.datEnteredDate;
                    humanCase.RegistrationAddress.Country = null;
                }
                ModelStorage.Put(Session.SessionID, humanCase.idfCase, humanCase.idfCase, null, humanCase);
                ModelStorage.Put(Session.SessionID, humanCase.idfCase, humanCase.Patient.idfHuman, null, humanCase.Patient);
                Session["IdfCase"] = humanCase.idfCase;

                return(View(humanCase));
            }
        }
Beispiel #3
0
 public ActionResult HumanModule()
 {
     HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null);
     ViewBag.IsCreateButtonVisible = humanCaseAccessor.CanInsert;
     ViewBag.IsSearchButtonVisible = humanCaseAccessor.CanSelect;
     return(View());
 }
Beispiel #4
0
        public ActionResult Investigation(long id)
        {
            HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null);
            ViewBag.CanUpdate = humanCaseAccessor.CanUpdate;
            var humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, id, null);

            Session["IdfCase"] = humanCase.idfCase;
            return(View(humanCase));
        }
Beispiel #5
0
        public ActionResult Details(FormCollection form)
        {
            string errorMessage;

            form.AllKeys.ToList().ForEach(k => form[k] = EidssWebHelper.UnescapeHtml(form[k]));
            bool isDatesValid = DateTimeHelper.TryParseCustomDates(form, out errorMessage) && DateTimeHelper.TryParseMobileSafariDates(form, out errorMessage);
            var  data         = new CompareModel();

            if (!isDatesValid)
            {
                data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false);
                return(new JsonResult {
                    Data = data, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }

            long key       = long.Parse(Session["IdfCase"].ToString());
            var  humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, key, null);

            var cloneHumanCase = (HumanCase)humanCase.Clone();

            m_Validation          = null;
            humanCase.Validation += hc_ValidationDetails;
            humanCase.ParseFormCollection(form);
            if (m_Validation != null)
            {
                humanCase.Validation -= hc_ValidationDetails;
                errorMessage          = Translator.GetErrorMessage(m_Validation);
                data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false);
                return(new JsonResult {
                    Data = data, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }

            using (DbManagerProxy manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance))
            {
                HumanCase.Accessor acc = HumanCase.Accessor.Instance(null);
                acc.Validate(manager, humanCase, true, true, true);
                if (m_Validation == null)
                {
                    acc.Post(manager, humanCase);
                }
            }
            humanCase.Validation -= hc_ValidationDetails;
            if (m_Validation != null)
            {
                errorMessage = Translator.GetErrorMessage(m_Validation);
                data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false);
            }
            else
            {
                data = humanCase.Compare(cloneHumanCase);
            }
            return(new JsonResult {
                Data = data, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Beispiel #6
0
        public ActionResult ContactList(long id)
        {
            HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null);
            ViewBag.CanUpdate = humanCaseAccessor.CanUpdate;
            var humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, id, null);

            ViewBag.IsHiddenPersonalData = humanCase.IsHiddenPersonalData("ContactedPersonList");
            Session["IdfCase"]           = humanCase.idfCase;
            return(View(humanCase));
        }
Beispiel #7
0
        public ActionResult LocationDetails(long rootKey)
        {
            HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null);
            ViewBag.CanUpdate = humanCaseAccessor.CanUpdate;
            ViewBag.RootKey   = rootKey;
            var         humanCase        = (HumanCase)ModelStorage.Get(Session.SessionID, rootKey, null);
            GeoLocation cloneGeoLocation = GetCloneOfOriginalGeoLocation(humanCase);

            cloneGeoLocation.idfGeoLocation = cloneGeoLocation.idfGeoLocation + 1;
            ModelStorage.Put(Session.SessionID, rootKey, cloneGeoLocation.idfGeoLocation, null, cloneGeoLocation);
            return(PartialView(cloneGeoLocation));
        }
Beispiel #8
0
        public ActionResult ClinicalSigns(long id)
        {
            HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null);
            ViewBag.CanUpdate = humanCaseAccessor.CanUpdate;
            var humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, id, null);

            Session["IdfCase"]   = humanCase.idfCase;
            Session["ReturnUrl"] = Url.Action("ClinicalSigns", "HumanCase", new { id = humanCase.idfCase.ToString() });
            if (humanCase.FFPresenterCs.CurrentObservation.HasValue)
            {
                humanCase.FFPresenterCs.ReadOnly = humanCaseAccessor.IsReadOnlyForEdit;
                ModelStorage.Put(Session.SessionID, humanCase.idfCase, humanCase.idfCase,
                                 humanCase.FFPresenterCs.CurrentObservation.Value.ToString(), humanCase.FFPresenterCs);
            }
            return(View(humanCase));
        }
Beispiel #9
0
        public ActionResult ListForm(bool isExtendedSearch = false)
        {
            var     accessor = SmallHumanCaseListItem.Accessor.Instance(null);
            IObject initObject;

            using (DbManagerProxy manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance))
            {
                initObject = accessor.CreateNew(manager, null);
            }
            ViewBag.InitObject = initObject;
            var filterParams = (FilterParams)Session["Filter"];
            List <SmallHumanCaseListItem> list = GetHumanCaseListItem(filterParams);

            ViewBag.ItemsCount = list == null ? 0 : list.Count;
            HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null);
            ViewBag.IsEditButtonVisible = humanCaseAccessor.CanUpdate;
            ViewBag.isExtendedSearch    = isExtendedSearch;
            List <SmallHumanCaseListItem> resultList = list == null ? null : list.Take(100).ToList();
            List <SmallHumanCaseListItem> result     = AddressStringHelper.RearrangeAddressDisplayString(initObject, resultList).ToList();

            return(View(result));
        }
Beispiel #10
0
        private void HumanCaseWinForm_Load(object sender, EventArgs e)
        {
            using (DbManagerProxy manager = DbManagerFactory.Factory.Create())
            {
                HumanCase.Accessor acc = HumanCase.Accessor.Instance(null);
                m_Case = acc.CreateNewT(manager, null);
            }

            m_Case.TentativeDiagnosis = m_Case.TentativeDiagnosisLookup.FirstOrDefault();

            //diagnosisLookupBindingSource.DataSource
            //comboBoxEdit1.DataBindings.Add(new Binding("EditValue", this.diagnosisLookupBindingSource, "name", true));

            //this.diagnosisLookupBindingSource.D

            //comboBox1.DataSource = m_case.TentativeDiagnosisLookup;
            //comboBox1.DisplayMember = "name";
            //comboBox1.ValueMember = "idfsDiagnosis";
            //comboBox1.DataBindings.Add(new Binding("idfsTentativeDiagnosis", m_case, "SelectedValue"));
            //comboBox1.DataBindings.Add(new Binding("SelectedValue", m_case, "TentativeDiagnosis"));
            //false, DataSourceUpdateMode.OnPropertyChanged, "", null, null));
        }