Пример #1
0
        private string GetPrimaryCriteriaTypes()
        {
            var entities = SqlHelper <PrimaryCriteria> .List(_sourceSqlConStr, SourceMlsRegion.MlsRegionId);

            if (entities == null || entities.Count() == 0)
            {
                return(string.Empty);
            }

            foreach (var entity in entities)
            {
                entity.MLSRegion_ID = TargetMlsRegion.MlsRegionId;
            }

            return(SqlTextGenerator.InsertQueryGenerate(entities));
        }
Пример #2
0
        private string GetSearchGroups(bool withCheckFeatures)
        {
            if (withCheckFeatures && string.IsNullOrEmpty(_targetSqlConStr))
            {
                throw new ArgumentNullException("For mode \"Check Features\" need set Target Connection String");
            }
            StringBuilder builder  = new StringBuilder();
            var           entities = SqlHelper <SearchFeatureGroup> .List(_sourceSqlConStr, SourceMlsRegion.MlsRegionId);

            var searchFeatures = SqlHelper <SearchFeature> .List(_sourceSqlConStr, SourceMlsRegion.MlsRegionId);

            if (entities == null || entities.Count() == 0)
            {
                return(string.Empty);
            }

            var exEnt = entities.First();
            int order = 1;

            foreach (var entity in entities)
            {
                entity.MLSRegion_ID = TargetMlsRegion.MlsRegionId;
                entity.Order        = order;
                order++;
            }

            var nameVariable = $"@{exEnt.GetGroupNameForVariable()}ID";

            builder.AppendLine(SqlTextGenerator.DeclareVariableInt(nameVariable));
            builder.AppendLine();
            builder.AppendLine(SqlTextGenerator.SetVariableInt(nameVariable));
            builder.AppendLine();
            foreach (var entity in entities)
            {
                builder.AppendLine(SqlTextGenerator.InsertQueryGenerate(new SearchFeatureGroup[] { entity }));
                var srchFeatures = searchFeatures.Where(x => x.SearchFormFeatureGroup_ID == entity.ID + "");
                builder.AppendLine();
                builder.AppendLine(SqlTextGenerator.InsertQueryGenerate(srchFeatures));
                builder.AppendLine();
            }
            return(builder.ToString());
        }