示例#1
0
文件: ImportRef.cs 项目: jibrel/leaf
        public string ToQuery(CompilerOptions opts)
        {
            var alias     = $"{opts.Alias}I";
            var valueNum  = new Column("ValueNumber");
            var valueDate = new Column("ValueDate");
            var sourceMod = new Column("SourceModifier");
            var importId  = new Column("ImportMetadataId");
            var rowId     = new Column("Id");
            var personId  = new ExpressedColumn(opts.FieldPersonId, new Expression($"{alias}.PersonId"));
            var encId     = new ExpressedColumn(opts.FieldEncounterId, new Expression("CONVERT(NVARCHAR(10),NULL)"));

            var where = new List <IEvaluatable>();
            where.Add(importId == MetadataId.ToString());
            where.Add(new RawEval($"{alias}.{rowId} LIKE '{UniversalId.BaseSegment}%'"));

            if (UniversalId.Value.HasValue)
            {
                where.Add(valueNum == (int)UniversalId.Value);
            }
            if (UniversalId.UseModifier)
            {
                where.Add(sourceMod == UniversalId.Modifier);
            }

            var query = new NamedSet
            {
                Select = new ISelectable[] { personId, encId, valueNum, valueDate },
                From   = $"{opts.AppDb}.app.Import",
                Alias  = alias,
                Where  = where
            };

            return(query.ToString());
        }
示例#2
0
        /// <summary>
        /// The name of the keys as held in the custom attribute.
        /// Names can be stored with numbers appended to support syncing the same object between multiple calendars.
        /// CalendarID is the master keyname to determine an ID set number.
        /// </summary>
        private static String metadataIdKeyName(MetadataId Id)
        {
            switch (Id)
            {
            case MetadataId.gEventID: return("googleEventID");

            case MetadataId.gCalendarId: return("googleCalendarID");

            case MetadataId.ogcsModified: return("OGCSmodified");

            case MetadataId.forceSave: return("forceSave");

            default: return(Id.ToString());
            }
        }