Пример #1
0
        public void NoneRequestOverriding()
        {
            var result = AssociationHelper.BuildAssociationsToPrefetch(new DetailRequest {
                AssociationsToFetch = "#none"
            }, WithProperty("#all")).ToFetchList;

            Assert.AreEqual("#none", result[0]);
        }
Пример #2
0
        static bool PreProcessApplicationArgs(string[] args)
        {
            if (AssociationHelper.PreProcessApplicationArgs(args))
            {
                return(true);
            }

            return(false);
        }
Пример #3
0
        public void TestMerge()
        {
            var result = AssociationHelper.BuildAssociationsToPrefetch(new DetailRequest {
                AssociationsToFetch = "x"
            }, WithProperty("y")).ToFetchList;

            Assert.AreEqual("y", result[0]);
            Assert.AreEqual("x", result[1]);
        }
Пример #4
0
        public void RequestNullReturnApp()
        {
            var result = AssociationHelper.BuildAssociationsToPrefetch(_blankRequest, WithProperty("#all")).ToFetchList;

            Assert.AreEqual("#all", result.First());
            result = AssociationHelper.BuildAssociationsToPrefetch(_blankRequest, WithProperty("fromlocation,xxx")).ToFetchList;
            Assert.AreEqual("fromlocation", result[0]);
            Assert.AreEqual("xxx", result[1]);
        }
Пример #5
0
        public void TestAllButSchema2()
        {
            var result = AssociationHelper.BuildAssociationsToPrefetch(new DetailRequest {
                AssociationsToFetch = AssociationHelper.AllButSchema
            }, new ApplicationSchemaDefinition());

            Assert.IsTrue(result.ShouldResolve("x"));
            Assert.IsTrue(result.ShouldResolve("z"));
            Assert.IsTrue(result.ShouldResolve("y"));
        }
Пример #6
0
        public void TestAllButSchema()
        {
            var result = AssociationHelper.BuildAssociationsToPrefetch(new DetailRequest {
                AssociationsToFetch = AssociationHelper.AllButSchema
            }, WithProperty("y"));

            Assert.IsTrue(result.ShouldResolve("x"));
            Assert.IsTrue(result.ShouldResolve("z"));
            Assert.IsFalse(result.ShouldResolve("y"));
        }
Пример #7
0
        protected override void PutSettings()
        {
            ListItem.Select(CmbLanguages, GetString(OptionNames.Localization.LanguageID), StringComparer.OrdinalIgnoreCase);
            uiThemesDropDownList1.SelectedTheme = GetString(OptionNames.Appearances.UIThemeName);
            CmbSaveTabs.Value          = GetValue(OptionNames.Miscellaneous.SaveTabs, SaveTabsType.Ask);
            CkbAssociate.Checked       = AssociationHelper.TestBmdAssociation();
            CkbSaveRecentFiles.Checked = GetValue(OptionNames.Miscellaneous.SaveRecentFiles, true);

            CkbShowLineCap.Checked      = GetBool(OptionNames.Charts.ShowLineArrowCap);
            CkbShowRemarkIcon.Checked   = GetBool(OptionNames.Charts.ShowRemarkIcon);
            BtnDefaultFont.SelectedFont = GetValue <Font>(OptionNames.Charts.DefaultFont);

            CkbPrintDocumentTitle.Checked = GetBool(OptionNames.PageSettigs.PrintDocumentTitle);
        }
Пример #8
0
 void CkbAssociate_CheckedChanged(object sender, EventArgs e)
 {
     if (!CkbAssociate_ChangeBySelf && CkbAssociate.Checked != AssociationHelper.TestBmdAssociation())
     {
         CkbAssociate_ChangeBySelf = true;
         try
         {
             AssociationHelper.RegisterDocType(CkbAssociate.Checked);
         }
         catch (System.Exception ex)
         {
             this.ShowMessage(ex);
         }
         Thread.Sleep(500);
         CkbAssociate.Checked      = AssociationHelper.TestBmdAssociation();
         CkbAssociate_ChangeBySelf = false;
     }
 }
Пример #9
0
        public void RefreshAssociations()
        {
            _logger.Information("Attempting to link sites and folders");
            SiteDal siteDal = new SiteDal(_configuration, _logger);
            IEnumerable <SiteForExtendedTicketDto> sites = siteDal.GetSiteForExtendedTicket("red alert").GetAwaiter().GetResult();

            _logger.Information($"Retreived {sites.Count()} new link sites");
            Dictionary <string, int> siteAssociation = new AssociationHelper(sites, _logger).SiteAssociation;

            foreach (KeyValuePair <string, int> site in siteAssociation)
            {
                CRUDEnums.ActionResult result = siteDal.Post(site.Value, site.Key).GetAwaiter().GetResult();
                if (result != CRUDEnums.ActionResult.Success)
                {
                    _logger.Error($"Error updating site {site.Value} with external identifier {site.Key} Error {result.ToString()}");
                }
            }
            _logger.Information("Completed link sites and folders");
        }
Пример #10
0
        /// <summary>
        /// Retrieve the list of clinical problems for a patient encounter.
        /// </summary>
        /// <param name="id">encounter id</param>
        /// <returns>An xml serializtion string of a list of clinical problems</returns>
        string IDecisionSupportService.RetrieveProblemList(int id)
        {
            var encounter = db.EncounterContextItemDefinitionFind(id);
            if (encounter == null)
                return "";
            try
            {
                var list = new List<ClinicalProblemInstanceSimpleObject>();

                foreach (var instance in AssociationHelper.SearchClinicalProblemInstance(encounter, db))
                {

                    var simpleObject = new ClinicalProblemInstanceSimpleObject()
                    {                        
                        Reports = new List<KeyValuePair<string, string>>(),
                        Facts = new List<string>(),
                        OrderSet = new List<string>(),
                        History = new List<string>()
                    };

                    simpleObject.Id = instance.Id;
                    simpleObject.Priority = instance.Priority;
                    simpleObject.State = instance.State;
                    if(instance.ClinicalProblemDefinition!=null && string.IsNullOrEmpty(instance.ClinicalProblemDefinition.Name)==false)
                        simpleObject.Name = instance.ClinicalProblemDefinition.Name;
                    if(instance.ChangeRecord!=null && instance.ChangeRecord.Count()>0)
                        simpleObject.TimeStamp = instance.ChangeRecord.ElementAt(0).TimeStamp.Value;
                    if (instance.ClinicalProblemDefinition != null && instance.ClinicalProblemDefinition.TriggerRule != null)
                        simpleObject.TriggerRule = RuleSetHelper.GetLaymanConditionString(instance.ClinicalProblemDefinition.TriggerRule.RuleSet);

                    foreach (var fact in instance.Facts)
                    {
                        var factString = string.IsNullOrEmpty(fact.ContextItemDefinition.ReferenceRange) ?
                            fact.ContextItemDefinition.Name + " = " + fact.ValueString() :
                            fact.ContextItemDefinition.Name + " = " + fact.ValueString() + " (参考范围:" + fact.ContextItemDefinition.ReferenceRange + ")";
                        simpleObject.Facts.Add(factString);
                    }

                    foreach (var report in instance.Reports)
                    {
                        simpleObject.Reports.Add(new KeyValuePair<string, string>(report.TimeStamp + " " + report.ReportType, report.URL));
                    }

                    // Don't need to show history for now.
                    //foreach (var record in instance.ChangeRecord)
                    //{
                    //    simpleObject.History.Add();
                    //}

                    int count = 0;
                    foreach (var order in db.MedicalOrderSet)
                    {
                        simpleObject.OrderContextItemDefinitionAdd(order.Name);
                        if (count++ > 10)
                            break;
                    }

                    list.Add(simpleObject);
                }                

                var obj = list as object;
                return SerializationHelper.Serialize(ref obj);
            }
            catch
            {
                return "";
            }
        }
Пример #11
0
        public void BothNulls()
        {
            var result = AssociationHelper.BuildAssociationsToPrefetch(_blankRequest, new ApplicationSchemaDefinition()).ToFetchList;

            Assert.AreEqual("#none", result[0]);
        }
Пример #12
0
        //TODO: add locale,and format options
        public IDictionary <string, BaseAssociationUpdateResult> BuildAssociationOptions(AttributeHolder dataMap, ApplicationMetadata application, IAssociationPrefetcherRequest request)
        {
            var associationsToFetch = AssociationHelper.BuildAssociationsToPrefetch(request, application.Schema);

            if (associationsToFetch.IsNone)
            {
                return(new Dictionary <string, BaseAssociationUpdateResult>());
            }


            IDictionary <string, BaseAssociationUpdateResult> associationOptionsDictionary = new ConcurrentDictionary <string, BaseAssociationUpdateResult>();
            var before = LoggingUtil.StartMeasuring(Log, "starting association options fetching for application {0} schema {1}", application.Name, application.Schema.Name);

            var associations = application.Schema.Associations;
            var tasks        = new List <Task>();
            var ctx          = ContextLookuper.LookupContext();

            #region associations

            foreach (var applicationAssociation in associations)
            {
                if (!associationsToFetch.ShouldResolve(applicationAssociation.AssociationKey))
                {
                    Log.Debug("ignoring association fetching: {0}".Fmt(applicationAssociation.AssociationKey));
                    continue;
                }

                //only resolve the association options for non lazy associations or lazy loaded with value set.
                SearchRequestDto search;
                if (!applicationAssociation.IsLazyLoaded())
                {
                    search = new SearchRequestDto();
                }
                else if (dataMap != null && dataMap.GetAttribute(applicationAssociation.Target) != null)
                {
                    //if the field has a value, fetch only this single element, for showing eventual extra label fields... ==> lookup with a selected value
                    search = new SearchRequestDto();
                    var toAttribute    = applicationAssociation.EntityAssociation.PrimaryAttribute().To;
                    var prefilledValue = dataMap.GetAttribute(applicationAssociation.Target).ToString();
                    search.AppendSearchEntry(toAttribute, prefilledValue);
                }
                else
                {
                    //lazy association with no default value
                    continue;
                }
                var association = applicationAssociation;

                tasks.Add(Task.Factory.NewThread(c => {
                    //this will avoid that one thread impacts any other, for ex: changing metadataid of the query
                    var perThreadContext = ctx.ShallowCopy();
                    Quartz.Util.LogicalThreadContext.SetData("context", perThreadContext);
                    var associationOptions = _associationOptionResolver.ResolveOptions(application, dataMap, association, search);
                    associationOptionsDictionary.Add(association.AssociationKey, new BaseAssociationUpdateResult(associationOptions));
                }, ctx));
            }
            #endregion

            #region optionfields
            foreach (var optionField in application.Schema.OptionFields)
            {
                if (!associationsToFetch.ShouldResolve(optionField.AssociationKey))
                {
                    Log.Debug("ignoring association fetching: {0}".Fmt(optionField.AssociationKey));
                    continue;
                }

                if (optionField.ProviderAttribute == null)
                {
                    //if there´s no provider, there´s nothing to do --> static list
                    continue;
                }
                var field = optionField;
                tasks.Add(Task.Factory.NewThread(c => {
                    Quartz.Util.LogicalThreadContext.SetData("context", c);
                    var associationOptions = _dynamicOptionFieldResolver.ResolveOptions(application, field, dataMap);
                    if (associationOptionsDictionary.ContainsKey(field.AssociationKey))
                    {
                        associationOptionsDictionary.Remove(field.AssociationKey);
                    }
                    associationOptionsDictionary.Add(field.AssociationKey, new BaseAssociationUpdateResult(associationOptions));
                }, ctx));
            }
            #endregion

            Task.WaitAll(tasks.ToArray());
            if (Log.IsDebugEnabled)
            {
                var keys = String.Join(",", associationOptionsDictionary.Keys.Where(k => associationOptionsDictionary[k].AssociationData != null));
                Log.Debug(LoggingUtil.BaseDurationMessageFormat(before, "Finished execution of options fetching. Resolved collections: {0}", keys));
            }


            return(associationOptionsDictionary);
        }