Exemplo n.º 1
0
        /// <summary>
        /// 收集具体检查项
        /// </summary>
        /// <param name="_manager"></param>
        /// <param name="_strArr"></param>
        private static void GetOptionMix(AssetCheckManager _manager, string[] _strArr, List <CheckOption> _optionList)
        {
            if (_manager == null)
            {
                return;
            }

            int arrLen = _strArr.Length;

            for (int i = 0; i < arrLen; i++)
            {
                CheckOption option = (CheckOption)System.Enum.Parse(typeof(CheckOption), _strArr[i]);
                _optionList.Add(option);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加或删除检查项
        /// </summary>
        /// <param name="_option"></param>
        /// <param name="_add"></param>
        public void SetOptionList(CheckOption _option, bool _add = true)
        {
            bool contains = checkOptionList.Contains(_option);

            if (_add)
            {
                if (!contains)
                {
                    checkOptionList.Add(_option);
                }
            }
            else
            {
                if (contains)
                {
                    checkOptionList.Remove(_option);
                }
            }

            checkManager.SetIncludeOptionList(checkOptionList);
        }
Exemplo n.º 3
0
        public int RunCheckOption(CheckOption opts)
        {
            //run the migration
            string connectionString = _configurationService.GetValueOrDefault(opts.ConnectionString, ENVIRONMENT_VARIABLE.YUNIQL_CONNECTION_STRING);;
            string platform         = _configurationService.GetValueOrDefault(opts.Platform, ENVIRONMENT_VARIABLE.YUNIQL_PLATFORM, defaultValue: SUPPORTED_DATABASES.SQLSERVER);

            try
            {
                var dataService = _dataServiceFactory.Create(platform);
                dataService.Initialize(connectionString);

                var connectivityService = new ConnectivityService(dataService, _traceService);
                connectivityService.CheckConnectivity();
            }
            catch (Exception ex)
            {
                return(OnException(ex, "Failed to execute ping function", opts.IsDebug));
            }

            return(0);
        }
Exemplo n.º 4
0
        public static void MergeCoverage(this StudyUnit curStudyUnit, StudyUnit newStudyUnit)
        {
            //Merge of the study range is different for each part
            Coverage newCoverage = newStudyUnit.Coverage;
            Coverage curCoverage = curStudyUnit.Coverage;

            //1. Topical Coverage
            CheckOption.Merge(newCoverage.Topics, curCoverage.Topics);

            //2. Keyword
            curCoverage.Keywords.AddRange(newCoverage.Keywords);

            //3. Temporal Coverage
            curCoverage.DateRange = newCoverage.DateRange;

            //4. Geographic Levels Covered
            CheckOption.Merge(newCoverage.Areas, curCoverage.Areas);

            //5. Description
            curCoverage.Memo = newCoverage.Memo;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a query for creation or alteration of a view
        /// </summary>
        /// <param name="sb">StringBuilder to write the query in</param>
        /// <param name="actionName">The name of the requested action</param>
        private void CreateQuery(StringBuilder sb, string actionName)
        {
            // Adding the name of the action
            sb.Append(actionName);

            // Adding an algorithm
            if (Algorithm != Algorithms.UNDEFINED)
            {
                sb.Append(" ALGORITHM = ");
                sb.Append(Algorithm.ToString());
            }

            // Adding definer if not current user
            string definer = DataInterpreter.GetStringNotNull(Attributes, View.Definer);

            if (!DataInterpreter.CompareInvariant(definer, CurretnUser))
            {
                QueryBuilder.WriteUserNameIfNotEmpty(definer, " DEFINER = ", sb);
            }


            // Adding security type, if are not empty
            QueryBuilder.WriteIfNotEmptyString(Attributes, View.SecurityType, " SQL SECURITY ", sb, false);

            // Adding definition of a view
            sb.Append(" VIEW ");
            QueryBuilder.WriteIdentifier(Attributes, View.Name, sb);
            sb.Append(" AS ");
            sb.AppendLine();
            QueryBuilder.WriteValue(Attributes, View.Definition, sb, false);

            // Adding check options
            if (CheckOption != CheckOptions.NONE)
            {
                sb.AppendLine();
                sb.Append(" WITH ");
                sb.Append(CheckOption.ToString());
                sb.Append(" CHECK OPTION");
            }
        }
Exemplo n.º 6
0
 public CheckOptionVM(BaseVM parent, CheckOption checkOption) : base(parent)
 {
     this.checkOption = checkOption;
 }