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)); }
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)); } }
public ActionResult ShowAddress(long root, Address address, bool isCountryFieldVisible = false, bool needFillRegionOnCountryChanged = true) { ViewBag.IsCountryFieldVisible = isCountryFieldVisible; address.blnReadOnlyRegion = !needFillRegionOnCountryChanged; ModelStorage.Put(Session.SessionID, root, address.idfGeoLocation, null, address); return(PartialView(address)); }
public ActionResult LocationOfExposure(HumanCase humanCase) { long root = humanCase.idfCase; ViewBag.IdfCase = root; GeoLocation geoLocation = humanCase.PointGeoLocation; ModelStorage.Put(Session.SessionID, root, geoLocation.idfGeoLocation, null, geoLocation); return(PartialView(geoLocation)); }
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)); }
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)); }
private List <VetFarmTree> PrepareSpeciesForCase(long caseId) { var vetCase = (VetCase)ModelStorage.Get(Session.SessionID, caseId, null); EditableList <VetFarmTree> farmTree = ModelStorage.Get(Session.SessionID, caseId, m_FarmTreeSessionKey) as EditableList <VetFarmTree>; if (farmTree == null && vetCase.Farm.FarmTree != null) { ModelStorage.Put(Session.SessionID, caseId, caseId, m_FarmTreeSessionKey, vetCase.Farm.FarmTree); farmTree = vetCase.Farm.FarmTree; } AddTitleData(vetCase._HACode); Session["IdfCase"] = vetCase.idfCase; List <VetFarmTree> species = GetSpeciesForFarmTree(farmTree); return(species); }
public ActionResult FarmDetails(FarmPanel farm, int?caseType = null) { VetCase.Accessor vetCaseAccessor = VetCase.Accessor.Instance(null); ViewBag.CanUpdate = vetCaseAccessor.CanUpdate; if (!caseType.HasValue) { caseType = (int)HACode.Livestock; } IObject initObject; using (DbManagerProxy manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance)) { initObject = vetCaseAccessor.CreateNew(manager, null, caseType.Value); } ViewBag.IsHiddenPersonalData = initObject.IsHiddenPersonalData("Vet_Farm"); ViewBag.RootKey = farm.idfCase.Value; ViewBag.CaseType = caseType.Value; ModelStorage.Put(Session.SessionID, farm.idfCase.Value, farm.idfFarm, null, farm); return(PartialView(farm)); }
public ActionResult ShowFlexibleFormDirect(long root, long key, FFPresenterModel ffpresenter, bool canUpdate = true) { //TODO определиться, нужен ли этот метод вообще if ((ffpresenter != null) && (ffpresenter.CurrentTemplate != null)) { if (ViewBag.GridName == null) { ViewBag.GridName = String.Empty; } ffpresenter.Settings.WindowMode = false; ModelStorage.Put(Session.SessionID, root, root, ffpresenter.CurrentObservation.ToString(), ffpresenter); ModelStorage.Put(Session.SessionID, root, key, ffpresenter.CurrentObservation.ToString(), ffpresenter); ViewBag.FFKey = key; ViewBag.FFpresenterId = ffpresenter.CurrentObservation.Value; ViewBag.CanUpdate = canUpdate; return(PartialView("ShowFlexibleForm", ffpresenter)); } return(PartialView("Empty")); }
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 }); }
public ActionResult ClinicalSigns(long rootKey, string name, long idfSpecies) { VetCase.Accessor vetCaseAccessor = VetCase.Accessor.Instance(null); ViewBag.CanUpdate = vetCaseAccessor.CanUpdate; ViewBag.RootKey = rootKey; ViewBag.Name = name; ViewBag.IdfSpecies = idfSpecies; var vetCase = (VetCase)ModelStorage.Get(Session.SessionID, rootKey, null); EditableList <VetFarmTree> farmTree = ModelStorage.Get(Session.SessionID, rootKey, m_FarmTreeSessionKey) as EditableList <VetFarmTree>; if (farmTree == null && vetCase.Farm.FarmTree != null) { ModelStorage.Put(Session.SessionID, rootKey, rootKey, m_FarmTreeSessionKey, vetCase.Farm.FarmTree); } ViewBag.ReturnMethodName = vetCase._HACode == (int)HACode.Livestock ? "HerdDetails" : "FlockDetails"; VetFarmTree species = VetFarmTreeProcessor.GetSpecies(Session.SessionID, rootKey, name, idfSpecies, HACode.Livestock); ViewBag.SpeciesName = species.SpeciesType.name; if (vetCase._HACode == (int)HACode.Livestock) { ViewBag.IsHerdDetails = true; ViewBag.HerdName = species.strHerdName; } else { ViewBag.IsHerdDetails = false; ViewBag.FlockName = species.strHerdName; } Session["ReturnUrl"] = Url.Action("ClinicalSigns", "VetCase", new { rootKey = ViewBag.RootKey, name = ViewBag.Name, idfSpecies = ViewBag.IdfSpecies }); return(View()); }
public ActionResult ShowFarmTreeFlexibleForm(long root, long key, string name, bool canUpdate = true) { var list = ModelStorage.Get(Session.SessionID, root, name) as EditableList <VetFarmTree>; if (list == null) { return(PartialView("Empty")); } var vetFarmTree = list.Find(t => t.idfParty == key); long ffPresenterKey = GetAdditionalKeyFFPresenter(vetFarmTree.FFPresenterCs); Session["idfSpecies"] = key; Session["FfPresenterKey"] = ffPresenterKey; IObjectPermissions permission = vetFarmTree.GetPermissions(); bool isReadOnly = permission == null ? false : permission.IsReadOnlyForEdit; vetFarmTree.FFPresenterCs.ReadOnly = isReadOnly; ModelStorage.Put(Session.SessionID, root, key, ffPresenterKey.ToString(), vetFarmTree.FFPresenterCs); ViewBag.FFKey = key; ViewBag.FFpresenterId = ffPresenterKey; ViewBag.CanUpdate = canUpdate; return(ShowFlexibleForm(root, key, ffPresenterKey)); }
public ActionResult General(long id, int?caseType = null, bool getFromSession = true) { VetCase.Accessor vetCaseAccessor = VetCase.Accessor.Instance(null); ViewBag.CanUpdate = vetCaseAccessor.CanUpdate; VetCase vetCase; if (getFromSession) { vetCase = (VetCase)ModelStorage.Get(Session.SessionID, id, null); } else { if (!caseType.HasValue) { caseType = (int)HACode.Livestock; } using (DbManagerProxy manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance)) { var acc = VetCase.Accessor.Instance(null); vetCase = id.Equals(0) ? acc.CreateNewT(manager, null, caseType.Value) : acc.SelectByKey(manager, id); if (id.Equals(0)) { SetDefaultValues(vetCase); } ModelStorage.Put(Session.SessionID, vetCase.idfCase, vetCase.idfCase, null, vetCase); ModelStorage.Put(Session.SessionID, vetCase.idfCase, vetCase.Farm.idfFarm, null, vetCase.Farm); } } caseType = vetCase._HACode; Session["CaseType"] = caseType; Session["IdfCase"] = vetCase.idfCase; AddTitleData(vetCase._HACode); return(View(vetCase)); }
public ActionResult ShowGeoLocation(long root, GeoLocation geoLocation) { ModelStorage.Put(Session.SessionID, root, geoLocation.idfGeoLocation, null, geoLocation); return(PartialView(geoLocation)); }