public override ValidationResult Validate()
        {
            ValidationResult result = base.Validate();

            result.AddErrorIf(Entity == default(Dynamics365Entity), Properties.Resources.Dynamics365RecordOperationValidateEntity, nameof(Entity));
            result.AddErrorIf(DataSource == default(IDataSource), Properties.Resources.Dynamics365RecordOperationValidateDataSource, nameof(DataSource));
            if (DataSource != default(IDataSource))
            {
                result.Errors.AddRange(DataSource.Validate().Errors);
            }
            result.AddErrorIf(BatchSize <MINIMUM_BATCH_SIZE || BatchSize> MAXIMUM_BATCH_SIZE, string.Format(Properties.Resources.Dynamics365RecordOperationValidateBatchSize, MINIMUM_BATCH_SIZE, MAXIMUM_BATCH_SIZE), nameof(BatchSize));
            result.AddErrorIf(ThreadCount <MINIMUM_THREAD_COUNT || ThreadCount> MAXIMUM_THREAD_COUNT, string.Format(Properties.Resources.Dynamics365RecordOperationValidateThreadCount, MINIMUM_THREAD_COUNT, MAXIMUM_THREAD_COUNT), nameof(ThreadCount));

            if (CanValidateTarget())
            {
                result.AddErrorIf(TargetSource != TargetSource.None && Target == default(FieldValue), Properties.Resources.Dynamics365RecordOperationValidateTargetRecord, nameof(Target));

                if (Target != default(FieldValue))
                {
                    result.Errors.AddRange(Target.Validate().Errors);
                }
            }

            return(result);
        }
        public override ValidationResult Validate()
        {
            ValidationResult result = base.Validate();

            result.AddErrorIf(((Dynamics365Field)DestinationField)?.Targets?.Length > 1 && targetMode == TargetMode.Fixed && TargetEntity == default(Dynamics365Entity), string.Format("Please select a Target Entity for the '{0}' field value mapping", DestinationField?.DisplayName ?? "<Unknown>"));
            result.AddErrorIf(((Dynamics365Field)DestinationField)?.Targets?.Length > 1 && targetMode == TargetMode.Variable && TargetEntityField == default(Field), string.Format("Please select a Target Entity Field for the '{0}' field value mapping", DestinationField?.DisplayName ?? "<Unknown>"));
            return(result);
        }
예제 #3
0
        /// <summary>
        /// Validates the connection settings.
        /// </summary>
        /// <returns>The validation result.</returns>
        public override ValidationResult Validate()
        {
            ValidationResult result = new ValidationResult();

            try
            {
                result.AddErrorIf(ConnectionString == default(string), "The Connection String has not been specified");
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
예제 #4
0
        /// <summary>
        /// Validates the data source.
        /// </summary>
        /// <returns>The validation result.</returns>
        public override ValidationResult Validate()
        {
            ValidationResult result = base.Validate();

            try
            {
                result.AddErrorIf(FetchXml == default(string), "Please enter the FetchXML", nameof(FetchXml));
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
예제 #5
0
        /// <summary>
        /// Validates the CsvDataSource settings.
        /// </summary>
        /// <returns>The validation result.</returns>
        public override ValidationResult Validate()
        {
            ValidationResult result = base.Validate();

            try
            {
                result.AddErrorIf(Delimiter == default(string), Properties.Resources.CsvDataSourceValidateDelimiter);
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
예제 #6
0
        public override ValidationResult Validate()
        {
            ValidationResult result = new ValidationResult();

            try
            {
                result.AddErrorIf(Path == default(string), Properties.Resources.FileDataSourceValidatePathMissing);
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
예제 #7
0
        /// <summary>
        /// Validates the data source.
        /// </summary>
        /// <returns>The validation result.</returns>
        public override ValidationResult Validate()
        {
            ValidationResult result = base.Validate();

            try
            {
                result.AddErrorIf(Entity == default(Dynamics365Entity), Properties.Resources.Dynamics365ViewDataSourceValidateEntity, nameof(Entity));
                result.AddErrorIf(View == default(Dynamics365View), Properties.Resources.Dynamics365ViewDataSourceValidateView, nameof(View));
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
        /// <summary>
        /// Validates the SqlServerQueryDataSource settings.
        /// </summary>
        /// <returns>The validation result.</returns>
        public override ValidationResult Validate()
        {
            ValidationResult result = new ValidationResult();

            try
            {
                // result.Errors.AddRange(ParentConnection.Validate().Errors);   // todo - what to do here?
                result.AddErrorIf(query == default(string), "Query is missing");
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
        /// <summary>
        /// Validates the data source.
        /// </summary>
        /// <returns>The validation result.</returns>
        public override ValidationResult Validate()
        {
            ValidationResult result = base.Validate();

            try
            {
                result.AddErrorIf(Entity == default(Dynamics365Entity), "Please select an Entity", nameof(Entity));
                result.AddErrorIf(Fields.Count == 0, "Please select at least one Field", nameof(Fields));
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
예제 #10
0
        public override ValidationResult Validate()
        {
            ValidationResult result = new ValidationResult();

            try
            {
                result.AddErrorIf(hostName == default(string), "Please specify the Host Name", nameof(HostName));
                result.AddErrorIf(userName == default(string), "Please specify the User Name", nameof(UserName));
                result.AddErrorIf(password == default(string), "Please specify the Password", nameof(Password));
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
예제 #11
0
        public override ValidationResult Validate()
        {
            ValidationResult result = new ValidationResult();

            try
            {
                result.AddErrorIf(Connection == default(Dynamics365Connection), Properties.Resources.Dynamics365OperationConnectionValidateConnection, nameof(Connection));
                if (Connection != default(Dynamics365Connection))
                {
                    result.Errors.AddRange(Connection.Validate().Errors);
                }
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
        public override ValidationResult Validate()
        {
            ValidationResult result = base.Validate();

            try
            {
                result.AddErrorIf(KeyValues.Count == 0, Properties.Resources.Dynamics365UpsertOperationValidateKeyValues, nameof(KeyValues));

                foreach (FieldValue value in keyValues)
                {
                    result.Errors.AddRange(value.Validate().Errors);
                }
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
예제 #13
0
        /// <summary>
        /// Validates the data source.
        /// </summary>
        /// <returns>The validation result.</returns>
        public override ValidationResult Validate()
        {
            ValidationResult result = base.Validate();

            try
            {
                if (Path != default(string))
                {
                    FileInfo excelFile = new FileInfo(Path);
                    result.AddErrorIf(excelFile.Extension.ToLower() != EXTENSION_BINARY && excelFile.Extension.ToLower() != EXTENSION_OPEN_XML, Properties.Resources.ExcelDataSourceValidateFileExtension);
                    result.AddErrorIf(string.IsNullOrEmpty(SheetName), Properties.Resources.ExcelDataSourceValidateSheetName, nameof(SheetName));
                }
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
예제 #14
0
        /// <summary>
        /// Validates the FileOperation settings.
        /// </summary>
        /// <returns>The validation result.</returns>
        public override ValidationResult Validate()
        {
            ValidationResult result = new ValidationResult();

            try
            {
                result.AddErrorIf(OutputPath == default(string), Properties.Resources.FileOperationValidateOutputPath, nameof(OutputPath));
                result.AddErrorIf(DataSource == default(IDataSource), Properties.Resources.FileOperationValidateDataSource, nameof(DataSource));

                if (DataSource != default(IDataSource))
                {
                    result.Errors.AddRange(DataSource.Validate().Errors);
                }
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
예제 #15
0
        /// <summary>
        /// Validates the operation.
        /// </summary>
        /// <returns>The validation result.</returns>
        public override ValidationResult Validate()
        {
            ValidationResult result = base.Validate();

            try
            {
                result.AddErrorIf(Relationship == default(Dynamics365Relationship), Properties.Resources.Dynamics365RelationshipOperationValidateRelationship, nameof(Relationship));
                result.AddErrorIf(AssociatedEntity == default(Dynamics365Entity), Properties.Resources.Dynamics365RelationshipOperationValidateAssociatedEntity, nameof(AssociatedEntity));
                result.AddErrorIf(AssociatedSource == default(TargetSource), Properties.Resources.Dynamics365RelationshipOperationValidateAssociatedSource, nameof(AssociatedSource));
                result.AddErrorIf(AssociatedTarget == default(FieldValue), Properties.Resources.Dynamics365RelationshipOperationValidateAssociatedRecord, nameof(AssociatedTarget));
                if (AssociatedTarget != default(FieldValue))
                {
                    result.Errors.AddRange(AssociatedTarget.Validate().Errors);
                }
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }
예제 #16
0
        public override ValidationResult Validate()
        {
            ValidationResult result = base.Validate();

            try
            {
                result.AddErrorIf(values.Count == 0, Properties.Resources.Dynamics365FieldOperationValidateValues, nameof(Values));

                Dictionary <string, Dynamics365Field> fields = new Dictionary <string, Dynamics365Field>();

                foreach (FieldValue value in values)
                {
                    result.Errors.AddRange(value.Validate().Errors);

                    //if (value.DestinationField is Dynamics365Field field)
                    //{
                    //    string key = string.Format("{0}:{1}", field.EntityLogicalName, field.LogicalName);

                    //    if (!fields.ContainsKey(key))
                    //    {
                    //        fields[key] = field;
                    //    }
                    //    else
                    //    {
                    // todo - this has been allowed to support customerid lookups where different rows look up to a different target entity
                    //result.AddErrorIf(true, string.Format(Properties.Resources.Dynamics365FieldOperationValidateValuesDuplicate, field.DisplayName), nameof(Values));
                    //}
                    //}
                }
            }
            catch (Exception ex)
            {
                result.AddErrorIf(true, ex.Message);
            }

            return(result);
        }