public static IEnumerable<DataEntity> ToDataEntities(this DataRow[] rows, string entityName, List<IPropertyDefinition> definition)
        {
            Dictionary<string, string> propertyDefinitionTypes = new Dictionary<string, string>();
            definition.ForEach(def => {
                propertyDefinitionTypes.Add(def.Name, def.PresentationType);
            });
            var list = new List<DataEntity>();
            foreach (DataRow row in rows)
            {
                var entity = new DataEntity(entityName)
                {
                    Properties = new EntityProperties()
                };
                foreach (DataColumn col in row.Table.Columns)
                {
                    var value = row[col];

                    string type = string.Empty;
                    if (propertyDefinitionTypes.ContainsKey(col.ColumnName))
                    {
                        type = propertyDefinitionTypes[col.ColumnName];
                    }
                    DateTime dt;
                    if (type == "System.DateTime" && DateTime.TryParse(value.ToString(), out dt))
                        entity.Properties.Add(col.ColumnName, dt);
                    else
                        entity.Properties.Add(col.ColumnName, value);
                }
                list.Add(entity);
            }
            return list;
        }
        public void DeleteNoRowsFoundInValidTest()
        {
            //create a new data entity
            DataEntity entity = new DataEntity();
            //create a new operation input with a new entity array for the input property
            OperationInput operationInput = new OperationInput { Input = new DataEntity[1] };
            //set the first item in the input property
            operationInput.Input[0] = entity;
            operationInput.Input[0].ObjectDefinitionFullName = "ScribeChangeHistory";
            //set the name of the operation
            operationInput.Name = "Delete";

            //create the comparison experssion for selecting the records to delete
            ComparisonExpression comparisonExpression = new ComparisonExpression();
            comparisonExpression.ExpressionType = ExpressionType.Comparison;
            comparisonExpression.Operator = ComparisonOperator.Less;
            comparisonExpression.LeftValue = new ComparisonValue { ValueType = ComparisonValueType.Constant, Value = "ModifiedOn" };
            comparisonExpression.RightValue = new ComparisonValue { ValueType = ComparisonValueType.Variable, Value = DateTime.MinValue };

            operationInput.LookupCondition[0] = comparisonExpression;
            //execute the operation from the connector
            OperationResult operationResult = _rsTargetConnector.ExecuteOperation(operationInput);
            //validate that the operation was not a success
            Assert.IsFalse(operationResult.Success[0]);
            //validate that no rows have been found
            Assert.AreEqual(0, operationResult.ObjectsAffected[0]);
        }
        public void DeleteInvalidDatePropertyTest()
        {
            //create a new data entity
            DataEntity entity = new DataEntity();

            //create a new operation input with a new entity array for the input property
            OperationInput operationInput = new OperationInput { Input = new DataEntity[1] };
            //set the first item in the input property
            operationInput.Input[0] = entity;

            //set the name of the operation
            operationInput.Name = "Delete";
            //create the comparison experssion for selecting the records to delete
            ComparisonExpression comparisonExpression = new ComparisonExpression();
            comparisonExpression.ExpressionType = ExpressionType.Comparison;
            comparisonExpression.Operator = ComparisonOperator.Less;
            comparisonExpression.LeftValue = new ComparisonValue { ValueType = ComparisonValueType.Constant, Value = "ModifiedOn" };
            //note: the invalid property where the date should be
            comparisonExpression.RightValue = new ComparisonValue { ValueType = ComparisonValueType.Variable, Value = InvalidPropertyValue };
            operationInput.LookupCondition[0] = comparisonExpression;
            //execute the operation from the connector
            OperationResult operationResult = _rsSourceConnector.ExecuteOperation(operationInput);
            //validate that the operation was not a success
            Assert.IsFalse(operationResult.Success[0]);
            //validate that the error info is filled in
            Assert.IsNotNull(operationResult.ErrorInfo[0]);
        }
Exemple #4
0
        private MethodResult executeCreate(DataEntity entity)
        {
            switch (entity.ObjectDefinitionFullName)
            {
                case Constants.Event:
                    return new ObjectDefinitions.Event(this.Connection).Create(entity, this.V2Connection);
                default:
                    throw new NotImplementedException();

            }

        }
		private ArrayList getData() {
			ArrayList result = new ArrayList(8);

			for (int i = 0; i < 8; i++) {
				DataEntity entity = new DataEntity();
				entity.value = i + 1;
				entity.category = "Item " + i;
				result.Add(entity);
			}

			return result;
		}
        public void CollectSample_handles_numbers_properly()
        {
            // arrange
            var       dataCollection = new DataCollection(_container, "PEOPLE");
            var       dataEntity     = new DataEntity("Age", DataType.Int, "Integer", _container, dataCollection);
            const int SampleSize     = 10;

            var sample = _sut.CollectSample(dataEntity, SampleSize);

            // assert
            sample.Should().HaveCount(SampleSize);
            sample.Should().OnlyContain(s => IsInt(s));
        }
        public void CollectSample_handles_strings_properly()
        {
            // arrange
            var       dataCollection = new DataCollection(_container, "PEOPLE");
            var       dataEntity     = new DataEntity("FirstName", DataType.String, "string", _container, dataCollection);
            const int SampleSize     = 10;

            var sample = _sut.CollectSample(dataEntity, SampleSize);

            // assert
            sample.Should().HaveCount(SampleSize);
            sample.Should().OnlyContain(x => !string.IsNullOrEmpty(x));
        }
        public void CollectSample_handles_booleans_properly()
        {
            // arrange
            var       dataCollection = new DataCollection(_container, "PEOPLE");
            var       dataEntity     = new DataEntity("IsDeleted", DataType.Boolean, "Boolean", _container, dataCollection);
            const int SampleSize     = 202;

            var sample = _sut.CollectSample(dataEntity, SampleSize);

            // assert
            sample.Should().HaveCount(SampleSize);
            sample.Should().OnlyContain(s => IsBoolean(s));
        }
        public void CollectSample_handles_dates_properly()
        {
            // arrange
            var       dataCollection = new DataCollection(_container, "PEOPLE");
            var       dataEntity     = new DataEntity("DOB", DataType.DateTime, "Date", _container, dataCollection);
            const int SampleSize     = 10;

            var sample = _sut.CollectSample(dataEntity, SampleSize);

            // assert
            sample.Should().HaveCount(SampleSize);
            sample.Should().OnlyContain(s => IsDate(s));
        }
Exemple #10
0
        public void CollectSampleTest()
        {
            var entity = new DataEntity("name", DataType.String, "character varying", _container,
                                        new DataCollection(_container, "test_index"));

            var samples = _instance.CollectSample(entity, 5);

            Assert.InRange(samples.Count, 4, 6);

            var all_samples = _instance.CollectSample(entity, 7);

            Assert.InRange(all_samples.Count, 4, 8);
        }
Exemple #11
0
        public void CollectSample_simple_list()
        {
            // arrange
            var simpleInts = new DataEntity("simpleInts", DataType.Long, "long", _container, _collection);
            var knowInts   = new[] { "1", "2", "3" };

            // act
            var result = _sut.CollectSample(simpleInts, 10);

            // assert
            result.Should().HaveCountLessOrEqualTo(30);
            result.Should().OnlyContain(x => knowInts.Contains(x));
        }
Exemple #12
0
        public void CollectSample_nested_property()
        {
            // arrange
            var       zipEntity  = new DataEntity("addresses.type1.zip", DataType.String, "text", _container, _collection);
            const int sampleSize = 10;

            // act
            var result = _sut.CollectSample(zipEntity, sampleSize);

            // assert
            result.Should().HaveCountLessOrEqualTo(sampleSize);
            result.Should().OnlyContain(x => x == "Zip1");
        }
        public void CollectSampleTest()
        {
            var entity = new DataEntity("name", DataType.String, "varchar", _container,
                                        new DataCollection(_container, "test_index")
            {
                Schema = "test"
            });

            var samples = _instance.CollectSample(entity, 7);

            Assert.InRange(samples.Count, 5, 9);
            Assert.Contains("Wednesday", samples);
        }
        /// <summary>
        /// Verify if the data has the same size
        /// </summary>
        /// <param name="dataEntityLeft">Entity of the left data</param>
        /// <param name="dataEntityRight">entity of the right data</param>
        public DiffResult GetDiff(DataEntity dataEntityLeft, DataEntity dataEntityRight)
        {
            if (dataEntityLeft.Data.Length != dataEntityRight.Data.Length)
            {
                return new DiffResult {
                           Message = $"{_options.Messages.NotSameSize} {dataEntityLeft.Id}"
                }
            }
            ;

            return(null);
        }
    }
Exemple #15
0
        public static DataEntity DeData(string s, string email, string passcode)
        {
            DataEntity result = null;

            try
            {
                string ds = AesTool.Decrypt(s, passcode);
                ds     = AesTool.Decrypt(ds, email);
                result = Json.String2Object <DataEntity>(ds);
            }
            catch { }
            return(result);
        }
Exemple #16
0
        public void CollectSampleTest()
        {
            var entity = new DataEntity("name", DataType.String, "varchar", _container,
                                        new DataCollection(_container, "test_index"));

            var samples = _instance.CollectSample(entity, 2);

            Assert.Equal(2, samples.Count);

            samples = _instance.CollectSample(entity, 7);
            Assert.Equal(7, samples.Count);
            Assert.Contains("Wednesday", samples);
        }
Exemple #17
0
        public HandView([NotNull] IEntityRootComponent entityComponentHand, [NotNull] DataEntity dataEntityHand)
        {
            _handViewTransform  = entityComponentHand.Transform.gameObject.InstantiateOnRootCanvas().transform;
            entityComponentHand = _handViewTransform.GetComponent <IEntityRootComponent>();

            entityComponentHand.Init(null, dataEntityHand);

            var entityViewComponentHand = _handViewTransform.gameObject.GetComponent <EntityViewComponent>();

            entityViewComponentHand.Start();

            SetViewDifferentFromSourceEntity();
        }
		private ArrayList getData() {
			Java.Util.Random r = new Java.Util.Random();

			ArrayList result = new ArrayList();

			for (int i = 0; i < 8; i++) {
				DataEntity entity = new DataEntity();
				entity.value = r.NextInt(10) + 1;
				result.Add(entity);
			}

			return result;
		}
Exemple #19
0
        public override object LoadData(DataContext context, DataRow datarow)
        {
            object item = Activator.CreateInstance(ObjectType);

            LoadDataField(item, this, context, datarow);
            if (IsDataEntity)
            {
                DataEntity de = item as DataEntity;
                de.SetContext(context);
                de.LoadDataComplete();
            }
            return(item);
        }
        public ParallelHandler(DataEntity dataEntity, DataCheckParameters dataCheckParams)
        {
            this._dataEntity      = dataEntity;
            this._buffer          = dataEntity.PlotBuf;
            this._option          = new ParallelOptions();
            this._indexOffset     = 0;
            this._dataCheckParams = dataCheckParams;
            // 计算限制型配置并行度为内核个数
            _option.MaxDegreeOfParallelism = Environment.ProcessorCount;

            this._maxDatas = new double[_option.MaxDegreeOfParallelism];
            this._minDatas = new double[_option.MaxDegreeOfParallelism];
        }
		private ArrayList getData(){
			Java.Util.Random numberGenerator = new Java.Util.Random();
			ArrayList result = new ArrayList(8);

			for (int i = 0; i < 8; i++){
				DataEntity entity = new DataEntity();
				entity.value = numberGenerator.NextInt(10) + 1;
				entity.category = "Item " + i;
				result.Add(entity);
			}

			return result;
		}
Exemple #22
0
        /// <summary>
        /// Verify if the data are equal
        /// </summary>
        /// <param name="dataEntityLeft">Entity of the left data</param>
        /// <param name="dataEntityRight">entity of the right data</param>
        public DiffResult GetDiff(DataEntity dataEntityLeft, DataEntity dataEntityRight)
        {
            if (string.Equals(dataEntityLeft.Data, dataEntityRight.Data))
            {
                return new DiffResult {
                           Message = $"{_options.Messages.DataEqual} {dataEntityLeft.Id}"
                }
            }
            ;

            return(null);
        }
    }
Exemple #23
0
 private DataEntity EnvironmentInfoToDataEntity()
 {
     using (new Impersonator(connectionProps.Impersonate, connectionProps.Domainname, connectionProps.Username, connectionProps.Password))
     {
         var dataEntity = new DataEntity(ObjectNames.EnvironmentInfo);
         dataEntity.Properties = new EntityProperties();
         dataEntity.Properties.Add(EnvironmentInfoObjPropNames.AgentMachine, Environment.MachineName);
         dataEntity.Properties.Add(EnvironmentInfoObjPropNames.AgentTimezone, TimeZone.CurrentTimeZone.StandardName);
         dataEntity.Properties.Add(EnvironmentInfoObjPropNames.RunningAs, Environment.UserName);
         dataEntity.Properties.Add(EnvironmentInfoObjPropNames.StartTimeUTC, DateTime.Now.ToUniversalTime());
         return(dataEntity);
     }
 }
Exemple #24
0
        public void LearnerFromDataEntity()
        {
            var learnRefNumber = "LearnRefNumber";

            var dataEntity = new DataEntity(string.Empty)
            {
                EntityName = learnRefNumber,
            };

            var learner = NewService(dataEntityAttributeService: new Mock <IDataEntityAttributeService>().Object).MapLearner(dataEntity);

            learner.LearnRefNumber = learnRefNumber;
        }
 public DataEntityTreeNode(DataEntity entity, bool showItems)
     : base(entity.Name)
 {
     _entity         = entity;
     this.ImageIndex = this.SelectedImageIndex = 0;
     if (showItems)
     {
         foreach (DataItemEntity item in _entity.Items)
         {
             this.Nodes.Add(new DataEntityItemTreeNode(item));
         }
     }
 }
Exemple #26
0
        public static string EnData(DataEntity data)
        {
            string s = "";

            try
            {
                s = Json.Object2String(data);
                s = AesTool.Encrypt(s, data.User.Email);
                s = AesTool.Encrypt(s, data.User.Passcode);
            }
            catch { }
            return(s);
        }
        private void FillObjectSamples(DataEntity entity, string prefix, JObject obj, List <string> samples, double probability)
        {
            var rand = new Random();

            var properties = obj.Properties();

            foreach (var property in properties)
            {
                if (!entity.Name.StartsWith($"{prefix}{property.Name}"))
                {
                    continue;
                }

                if (entity.Name.Equals($"{prefix}{property.Name}"))
                {
                    if (property.Value.Type == JTokenType.Array)
                    {
                        var arr = (JArray)property.Value;
                        foreach (var item in arr)
                        {
                            if (rand.NextDouble() < probability)
                            {
                                samples.Add(item.ToString());
                            }
                        }
                    }
                    else
                    {
                        if (rand.NextDouble() < probability)
                        {
                            samples.Add(property.Value.ToString());
                        }
                    }
                }
                else if (property.Value.Type == JTokenType.Array)
                {
                    var arr = (JArray)property.Value;
                    foreach (var arrayItem in arr)
                    {
                        if (arrayItem.Type == JTokenType.Object)
                        {
                            FillObjectSamples(entity, $"{prefix}{property.Name}.", (JObject)arrayItem, samples, probability);
                        }
                    }
                }
                else if (property.Value.Type == JTokenType.Object)
                {
                    FillObjectSamples(entity, $"{prefix}{property.Name}.", (JObject)property.Value, samples, probability);
                }
            }
        }
Exemple #28
0
        void _submit(object sender, EventArgs e)
        {
            bool Insert = false;

            if (DataEntity == null)
            {
                Insert     = true;
                DataEntity = Activator.CreateInstance(DataEntityType) as IDataEntity;
            }

            foreach (var i in Children)
            {
                if (i is FieldBase)
                {
                    (i as FieldBase).Update(DataEntity);
                }
            }

            if (Updating != null)
            {
                Updating(this, new UpdateEventArgs(DataEntity));
            }

            try
            {
                int res;
                if (Insert)
                {
                    res = DataEntity.Insert(Data.CommandBuilder.InsertType.New, null);
                }
                else
                {
                    res = DataEntity.Update(null, UpdateFields);
                }
                if (res > -1)
                {
                    Tip.Text     = SuccessTip;
                    Tip.CssClass = FailCssClass;
                }
                else
                {
                    Tip.Text     = FailTip;
                    Tip.CssClass = FailCssClass;
                }
            }
            catch
            {
                Tip.Text     = FailTip;
                Tip.CssClass = FailCssClass;
            }
        }
        public IDataEntity BuildLearningDeliveryDataEntity(LearningDelivery learningDelivery)
        {
            var larsLearningDelivery = _larsReferenceDataService.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef);
            var larsStandard         = _larsReferenceDataService.LARSStandardForStandardCode(learningDelivery.StdCode);

            var larsFramework = larsLearningDelivery.LARSFrameworks?
                                .Where(lf => lf.FworkCode == learningDelivery.FworkCode &&
                                       lf.ProgType == learningDelivery.ProgType &&
                                       lf.PwayCode == learningDelivery.PwayCode).FirstOrDefault();

            var learningDeliveryFamsEntities         = learningDelivery?.LearningDeliveryFAMs?.Select(BuildLearningDeliveryFAM) ?? Enumerable.Empty <IDataEntity>();
            var larsFundingEntities                  = larsLearningDelivery?.LARSFundings?.Select(BuildLARSFunding) ?? Enumerable.Empty <IDataEntity>();
            var appFinRecordEntities                 = learningDelivery?.AppFinRecords?.Select(BuildApprenticeshipFinancialRecord) ?? Enumerable.Empty <IDataEntity>();
            var larsStandardCommonComponentEntities  = larsStandard?.LARSStandardCommonComponents?.Select(BuildLARSStandardCommonComponent) ?? Enumerable.Empty <IDataEntity>();
            var larsStandardAppFundingEntities       = larsStandard?.LARSStandardApprenticeshipFundings?.Select(BuildLARSStandardApprenticeshipFunding) ?? Enumerable.Empty <IDataEntity>();
            var larsFrameworkCommonComponentEntities = larsFramework?.LARSFrameworkCommonComponents?.Select(BuildLARSFrameworkCommonComponent) ?? Enumerable.Empty <IDataEntity>();
            var larsFrameworkAppFundingEntities      = larsFramework?.LARSFrameworkApprenticeshipFundings?.Select(BuildLARSFrameworkApprenticeshipFunding) ?? Enumerable.Empty <IDataEntity>();

            var entity = new DataEntity(Attributes.EntityLearningDelivery)
            {
                Attributes = new Dictionary <string, IAttributeData>()
                {
                    { Attributes.AimSeqNumber, new AttributeData(learningDelivery.AimSeqNumber) },
                    { Attributes.AchDate, new AttributeData(learningDelivery.AchDate) },
                    { Attributes.AimType, new AttributeData(learningDelivery.AimType) },
                    { Attributes.CompStatus, new AttributeData(learningDelivery.CompStatus) },
                    { Attributes.FrameworkCommonComponent, new AttributeData(larsLearningDelivery.FrameworkCommonComponent) },
                    { Attributes.FworkCode, new AttributeData(learningDelivery.FworkCode) },
                    { Attributes.LearnAimRef, new AttributeData(learningDelivery.LearnAimRef) },
                    { Attributes.LearnActEndDate, new AttributeData(learningDelivery.LearnActEndDate) },
                    { Attributes.LearnPlanEndDate, new AttributeData(learningDelivery.LearnPlanEndDate) },
                    { Attributes.LearnStartDate, new AttributeData(learningDelivery.LearnStartDate) },
                    { Attributes.OrigLearnStartDate, new AttributeData(learningDelivery.OrigLearnStartDate) },
                    { Attributes.OtherFundAdj, new AttributeData(learningDelivery.OtherFundAdj) },
                    { Attributes.PriorLearnFundAdj, new AttributeData(learningDelivery.PriorLearnFundAdj) },
                    { Attributes.ProgType, new AttributeData(learningDelivery.ProgType) },
                    { Attributes.PwayCode, new AttributeData(learningDelivery.PwayCode) },
                    { Attributes.STDCode, new AttributeData(learningDelivery.StdCode) },
                }
            };

            entity.AddChildren(learningDeliveryFamsEntities);
            entity.AddChildren(larsFundingEntities);
            entity.AddChildren(appFinRecordEntities);
            entity.AddChildren(larsStandardCommonComponentEntities);
            entity.AddChildren(larsStandardAppFundingEntities);
            entity.AddChildren(larsFrameworkCommonComponentEntities);
            entity.AddChildren(larsFrameworkAppFundingEntities);

            return(entity);
        }
        public static void CheckWarning(LoadDataToFormDev entity)
        {
            entity.Warning.Clear();
            DataEntity dataEntity = null;

            if (entity.LoadMode == LoadDataToFormEvent.EnumLoadDataToFormMode.DataEntity)
            {
                dataEntity = _dataEntityComponentService.GetDataEntity(entity.DataEntityId);
                if (dataEntity == null)
                {
                    entity.Warning.AddWarningSign(entity, Language.Current.EventDev_LoadDataToFormDev_DataEntityNotExist);
                }
                foreach (LoadDataToFormEvent.WhereItem where in entity.Where)
                {
                    if (dataEntity != null)
                    {
                        if (!dataEntity.Items.Contains(where.DataItem))
                        {
                            entity.Warning.AddWarningSign(entity, Language.Current.EventDev_RefreshListDev_DataItemEntityNotExist);
                        }
                    }
                    if (where.Source.Type == EnumEventDataSource.FormElement)
                    {
                        if (entity.HostFormEntity.Elements.Contains(where.Source.Source) == false)
                        {
                            entity.Warning.AddWarningSign(entity, Language.Current.EventDev_RefreshListDev_FormElementNotExist);
                        }
                    }
                }
            }
            foreach (LoadDataToFormEvent.WhereItem where in entity.Where)
            {
                if (entity.LoadMode == LoadDataToFormEvent.EnumLoadDataToFormMode.DataEntity)
                {
                    if (dataEntity != null)
                    {
                        if (dataEntity.Items.Contains(where.DataItem) == false)
                        {
                            entity.Warning.AddWarningSign(entity, Language.Current.EventDev_LoadDataToFormDev_DataItemEntityNotExist);
                        }
                    }
                }
                if (where.Source.Type == EnumEventDataSource.FormElement)
                {
                    if (entity.HostFormEntity.Elements.Contains(where.Source.Source) == false)
                    {
                        entity.Warning.AddWarningSign(entity, Language.Current.EventDev_LoadDataToFormDev_FormElementNotExist);
                    }
                }
            }
        }
Exemple #31
0
        public IDataEntity BuildGlobalDataEntity(FM70LearnerDto learner, Global global)
        {
            var entity = new DataEntity(Attributes.EntityGlobal)
            {
                Attributes = BuildGlobalAttributes(global)
            };

            if (learner != null)
            {
                entity.AddChild(BuildLearnerDataEntity(learner));
            }

            return(entity);
        }
Exemple #32
0
        private static void LoadTestEntryPoint(ISupplyCollector supplyCollector, DataContainer dataContainer, TestInfo testInfo, int testIndex)
        {
            Console.Write("Load testing... ");

            var            definition = testInfo.LoadTestDefinitions[testIndex];
            DataCollection collection = new DataCollection(dataContainer, definition.DataCollectionName);

            DataEntity entity = new DataEntity(definition.DataEntityName, DataType.String, "string", dataContainer, collection);

            var samples = supplyCollector.CollectSample(entity, definition.SampleSize);

            Console.WriteLine($" - success, collected {samples.Count} samples.");
            Console.WriteLine();
        }
Exemple #33
0
        private DataEntity GetDataEntity(BsonValue bsonValue, string propertyName, string parentProperty, DataCollection dataCollection, DataContainer container)
        {
            DataType dataType = GetDataType(bsonValue);

            string name = propertyName;

            if (!string.IsNullOrWhiteSpace(parentProperty))
            {
                name = parentProperty + "." + propertyName;
            }
            DataEntity dataEntity = new DataEntity(name, dataType, bsonValue.BsonType.ToString(), container, dataCollection);

            return(dataEntity);
        }
Exemple #34
0
        private T ToScribeModel <T>(DataEntity input) where T : new()
        {
            T scribeModel;

            try
            {
                scribeModel = reflector.To <T>(input);
            }
            catch (Exception e)
            {
                throw new ArgumentException("Error translating from DataEntity to ScribeModel: " + e.Message, e);
            }
            return(scribeModel);
        }
        public void CollectSampleTest()
        {
            var container = new DataContainer()
            {
                ConnectionString = $"{_container.ConnectionString}/key-collection-separator=:,key-levels=1,complex-values=true,complex-value-type=json"
            };

            var entity = new DataEntity("from.addr", DataType.String, "string", container,
                                        new DataCollection(container, "emails"));

            var samples = _instance.CollectSample(entity, 10);

            Assert.Equal(10, samples.Count);
        }
        public async Task <DataEntity> SaveAddress(DataEntity entity)
        {
            var _item = await Query.Where(e => e.Id == entity.Id).FirstOrDefaultAsync();

            if (_item == null)
            {
                _item = (await SaveEntity(entity.ToData(null)));
            }
            else
            {
                _item = (await SaveEntity(entity.ToData(_item)));
            }
            return(await GetData(_item.Id));
        }
Exemple #37
0
        internal MethodResult Create(DataEntity dataEntity, ScribeConnection v2Connection)
        {
            if (!dataEntity.Properties.ContainsKey(Constants.Event_NameProperty))
                throw new System.Exception("The data enitity is missing the name property");
            var name = dataEntity.Properties[Constants.Event_NameProperty].ToString();
            var result = DataServicesClient.CreateEvent(v2Connection, name);

            if (result.HasError)
                return new MethodResult() {Success = false, ErrorInfo = new ErrorResult() {
                    Description = result.Error.ToString()
                } };

            return updateEvent(result.EventId, dataEntity);
        }
Exemple #38
0
        public IDataEntity ConvertToDataEntity(IXsrcEntity xsrcEntity)
        {
            IDataEntity dataEntity =
                new DataEntity(xsrcEntity.PublicName)
            {
                Attributes = xsrcEntity
                             .Attributes
                             .GroupBy(a => a.PublicName)
                             .ToDictionary(a => a.Key, b => new AttributeData(null) as IAttributeData),
                Children = GetChidren(xsrcEntity.Children)
            };

            return(dataEntity);
        }
        public static DataEntity FirstDataEntity(this DataRow[] rows, string entityName)
        {
            if (rows.Length == 0)
                return null;

            var row = rows[0];
            var entity = new DataEntity(entityName)
            {
                Properties = new EntityProperties()
            };
            foreach (DataColumn col in row.Table.Columns)
            {
                entity.Properties.Add(col.ColumnName, row[col]);
            }
            return entity;
        }
		private ArrayList getData(){
			Java.Util.Random numberGenerator = new Java.Util.Random();
			ArrayList result = new ArrayList(8);
			int startingMonth =0;
			for (int i = 0; i < 8; i++){

				DataEntity entity = new DataEntity();
				entity.value = numberGenerator.NextInt(10) + 1;
				Calendar date = Calendar.Instance;
				date.Set(CalendarField.Month, startingMonth++);
				entity.date = date;
				if (i == 2 || i == 6){
					continue;
				}
				result.Add(entity);
			}

			return result;
		}
        /// <summary>
        /// Create a select string from the given table and columns.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="lookupCondition"></param>
        /// <param name="queryType"></param>
        private void Parse(DataEntity input, Expression lookupCondition, Globals.QueryType queryType)
        {
            var query = new StringBuilder(ParseQueryType(input, queryType));

            // add where clause (optional))
            if (lookupCondition != null && queryType != Globals.QueryType.Insert)
            {
                var whereClause = new StringBuilder(" " + WhereKeyword + " ");
                ParseWhereClause(whereClause, lookupCondition);
                query.Append(whereClause);
            }

            _query = query.ToString();
        }
        /// <summary>
        /// Provide the query for insert data by parsing the input DataEntity
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        private string ParseInsertQuery(DataEntity input)
        {
            StringBuilder columnNames = new StringBuilder();
            StringBuilder columnValues = new StringBuilder();
            columnNames.Append("(");
            columnValues.Append("(");

            // parse through the column names and values
            foreach (KeyValuePair<string, object> property in input.Properties)
            {

                columnNames.Append(string.Format(" [{0}],", property.Key));
                if (property.Value == null)
                {
                    columnValues.Append("null,");
                }
                else
                {
                    //create a the right comparison value
                    ComparisonValue rightValue = new ComparisonValue(ComparisonValueType.Constant, property.Value);

                    columnValues.Append(GetRightFormattedComparisonValue(property.Key, rightValue));
                    columnValues.Append(",");
                }
            }

            //remove the trailing commas and replace them with a closing brace
            columnNames = columnNames.Replace(',', ')', columnNames.Length - 1, 1);
            columnValues = columnValues.Replace(',', ')', columnValues.Length - 1, 1);

            return string.Format(" {0} [{1}] {2} {3}{4} {5}", IntoKeyword,
                input.ObjectDefinitionFullName,
                columnNames, Environment.NewLine, ValuesKeyword, columnValues);
        }
Exemple #43
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(DataEntity.Model.Order model)
 {
     StringBuilder strSql = new StringBuilder();
     StringBuilder strSql1 = new StringBuilder();
     StringBuilder strSql2 = new StringBuilder();
     if (model.CustID != null)
     {
         strSql1.Append("CustID,");
         strSql2.Append("" + model.CustID + ",");
     }
     if (model.ContractID != null)
     {
         strSql1.Append("ContractID,");
         strSql2.Append("" + model.ContractID + ",");
     }
     if (model.CustName != null)
     {
         strSql1.Append("CustName,");
         strSql2.Append("'" + model.CustName + "',");
     }
     if (model.ContractName != null)
     {
         strSql1.Append("ContractName,");
         strSql2.Append("'" + model.ContractName + "',");
     }
     if (model.WHF != null)
     {
         strSql1.Append("WHF,");
         strSql2.Append("" + model.WHF + ",");
     }
     if (model.WHNX != null)
     {
         strSql1.Append("WHNX,");
         strSql2.Append("" + model.WHNX + ",");
     }
     if (model.OrderDate != null)
     {
         strSql1.Append("OrderDate,");
         strSql2.Append("'" + model.OrderDate + "',");
     }
     if (model.State != null)
     {
         strSql1.Append("State,");
         strSql2.Append("'" + model.State + "',");
     }
     if (model.CustGM != null)
     {
         strSql1.Append("CustGM,");
         strSql2.Append("'" + model.CustGM + "',");
     }
     if (model.CustLevel != null)
     {
         strSql1.Append("CustLevel,");
         strSql2.Append("'" + model.CustLevel + "',");
     }
     if (model.CustCWS != null)
     {
         strSql1.Append("CustCWS,");
         strSql2.Append("" + model.CustCWS + ",");
     }
     if (model.Remark != null)
     {
         strSql1.Append("Remark,");
         strSql2.Append("'" + model.Remark + "',");
     }
     if (model.eg1 != null)
     {
         strSql1.Append("eg1,");
         strSql2.Append("" + model.eg1 + ",");
     }
     if (model.eg2 != null)
     {
         strSql1.Append("eg2,");
         strSql2.Append("" + model.eg2 + ",");
     }
     if (model.eg3 != null)
     {
         strSql1.Append("eg3,");
         strSql2.Append("'" + model.eg3 + "',");
     }
     if (model.eg4 != null)
     {
         strSql1.Append("eg4,");
         strSql2.Append("'" + model.eg4 + "',");
     }
     if (model.eg5 != null)
     {
         strSql1.Append("eg5,");
         strSql2.Append("'" + model.eg5 + "',");
     }
     strSql.Append("insert into [Order](");
     strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
     strSql.Append(")");
     strSql.Append(" values (");
     strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
     strSql.Append(")");
     //strSql.Append(";select @@IDENTITY");
     object obj = DbHelperSQL.GetSingle(strSql.ToString());
     if (obj == null)
     {
         return 0;
     }
     else
     {
         return Convert.ToInt32(obj);
     }
 }
 public void DeleteValidTest()
 {
     //create a new data entity
     DataEntity entity = new DataEntity();
     //create a new operation input with a new entity array for the input property
     OperationInput operationInput = new OperationInput {Input = new DataEntity[1]};
     //set the first item in the input property
     operationInput.Input[0] = entity;
     //set the name of the operation
     operationInput.Name = "Delete";
     //create the comparison experssion for selecting the records to delete
     ComparisonExpression comparisonExpression = new ComparisonExpression();
     comparisonExpression.ExpressionType = ExpressionType.Comparison;
     comparisonExpression.Operator = ComparisonOperator.Less;
     comparisonExpression.LeftValue = new ComparisonValue { ValueType = ComparisonValueType.Constant, Value = "ModifiedOn" };
     comparisonExpression.RightValue = new ComparisonValue { ValueType = ComparisonValueType.Variable, Value = DateTime.Now };
     operationInput.LookupCondition[0] = comparisonExpression;
     //execute the operation from the connector
     OperationResult operationResult = _rsSourceConnector.ExecuteOperation(operationInput);
     //validate that the operation was a success
     Assert.IsTrue(operationResult.Success[0]);
 }
        /// <summary>
        /// Retrieves the number of rows based on the entity and lookup condition provided.
        /// This method will also throw an ArgumentException if multiple rows are found in the datasource
        /// based on the lookup condition when the allowMultiples flag was not set.
        /// </summary>
        /// <param name="dataEntity">Data entity used to retrieve the row count.</param>
        /// <param name="lookupCondition">LookupCondition that is equivlent to a sql 'where' clause.</param>
        /// <param name="allowMultiples">Flag that identifies if multple rows may be effected by a single query.</param>
        /// <returns></returns>
        private void ValidateRowCount(DataEntity dataEntity, Expression lookupCondition, bool allowMultiples)
        {
            //create the select count (*) query
            var selectQuery = new SqlQueryBuilder(dataEntity, lookupCondition, Globals.QueryType.Count);

            //execute the the count query
            var queryResults = _dataAccess.Execute(selectQuery.ToString());

            //retrieve the row count from the query
            var rowCount = Convert.ToInt32(queryResults.Rows[0][0]);

            //validate whether or not more than one row will be effected
            if (allowMultiples == false && rowCount > 1)
            {
                throw new ArgumentOutOfRangeException("allowMultiples", string.Format(ErrorCodes.TooManyRowsReturned.Description, rowCount));
            }
        }
Exemple #46
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(DataEntity.Model.ModelList model)
 {
     return dal.Update(model);
 }
Exemple #47
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(DataEntity.Model.Order model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("update [Order] set ");
     if (model.CustID != null)
     {
         strSql.Append("CustID=" + model.CustID + ",");
     }
     else
     {
         strSql.Append("CustID= null ,");
     }
     if (model.ContractID != null)
     {
         strSql.Append("ContractID=" + model.ContractID + ",");
     }
     else
     {
         strSql.Append("ContractID= null ,");
     }
     if (model.CustName != null)
     {
         strSql.Append("CustName='" + model.CustName + "',");
     }
     else
     {
         strSql.Append("CustName= null ,");
     }
     if (model.ContractName != null)
     {
         strSql.Append("ContractName='" + model.ContractName + "',");
     }
     else
     {
         strSql.Append("ContractName= null ,");
     }
     if (model.WHF != null)
     {
         strSql.Append("WHF=" + model.WHF + ",");
     }
     else
     {
         strSql.Append("WHF= null ,");
     }
     if (model.WHNX != null)
     {
         strSql.Append("WHNX=" + model.WHNX + ",");
     }
     else
     {
         strSql.Append("WHNX= null ,");
     }
     if (model.OrderDate != null)
     {
         strSql.Append("OrderDate='" + model.OrderDate + "',");
     }
     else
     {
         strSql.Append("OrderDate= null ,");
     }
     if (model.State != null)
     {
         strSql.Append("State='" + model.State + "',");
     }
     else
     {
         strSql.Append("State= null ,");
     }
     if (model.CustGM != null)
     {
         strSql.Append("CustGM='" + model.CustGM + "',");
     }
     else
     {
         strSql.Append("CustGM= null ,");
     }
     if (model.CustLevel != null)
     {
         strSql.Append("CustLevel='" + model.CustLevel + "',");
     }
     else
     {
         strSql.Append("CustLevel= null ,");
     }
     if (model.CustCWS != null)
     {
         strSql.Append("CustCWS=" + model.CustCWS + ",");
     }
     else
     {
         strSql.Append("CustCWS= null ,");
     }
     if (model.Remark != null)
     {
         strSql.Append("Remark='" + model.Remark + "',");
     }
     else
     {
         strSql.Append("Remark= null ,");
     }
     if (model.eg1 != null)
     {
         strSql.Append("eg1=" + model.eg1 + ",");
     }
     else
     {
         strSql.Append("eg1= null ,");
     }
     if (model.eg2 != null)
     {
         strSql.Append("eg2=" + model.eg2 + ",");
     }
     else
     {
         strSql.Append("eg2= null ,");
     }
     if (model.eg3 != null)
     {
         strSql.Append("eg3='" + model.eg3 + "',");
     }
     else
     {
         strSql.Append("eg3= null ,");
     }
     if (model.eg4 != null)
     {
         strSql.Append("eg4='" + model.eg4 + "',");
     }
     else
     {
         strSql.Append("eg4= null ,");
     }
     if (model.eg5 != null)
     {
         strSql.Append("eg5='" + model.eg5 + "',");
     }
     else
     {
         strSql.Append("eg5= null ,");
     }
     int n = strSql.ToString().LastIndexOf(",");
     strSql.Remove(n, 1);
     strSql.Append(" where ID=" + model.ID + "");
     int rowsAffected = DbHelperSQL.ExecuteSql(strSql.ToString());
     if (rowsAffected > 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Exemple #48
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(DataEntity.Model.OrderDetail model)
 {
     return dal.Update(model);
 }
        private void Parse(DataEntity input, EntityProperties filterColumns, Globals.QueryType queryType)
        {
            var query = new StringBuilder();

            if (queryType == Globals.QueryType.Upsert)
            {
                var whereClause = ParseWhereClause(filterColumns);
                query.AppendFormat("{0} {3} ({1}{2})", IfKeyword, ParseQueryType(input, Globals.QueryType.Select), whereClause, ExistsKeyword);
                query.AppendFormat("{0}{1}{0}{5}{6}{0}{3}{0}{4}{0}{1}{0}{2}{0}{3}", Environment.NewLine, BeginKeyword,
                    ParseQueryType(input, Globals.QueryType.Insert),
                    EndKeyword, ElseKeyword, ParseQueryType(input, Globals.QueryType.Update), whereClause);
            }
            else
            {
                query.Append(ParseQueryType(input, queryType));
                query.Append(ParseWhereClause(filterColumns));
            }

            _query = query.ToString();
        }
        /// <summary>
        /// Creates a test OperationInput
        /// </summary>
        /// <returns></returns>
        private OperationInput BuildOperationInput()
        {
            var inputs = new DataEntity[2];
            inputs[0] = new DataEntity
            {
                ObjectDefinitionFullName = "Registrant",
                Properties = new Core.ConnectorApi.Query.EntityProperties()
            };

            inputs[1] = new DataEntity
            {
                ObjectDefinitionFullName = "Registrant",
                Properties = new Core.ConnectorApi.Query.EntityProperties()
            };

            inputs[0].Properties.Add("Email", "*****@*****.**");
            inputs[0].Properties.Add("FirstName", "Bob");
            inputs[0].Properties.Add("LastName", "Roberts");
            inputs[0].Properties.Add("WebinarKey", "1235813");

            inputs[1].Properties.Add("Email", "*****@*****.**");
            inputs[1].Properties.Add("FirstName", "Joe");
            inputs[1].Properties.Add("LastName", "Josephs");
            inputs[1].Properties.Add("WebinarKey", "1235813");

            var operation = new OperationInput
            {
                Name = "Create",
                Input = inputs
            };

            return operation;
        }
Exemple #51
0
        public OperationResult ExecuteOperation(OperationInput input)
        {
            this.product = "2700,2701,2702,2703,2704,2705,2706,2707,2708,2709,2734";
            this.package = "pkgBorgCheck,pkgBorgVerify,pkgBorgMoveUpdate,pkgBorgGeoPoint,pkgBorgAppend,pkgBorgAppend,pkgBorgAppend,pkgBorgAppend,pkgBorgGeoCode,pkgIntAddressCheck,pkgIntGeoCode";

            if (this.system.Contains("credit"))
            {
                this.serviceUri = new Uri(CheckInputSizeRequest(licensekey));
                HttpWebRequest mykHttpWebRequest = null;
                HttpWebResponse mykHttpWebResponse = null;
                XmlDocument mykXMLDocument = null;
                XmlTextReader mykXMLReader = null;
                mykHttpWebRequest = WebRequest.Create(serviceUri) as HttpWebRequest;
                mykHttpWebRequest.Timeout = 60000;
                mykHttpWebRequest.ReadWriteTimeout = 60000;
                mykHttpWebRequest.Method = "GET";
                mykHttpWebRequest.ContentType = "application/xml; charset=utf-8";
                mykHttpWebRequest.Accept = "application/xml";

                bool calloutSuccess = false;
                while (!calloutSuccess)
                {
                    try
                    {
                        mykHttpWebResponse = (HttpWebResponse)mykHttpWebRequest.GetResponse();
                        calloutSuccess = true;
                    }
                    catch (WebException e)
                    {
                        calloutSuccess = false;
                    }
                }

                mykXMLDocument = new XmlDocument();
                mykXMLReader = new XmlTextReader(mykHttpWebResponse.GetResponseStream());
                mykXMLDocument.Load(mykXMLReader);
                XmlNode krequestNode = mykXMLDocument.DocumentElement.ChildNodes[2];
                int creditbalance;

                try
                {
                    if (input.Input[0].ObjectDefinitionFullName.Contains("Personator"))
                    {
                        this.row++;
                        this.counter++;
                        creditbalance = int.Parse(krequestNode.InnerText);
                    }
                    else
                    {
                        this.row++;
                        this.counter = this.counter + 20;
                        creditbalance = int.Parse(krequestNode.InnerText);
                    }
                }
                catch
                {
                    Logger.Write(Logger.Severity.Info, "Data Results", "Empty List");
                    Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException.ReferenceEquals("Data Results", "Empty List").ToString();
                    throw new System.ArgumentException("Data Results", "Empty List");
                }

                if (creditbalance > this.counter)
                {
                    this.IsConnected = true;
                    Logger.Write(Logger.Severity.Info, "Credit Check Good", "Successful! Credit Balance: " + creditbalance + "On row: " + this.row);
                }
                else
                {
                    if (this.geo > 0)
                    {
                        chargeGEO();
                    }
                    if (this.IntGeo > 0)
                    {
                        chargeIntGeo();
                    }
                    if (this.IntCheck > 0)
                    {
                        chargeIntCheck();
                    }
                    if (this.check > 0)
                    {
                        chargeCheck();
                    }
                    if (this.move > 0)
                    {
                        chargeMove();
                    }
                    if (this.verify > 0)
                    {
                        chargeVerify();
                    }
                    if (this.GeoBasic > 0)
                    {
                        chargeGeoCodeBasic();
                    }
                    if ((this.appendaddress > 0) || (this.appendphone > 0) || (this.appendemail > 0) || (this.appendname > 0))
                    {
                        chargeAppend();
                    }

                    Logger.Write(Logger.Severity.Info, "Process Exception", " Not enough Credits for row: " + this.row + " Estimated Balance: " + (creditbalance - this.counter) + ", Please purchase more credits at http://www.melissadata.com/dqt/credits.htm");
                    this.IsConnected = false;
                    throw new Scribe.Core.ConnectorApi.Exceptions.FatalErrorException("Processing Exception: Not enough Credits for row: " + this.row + " Estimated Balance: " + (creditbalance - this.counter) + ", Please purchase more credits at http://www.melissadata.com/dqt/credits.htm");
                }
            }

            ErrorResult[] ErrorResultArray = new ErrorResult[input.Input.Length];
            int[] ObjectsAffectedArray = new int[input.Input.Length];
            bool[] SuccessArray = new bool[input.Input.Length];
            var outputEntityArray = new DataEntity[input.Input.Length];

            if (input.Input[0].ObjectDefinitionFullName.Contains("Personator") || input.Input[0].ObjectDefinitionFullName.Contains("BulkPersonator"))
            {
                System.ServiceModel.BasicHttpBinding myBinding = new System.ServiceModel.BasicHttpBinding();
                myBinding.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.Transport;
                myBinding.MaxReceivedMessageSize = 900000000;
                System.ServiceModel.EndpointAddress myEndpointAddress = new System.ServiceModel.EndpointAddress("https://personator.melissadata.net/v3/SOAP/ContactVerify");
                SOAP.ServicemdContactVerifySOAPClient client = new SOAP.ServicemdContactVerifySOAPClient(myBinding, myEndpointAddress);
                SOAP.Request request = new SOAP.Request();
                request.CustomerID = licensekey;
                int numLoops = 0;
                if ((input.Input.Length % 100) == 0)
                {
                    numLoops = (int)(input.Input.Length / 100);
                }
                else
                {
                    numLoops = (int)(input.Input.Length / 100) + 1;
                }

                for (int i = 0; i < numLoops; i++)
                {
                    DataEntity data = null;
                    int floorDiv = (int)(input.Input.Length / 100);
                    int innerCount = 0;
                    request.Records = new SOAP.RequestRecord[((i < floorDiv) ? 100 : input.Input.Length % 100)];

                    for (int j = 0; j < ((i < floorDiv) ? 100 : input.Input.Length % 100); j++)
                    {
                        request.Records[j] = new SOAP.RequestRecord();
                        data = input.Input[innerCount];

                        if (data.Properties.ContainsKey("Input_RecordID"))
                        {
                            if (data.Properties["Input_RecordID"] == null)
                            {
                                request.Records[j].RecordID = "";
                            }
                            else
                            {
                                request.Records[j].RecordID = data.Properties["Input_RecordID"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_City"))
                        {
                            if (data.Properties["Input_City"] == null)
                            {
                                request.Records[j].City = "";
                            }
                            else
                            {
                                request.Records[j].City = data.Properties["Input_City"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_State"))
                        {
                            if (data.Properties["Input_State"] == null)
                            {
                                request.Records[j].State = "";
                            }
                            else
                            {
                                request.Records[j].State = data.Properties["Input_State"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_PostalCode"))
                        {
                            if (data.Properties["Input_PostalCode"] == null)
                            {
                                request.Records[j].PostalCode = "";
                            }
                            else
                            {
                                request.Records[j].PostalCode = data.Properties["Input_PostalCode"].ToString();
                            }
                        }

                        if ((data.Properties.ContainsKey("Setting_Columns")))
                        {
                            string Columns = data.Properties["Setting_Columns"].ToString();
                            string[] cols;
                            char[] charcolSeparators = new char[] { ',' };
                            cols = Columns.Split(charcolSeparators, 8, StringSplitOptions.RemoveEmptyEntries);
                            for (int c = 0; c < cols.Length; c++)
                            {
                                if ((data.Properties.ContainsKey("Setting_Columns")) && !cols[c].ToString().Trim().ToLower().Equals("grpaddressdetails") && (!cols[c].ToString().Trim().ToLower().Equals("grpcensus")) && (!cols[c].ToString().Trim().ToLower().Equals("grpgeocode")) && (!cols[c].ToString().Trim().ToLower().Equals("grpnamedetails")) && (!cols[c].ToString().Trim().ToLower().Equals("grpparsedaddress")) && (!cols[c].ToString().Trim().ToLower().Equals("grpparsedemail")) && (!cols[c].ToString().Trim().ToLower().Equals("grpparsedphone")) && (!cols[c].ToString().Trim().ToLower().Equals("grpall")) && (!cols[c].ToString().Trim().ToLower().Equals("grpdemographicbasic")))
                                {
                                    throw new Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException("Invalid Action, action must be either ({blank}, GrpAddressDetails, GrpCensus, GrpGeocode, GrpNameDetails, GrpParsedAddress, GrpParsedEmail, GrpParsedPhone, GrpAll");
                                }
                                else
                                {
                                    request.Columns = (!data.Properties.ContainsKey("Setting_Columns") ? "" : data.Properties["Setting_Columns"].ToString());
                                }
                            }
                        }

                        if (data.Properties.ContainsKey("Setting_Actions"))
                        {
                            if (data.Properties["Setting_Actions"] == null)
                            {
                                request.Actions = "check";
                            }
                            else
                            {
                                request.Actions = data.Properties["Setting_Actions"].ToString();
                            }
                        }
                        else
                        {
                            request.Actions = "check";
                        }

                        if ((data.Properties.ContainsKey("Setting_Actions")))
                        {
                            string Actions = data.Properties["Setting_Actions"].ToString();
                            string[] act;
                            char[] charSeparators = new char[] { ',' };
                            act = Actions.Split(charSeparators, 4, StringSplitOptions.RemoveEmptyEntries);
                            for (int k = 0; k < act.Length; k++)
                            {
                                if ((data.Properties.ContainsKey("Setting_Actions")) && !act[k].ToString().Trim().ToLower().Equals("append") && (!act[k].ToString().Trim().ToLower().Equals("check")) && (!act[k].ToString().Trim().ToLower().Equals("verify")) && (!act[k].ToString().Trim().ToLower().Equals("move")))
                                {
                                    throw new Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException("Invalid Action, action must be either (Check, Verify, Append, Move");
                                }
                                else
                                {
                                    request.Actions = (!data.Properties.ContainsKey("Setting_Actions") ? "Check" : data.Properties["Setting_Actions"].ToString());
                                }
                            }
                        }

                        if ((data.Properties.ContainsKey("Setting_AdvancedAddressCorrection")) && (!data.Properties["Setting_AdvancedAddressCorrection"].ToString().Trim().ToLower().Equals("on") && (!data.Properties["Setting_AdvancedAddressCorrection"].ToString().Trim().ToLower().Equals("off"))))
                        {
                            throw new Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException("Invalid AdvancedAddressCorrection Property, action must be either (on, off");
                        }
                        else
                        {
                            request.Options = request.Options + "AdvancedAddressCorrection:" + (!data.Properties.ContainsKey("Setting_AdvancedAddressCorrection") ? "off;" : data.Properties["Setting_AdvancedAddressCorrection"].ToString() + ";");
                        }

                        if ((data.Properties.ContainsKey("Setting_CentricHint")) && (!data.Properties["Setting_CentricHint"].ToString().Trim().ToLower().Equals("auto")) && (!data.Properties["Setting_CentricHint"].ToString().Trim().ToLower().Equals("address")) && (!data.Properties["Setting_CentricHint"].ToString().Trim().ToLower().Equals("phone")) && (!data.Properties["Setting_CentricHint"].ToString().Trim().ToLower().Equals("email")))
                        {
                            throw new Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException("Invalid CentricHint Property, action must be either (auto, address, phone, email");
                        }
                        else
                        {
                            request.Options = request.Options + "CentricHint:" + (!data.Properties.ContainsKey("Setting_CentricHint") ? "off;" : data.Properties["Setting_CentricHint"].ToString() + ";");
                        }
                        if ((data.Properties.ContainsKey("Setting_Append")) && (!data.Properties["Setting_Append"].ToString().Trim().ToLower().Equals("blank")) && (!data.Properties["Setting_Append"].ToString().Trim().ToLower().Equals("checkerror")) && (!data.Properties["Setting_Append"].ToString().Trim().ToLower().Equals("always")))
                        {
                            throw new Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException("Invalid Append Property, action must be either (checkerror, blank, always");
                        }
                        else
                        {
                            request.Options = request.Options + "Append:" + (!data.Properties.ContainsKey("Setting_Append") ? "Always;" : data.Properties["Setting_Append"].ToString() + ";");
                        }

                        if ((data.Properties.ContainsKey("Setting_UsePreferredCity")) && (!data.Properties["Setting_UsePreferredCity"].ToString().Trim().ToLower().Equals("on")) && (!data.Properties["Setting_UsePreferredCity"].ToString().Trim().ToLower().Equals("off")))
                        {
                            throw new Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException("Invalid Append Property, action must be either (off, on)");
                        }
                        else
                        {
                            request.Options = request.Options + "UsePreferredCity:" + (!data.Properties.ContainsKey("Setting_UsePreferredCity") ? "off;" : data.Properties["Setting_UsePreferredCity"].ToString() + ";");
                        }

                        if (data.Properties.ContainsKey("Input_AddressLine2"))
                        {
                            if (data.Properties["Input_AddressLine2"] == null)
                            {
                                request.Records[j].AddressLine2 = "";
                            }
                            else
                            {
                                request.Records[j].AddressLine2 = data.Properties["Input_AddressLine2"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_Country"))
                        {
                            if (data.Properties["Input_Country"] == null)
                            {
                                request.Records[j].Country = "";
                            }
                            else
                            {
                                request.Records[j].Country = data.Properties["Input_Country"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_CompanyName"))
                        {
                            if (data.Properties["Input_CompanyName"] == null)
                            {
                                request.Records[j].CompanyName = "";
                            }
                            else
                            {
                                request.Records[j].CompanyName = data.Properties["Input_CompanyName"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_FullName"))
                        {
                            if (data.Properties["Input_FullName"] == null)
                            {
                                request.Records[j].FullName = "";
                            }
                            else
                            {
                                request.Records[j].FullName = data.Properties["Input_FullName"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_LastName"))
                        {
                            if (data.Properties["Input_LastName"] == null)
                            {
                                request.Records[j].LastName = "";
                            }
                            else
                            {
                                request.Records[j].LastName = data.Properties["Input_LastName"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_PhoneNumber"))
                        {
                            if (data.Properties["Input_PhoneNumber"] == null)
                            {
                                request.Records[j].PhoneNumber = "";
                            }
                            else
                            {
                                request.Records[j].PhoneNumber = data.Properties["Input_PhoneNumber"].ToString();
                            }
                        }

                        if (data.Properties.ContainsKey("Input_AddressLine1"))
                        {
                            if (data.Properties["Input_AddressLine1"] == null)
                            {
                                request.Records[j].AddressLine1 = "";
                            }
                            else
                            {
                                request.Records[j].City = request.Records[j].City != null ? request.Records[j].City.Trim() : "";
                                request.Records[j].State = request.Records[j].State != null ? request.Records[j].State.Trim() : "";
                                request.Records[j].PostalCode = request.Records[j].PostalCode != null ? request.Records[j].PostalCode.Trim() : "";
                                request.Records[j].FreeForm = request.Records[j].FreeForm != null ? request.Records[j].FreeForm.Trim() : "";

                                if (request.Records[j].City == "" && request.Records[j].State == "" && request.Records[j].PostalCode == "" && request.Records[j].FreeForm == "")
                                {
                                    request.Records[j].AddressLine1 = "";
                                    request.Records[j].FreeForm = data.Properties["Input_AddressLine1"].ToString();
                                }
                                else
                                {
                                    request.Records[j].AddressLine1 = data.Properties["Input_AddressLine1"].ToString();
                                }
                            }
                        }

                        if (data.Properties.ContainsKey("Input_FreeForm"))
                        {
                            if (data.Properties["Input_FreeForm"] == null)
                            {
                                request.Records[j].FreeForm = "";
                            }
                            else
                            {
                                request.Records[j].AddressLine1 = "";
                                request.Records[j].FreeForm = data.Properties["Input_FreeForm"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_EmailAddress"))
                        {
                            if (data.Properties["Input_EmailAddress"] == null)
                            {
                                request.Records[j].EmailAddress = "";
                            }
                            else
                            {
                                request.Records[j].EmailAddress = data.Properties["Input_EmailAddress"].ToString();
                            }
                        }

                        if (data.Properties.ContainsKey("Setting_Columns"))
                        {
                            if (data.Properties["Setting_Columns"] == null)
                            {
                                request.Columns = "";
                            }
                            else
                            {
                                request.Columns = data.Properties["Setting_Columns"].ToString();
                            }
                        }

                        if (request.Records[j].PostalCode == "" && request.Records[j].State == "" && request.Records[j].City == "" && request.Records[j].FreeForm == "")
                        {
                            throw new Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException("City, State or Zipcode or Freeform required.");
                        }

                        innerCount++;
                    }

                    this.serviceUri = new Uri(RequestToken(licensekey, this.product, this.package, ((i < floorDiv) ? 100 : input.Input.Length % 100).ToString()));
                    HttpWebRequest myeHttpWebRequest = null;
                    HttpWebResponse myeHttpWebResponse = null;
                    XmlDocument myXMLDocument = null;
                    XmlTextReader myXMLReader = null;
                    myeHttpWebRequest = WebRequest.Create(serviceUri) as HttpWebRequest;
                    myeHttpWebRequest.Timeout = 60000;
                    myeHttpWebRequest.ReadWriteTimeout = 60000;
                    myeHttpWebRequest.Method = "GET";
                    myeHttpWebRequest.ContentType = "application/xml; charset=utf-8";
                    myeHttpWebRequest.Accept = "application/xml";

                    bool success = false;
                    while (!success)
                    {
                        try
                        {
                            myeHttpWebResponse = (HttpWebResponse)myeHttpWebRequest.GetResponse();
                            success = true;
                        }
                        catch (WebException e)
                        {
                            success = false;
                        }
                    }

                    myXMLDocument = new XmlDocument();

                    myXMLReader = new XmlTextReader(myeHttpWebResponse.GetResponseStream());
                    myXMLDocument.Load(myXMLReader);
                    XmlNode resultNode = myXMLDocument.DocumentElement.ChildNodes[0];
                    XmlNode tokenNode = myXMLDocument.DocumentElement.ChildNodes[1];
                    if (resultNode.InnerText.Contains("TS01") || resultNode.InnerText.Contains("TS02"))
                    {
                        request.CustomerID = tokenNode.InnerText;
                        Logger.Write(Logger.Severity.Info, "Connection Results", "Token Successful");
                    }
                    else
                    {
                        Logger.Write(Logger.Severity.Info, "Connection Results", "Token Successful");
                    }
                    SOAP.Response response = null;

                    while (response == null)
                    {
                        try
                        {
                            response = client.doContactVerify(request);
                        }
                        catch (Exception e)
                        {
                        }
                    }
                    for (int l = 0; l < response.Records.Length; l++)
                    {
                        List<PropertyInfo> responseProperties = response.Records[l].GetType().GetProperties().ToList();

                        var output = new DataEntity(input.Input[100 * i + l].ObjectDefinitionFullName);
                        if ((response.Records[l].Results.Contains("AS")))
                        {
                            this.check++;
                        }
                        if (response.Records[l].Results.Contains("GS05") || response.Records[l].Results.Contains("GS06"))
                        {
                            this.geo++;
                        }
                        if (response.Records[l].Results.Contains("GS01"))
                        {
                            this.GeoBasic++;
                        }
                        if (response.Records[l].Results.Contains("VR"))
                        {
                            this.verify++;
                        }
                        if (response.Records[l].Results.Contains("AS12"))
                        {
                            this.move++;
                        }
                        if (response.Records[l].Results.Contains("DA10"))
                        {
                            this.appendname++;
                        }
                        if (response.Records[l].Results.Contains("DA00"))
                        {
                            this.appendaddress++;
                        }
                        if (response.Records[l].Results.Contains("DA30"))
                        {
                            this.appendphone++;
                        }
                        if (response.Records[l].Results.Contains("DA40"))
                        {
                            this.appendemail++;
                        }
                        foreach (PropertyInfo property in responseProperties)
                        {
                            string getValue = property.GetValue(response.Records[l], null) != null ? property.GetValue(response.Records[l], null).ToString() : "";

                            output.Properties["MD_" + property.Name] = getValue;
                        }

                        outputEntityArray[i * 100 + l] = output;
                    }
                }

                ErrorResultArray = new ErrorResult[input.Input.Length];
                ObjectsAffectedArray = new int[input.Input.Length];
                SuccessArray = new bool[input.Input.Length];

                for (int x = 0; x < input.Input.Length; x++)
                {
                    ErrorResultArray[x] = new ErrorResult();
                    ObjectsAffectedArray[x] = 1;
                    SuccessArray[x] = true;
                }
            }

            if (input.Input[0].ObjectDefinitionFullName.Contains("Global_Address_Verification") || input.Input[0].ObjectDefinitionFullName.Contains("BulkGlobal"))
            {
                System.ServiceModel.BasicHttpBinding myBinding = new System.ServiceModel.BasicHttpBinding();
                myBinding.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.Transport;
                myBinding.MaxReceivedMessageSize = 900000000;
                System.ServiceModel.EndpointAddress myEndpointAddress = new System.ServiceModel.EndpointAddress("https://address.melissadata.net/v3/SOAP/GlobalAddress");
                SOAP3.AddressCheckSoapClient client = new SOAP3.AddressCheckSoapClient(myBinding, myEndpointAddress);
                SOAP3.Request request = new SOAP3.Request();
                request.CustomerID = licensekey;
                int numLoops = 0;
                if ((input.Input.Length % 100) == 0)
                {
                    numLoops = (int)(input.Input.Length / 100);
                }
                else
                {
                    numLoops = (int)(input.Input.Length / 100) + 1;
                }

                for (int i = 0; i < numLoops; i++)
                {
                    DataEntity data = null;
                    int floorDiv = (int)(input.Input.Length / 100);
                    int innerCount = 0;
                    request.Records = new SOAP3.RequestRecord[((i < floorDiv) ? 100 : input.Input.Length % 100)];
                    for (int j = 0; j < ((i < floorDiv) ? 100 : input.Input.Length % 100); j++)
                    {
                        request.Records[j] = new SOAP3.RequestRecord();
                        data = input.Input[innerCount];

                        if (data.Properties.ContainsKey("Input_RecordID"))
                        {
                            if (data.Properties["Input_RecordID"] == null)
                            {
                                request.Records[j].RecordID = "";
                            }
                            else
                            {
                                request.Records[j].RecordID = data.Properties["Input_RecordID"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_Organization"))
                        {
                            if (data.Properties["Input_Organization"] == null)
                            {
                                request.Records[j].Organization = "";
                            }
                            else
                            {
                                request.Records[j].Organization = data.Properties["Input_Organization"].ToString();
                            }
                        }

                        if (data.Properties.ContainsKey("Input_AddressLine1"))
                        {
                            if (data.Properties["Input_AddressLine1"] == null)
                            {
                                request.Records[j].AddressLine1 = "";
                            }
                            else
                            {
                                request.Records[j].AddressLine1 = data.Properties["Input_AddressLine1"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_AddressLine2"))
                        {
                            if (data.Properties["Input_AddressLine2"] == null)
                            {
                                request.Records[j].AddressLine2 = "";
                            }
                            else
                            {
                                request.Records[j].AddressLine2 = data.Properties["Input_AddressLine2"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_AddressLine3"))
                        {
                            if (data.Properties["Input_AddressLine3"] == null)
                            {
                                request.Records[j].AddressLine3 = "";
                            }
                            else
                            {
                                request.Records[j].AddressLine3 = data.Properties["Input_AddressLine3"].ToString();
                            }
                        }

                        if (data.Properties.ContainsKey("Input_AddressLine4"))
                        {
                            if (data.Properties["Input_AddressLine4"] == null)
                            {
                                request.Records[j].AddressLine4 = "";
                            }
                            else
                            {
                                request.Records[j].AddressLine4 = data.Properties["Input_AddressLine4"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_AddressLine5"))
                        {
                            if (data.Properties["Input_AddressLine5"] == null)
                            {
                                request.Records[j].AddressLine5 = "";
                            }
                            else
                            {
                                request.Records[j].AddressLine5 = data.Properties["Input_AddressLine5"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_AddressLine6"))
                        {
                            if (data.Properties["Input_AddressLine6"] == null)
                            {
                                request.Records[j].AddressLine6 = "";
                            }
                            else
                            {
                                request.Records[j].AddressLine6 = data.Properties["Input_AddressLine6"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_AddressLine7"))
                        {
                            if (data.Properties["Input_AddressLine7"] == null)
                            {
                                request.Records[j].AddressLine7 = "";
                            }
                            else
                            {
                                request.Records[j].AddressLine7 = data.Properties["Input_AddressLine7"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_AddressLine8"))
                        {
                            if (data.Properties["Input_AddressLine8"] == null)
                            {
                                request.Records[j].AddressLine8 = "";
                            }
                            else
                            {
                                request.Records[j].AddressLine8 = data.Properties["Input_AddressLine8"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_DoubleDependentLocality"))
                        {
                            if (data.Properties["Input_DoubleDependentLocality"] == null)
                            {
                                request.Records[j].DoubleDependentLocality = "";
                            }
                            else
                            {
                                request.Records[j].DoubleDependentLocality = data.Properties["Input_DoubleDependentLocality"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_DependentLocality"))
                        {
                            if (data.Properties["Input_DependentLocality"] == null)
                            {
                                request.Records[j].DependentLocality = "";
                            }
                            else
                            {
                                request.Records[j].DependentLocality = data.Properties["Input_DependentLocality"].ToString();
                            }
                        }

                        if (data.Properties.ContainsKey("Input_Locality"))
                        {
                            if (data.Properties["Input_Locality"] == null)
                            {
                                request.Records[j].Locality = "";
                            }
                            else
                            {
                                request.Records[j].Locality = data.Properties["Input_Locality"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_SubAdministrativeArea"))
                        {
                            if (data.Properties["Input_SubAdministrativeArea"] == null)
                            {
                                request.Records[j].SubAdministrativeArea = "";
                            }
                            else
                            {
                                request.Records[j].SubAdministrativeArea = data.Properties["Input_SubAdministrativeArea"].ToString();
                            }
                        }

                        if (data.Properties.ContainsKey("Input_AdministrativeArea"))
                        {
                            if (data.Properties["Input_AdministrativeArea"] == null)
                            {
                                request.Records[j].AdministrativeArea = "";
                            }
                            else
                            {
                                request.Records[j].AdministrativeArea = data.Properties["Input_AdministrativeArea"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_PostalCode"))
                        {
                            if (data.Properties["Input_PostalCode"] == null)
                            {
                                request.Records[j].PostalCode = "";
                            }
                            else
                            {
                                request.Records[j].PostalCode = data.Properties["Input_PostalCode"].ToString();
                            }
                        }
                        if (data.Properties.ContainsKey("Input_SubNationalArea"))
                        {
                            if (data.Properties["Input_SubNationalArea"] == null)
                            {
                                request.Records[j].SubNationalArea = "";
                            }
                            else
                            {
                                request.Records[j].SubNationalArea = data.Properties["Input_SubNationalArea"].ToString();
                            }
                        }

                        if (data.Properties.ContainsKey("Input_Country"))
                        {
                            if (data.Properties["Input_Country"] == null)
                            {
                                request.Records[j].Country = "";
                            }
                            else
                            {
                                request.Records[j].Country = data.Properties["Input_Country"].ToString();
                            }
                        }

                        if (data.Properties.ContainsKey("Setting_DeliveryLines"))
                        {
                            if (data.Properties["Setting_DeliveryLines"] == null)
                            {
                                request.Records[j].Country = "";
                            }
                            else
                            {
                                request.Records[j].Country = data.Properties["Setting_DeliveryLines"].ToString();
                            }
                        }

                        if ((data.Properties.ContainsKey("Setting_DeliveryLines")) && (!data.Properties["Setting_DeliveryLines"].ToString().Trim().ToLower().Equals("on") && (!data.Properties["Setting_DeliveryLines"].ToString().Trim().ToLower().Equals("off"))))
                        {
                            throw new Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException("Invalid DeliveryLines Property, action must be either (on, off");
                        }
                        else
                        {
                            request.Options = request.Options + "DeliveryLines:" + (!data.Properties.ContainsKey("Setting_DeliveryLines") ? "off;" : data.Properties["Setting_DeliveryLines"].ToString() + ";");
                        }

                        if ((data.Properties.ContainsKey("Setting_LineSeparator")) && (!data.Properties["Setting_LineSeparator"].ToString().Trim().ToLower().Equals("semicolon") && (!data.Properties["Setting_DeliveryLines"].ToString().Trim().ToLower().Equals("pipe") && (!data.Properties["Setting_LineSeparator"].ToString().Trim().ToLower().Equals("cr") && (!data.Properties["Setting_LineSeparator"].ToString().Trim().ToLower().Equals("lf") && (!data.Properties["Setting_LineSeparator"].ToString().Trim().ToLower().Equals("crlf") && (!data.Properties["Setting_LineSeparator"].ToString().Trim().ToLower().Equals("tab") && (!data.Properties["Setting_LineSeparator"].ToString().Trim().ToLower().Equals("br")))))))))
                        {
                            throw new Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException("Invalid LineSeparator Property, action must be either (semicolon (default), pipe, cr, lf, crlf, tab, br (line break)");
                        }
                        else
                        {
                            request.Options = request.Options + "LineSeparator:" + (!data.Properties.ContainsKey("LineSeparator") ? "SEMICOLON;" : data.Properties["Setting_DeliveryLines"].ToString() + ";");
                        }

                        if ((data.Properties.ContainsKey("Setting_OutputScript")) && (!data.Properties["Setting_OutputScript"].ToString().Trim().ToLower().Equals("nochange") && (!data.Properties["Setting_OutputScript"].ToString().Trim().ToLower().Equals("latn")) && (!data.Properties["Setting_OutputScript"].ToString().Trim().ToLower().Equals("native"))))
                        {
                            throw new Scribe.Core.ConnectorApi.Exceptions.InvalidExecuteOperationException("Invalid LineSeparator Property, action must be either (nochange (default), latn, native");
                        }
                        else
                        {
                            request.Options = request.Options + "OutputScript:" + (!data.Properties.ContainsKey("Setting_OutputScript") ? "nochange;" : data.Properties["Setting_OutputScript"].ToString() + ";");
                        }

                        if ((data.Properties.ContainsKey("Setting_CountryOfOrigin")))
                        {
                            request.Options = request.Options + "CountryOfOrigin:" + data.Properties["Setting_CountryOfOrigin"].ToString() + ";";
                        }

                        innerCount++;
                    }
                    this.serviceUri = new Uri(RequestToken(licensekey, this.product, this.package, ((i < floorDiv) ? 100 : input.Input.Length % 100).ToString()));

                    HttpWebRequest myeHttpWebRequest = null;
                    HttpWebResponse myeHttpWebResponse = null;
                    XmlDocument myXMLDocument = null;
                    XmlTextReader myXMLReader = null;
                    myeHttpWebRequest = WebRequest.Create(serviceUri) as HttpWebRequest;
                    myeHttpWebRequest.Timeout = 60000;
                    myeHttpWebRequest.ReadWriteTimeout = 60000;
                    myeHttpWebRequest.Method = "GET";
                    myeHttpWebRequest.ContentType = "application/xml; charset=utf-8";
                    myeHttpWebRequest.Accept = "application/xml";

                    bool success = false;
                    while (!success)
                    {
                        try
                        {
                            myeHttpWebResponse = (HttpWebResponse)myeHttpWebRequest.GetResponse();
                            success = true;
                        }
                        catch (WebException e)
                        {
                            success = false;
                        }
                    }

                    myXMLDocument = new XmlDocument();

                    myXMLReader = new XmlTextReader(myeHttpWebResponse.GetResponseStream());
                    myXMLDocument.Load(myXMLReader);
                    XmlNode resultNode = myXMLDocument.DocumentElement.ChildNodes[0];
                    XmlNode tokenNode = myXMLDocument.DocumentElement.ChildNodes[1];
                    if (resultNode.InnerText.Contains("TS01") || resultNode.InnerText.Contains("TS02"))
                    {
                        request.CustomerID = tokenNode.InnerText;
                        Logger.Write(Logger.Severity.Info, "Connection Results", "Token Successful");
                    }

                    SOAP3.Response response = client.doGlobalAddress(request);

                    for (int l = 0; l < response.Records.Length; l++)
                    {
                        List<PropertyInfo> responseProperties = response.Records[l].GetType().GetProperties().ToList();

                        var output = new DataEntity(input.Input[100 * i + l].ObjectDefinitionFullName);

                        if ((response.Records[l].Results.Contains("AV")))
                        {
                            this.IntCheck++;
                        }
                        if (response.Records[l].Results.Contains("GS"))
                        {
                            this.IntGeo++;
                        }

                        foreach (PropertyInfo property in responseProperties)
                        {
                            string getValue = property.GetValue(response.Records[l], null) != null ? property.GetValue(response.Records[l], null).ToString() : "";

                            output.Properties["MD_" + property.Name] = getValue;
                        }

                        outputEntityArray[i * 100 + l] = output;
                    }
                }

                ErrorResultArray = new ErrorResult[input.Input.Length];
                ObjectsAffectedArray = new int[input.Input.Length];
                SuccessArray = new bool[input.Input.Length];

                for (int x = 0; x < input.Input.Length; x++)
                {
                    ErrorResultArray[x] = new ErrorResult();
                    ObjectsAffectedArray[x] = 1;
                    SuccessArray[x] = true;
                }
            }

            foreach (var entity in outputEntityArray)
            {
                bulkQueue.Enqueue(entity);
            }

            return new OperationResult(input.Input.Length)
            {
                ErrorInfo = ErrorResultArray,
                ObjectsAffected = ObjectsAffectedArray,
                Output = outputEntityArray,
                Success = SuccessArray
            };
        }
 public SqlQueryBuilder(DataEntity operationInput, Globals.QueryType queryType)
 {
     Parse(operationInput, new EntityProperties(), queryType);
 }
Exemple #53
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(DataEntity.Model.OrderDetail model)
 {
     return dal.Add(model);
 }
 public SqlQueryBuilder(DataEntity operationInput, EntityProperties filterColumns, Globals.QueryType queryType)
 {
     Parse(operationInput, filterColumns, queryType);
 }
        /// <summary>
        /// Create a list of default columns.
        /// Four default columns are create.
        /// 1: [SCRIBE_ID] This is the new primary key for the table
        /// 2: [SCRIBE_CREATEDON] The date of row creation
        /// 3: [SCRIBE_MODIFIEDON] The date of a rows last modification
        /// 4: [SCRIBE_DELETEDON] The date of row deletion
        /// </summary>
        /// <returns>The Created Scribe Specific replicaiton columns</returns>
        private List<DataEntity> CreateDefaultColumns()
        {
            List<DataEntity> defaultCols = new List<DataEntity>();

            //Create primary key column
            DataEntity column = new DataEntity("DataPropertyDefinition");
            column.Properties.Add("Name", Globals.ScribePrimaryKey);
            column.Properties.Add("DataType", "System.Int64");
            column.Properties.Add("Identity", true);
            column.Properties.Add("IdentitySeed", 1);
            column.Properties.Add("IdentityIncrement", 1);
            column.Properties.Add("Nullable", false);
            column.Properties.Add("InPrimaryKey", true);
            defaultCols.Add(column);

            //add created on standard column
            column = new DataEntity("DataPropertyDefinition");
            column.Properties.Add("Name", Globals.ScribeCreatedOn);
            column.Properties.Add("DataType", "System.DateTime");
            column.Properties.Add("Nullable", false);
            defaultCols.Add(column);

            //add modified on standard column
            column = new DataEntity("DataPropertyDefinition");
            column.Properties.Add("Name", Globals.ScribeModifedOn);
            column.Properties.Add("DataType", "System.DateTime");
            column.Properties.Add("Nullable", false);
            defaultCols.Add(column);

            //add deleted on standard colum
            column = new DataEntity("DataPropertyDefinition");
            column.Properties.Add("Name", Globals.ScribeDeletedOn);
            column.Properties.Add("DataType", "System.DateTime");
            column.Properties.Add("Nullable", true);
            defaultCols.Add(column);

            return defaultCols;
        }
 /// <summary>
 /// Constructor for building a select statement for using in CRUD operations
 /// with a command builder.
 /// </summary>
 /// <param name="operationInput"></param>
 /// <param name="lookupCondition"></param>
 /// <param name="queryType"></param>
 public SqlQueryBuilder(DataEntity operationInput, Expression lookupCondition, Globals.QueryType queryType)
 {
     Parse(operationInput, lookupCondition, queryType);
 }
        private string ParseQueryType(DataEntity input, Globals.QueryType queryType)
        {
            StringBuilder query;

            switch (queryType)
            {
                case Globals.QueryType.Insert:
                    query = new StringBuilder(CreateKeyword);
                    // add into clause
                    query.Append(ParseInsertQuery(input));
                    break;
                case Globals.QueryType.Delete:
                    query = new StringBuilder(DeleteKeyword);
                    // add from clause
                    query.Append(ParseFromClause(input.ObjectDefinitionFullName));
                    break;
                case Globals.QueryType.Update:
                    query = new StringBuilder(UpdateKeyword);
                    //add the set values
                    query.Append(ParseUpdateQuery(input));
                    break;
                case Globals.QueryType.Count:
                    query = new StringBuilder(SelectKeyword);
                    query.Append(" COUNT(*) ");
                    query.Append(ParseFromClause(input.ObjectDefinitionFullName));
                    break;
                case Globals.QueryType.Select:
                default:
                    query = new StringBuilder(SelectKeyword);
                    //retrieve the list of column names
                    List<string> columNames = input.Properties.Select(entityProperty => entityProperty.Key).ToList();
                    // add columns
                    query.Append(ParseColumns(columNames, input.ObjectDefinitionFullName));
                    // add from clause
                    query.Append(ParseFromClause(input.ObjectDefinitionFullName));
                    break;
            }

            return query.ToString();
        }
        private EntityProperties GetPrimaryKeyProperties(DataEntity dataEntity, OleDbMetadataAccess metadataAccess)
        {
            var primaryKeyProperties = new EntityProperties();
            //Use the data entity name to retrieve a list of indexes
            var indexColumns = metadataAccess.GetTableIndexInformation(dataEntity.ObjectDefinitionFullName);

            //Add each of the Primary Keys and their values found in the data entity.
            foreach (DataRow row in indexColumns.Rows)
            {
                if (!Convert.ToBoolean(row["PRIMARY_KEY"]))
                {
                    continue;
                }

                var columnName = row["COLUMN_NAME"].ToString();

                // Check if the priamry key column is included in the data entity.
                if (dataEntity.Properties.ContainsKey(columnName))
                {
                    // Add the key and its value to the primary key list.
                    primaryKeyProperties.Add(columnName, dataEntity.Properties[columnName]);
                }
                else
                {
                    // If the key has not been added set it to null.
                    primaryKeyProperties.Add(columnName, null);
                }
            }

            return primaryKeyProperties;
        }
Exemple #59
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(DataEntity.Model.ModelList model)
 {
     return dal.Add(model);
 }
        /// <summary>
        /// Provide the query for an update by parsing the input DataEntity.
        /// This however does not include the where clause
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        private string ParseUpdateQuery(DataEntity input)
        {
            StringBuilder updateValues = new StringBuilder();
            // parse through the column names and values
            foreach (var property in input.Properties)
            {
                string rightValue;

                if (property.Value == null)
                {
                    rightValue = "NULL";
                }
                else
                {
                    //create a new comparison value for the column value
                    var value = new ComparisonValue(ComparisonValueType.Constant, property.Value);
                    rightValue = GetRightFormattedComparisonValue(property.Key, value);
                }

                updateValues.Append(string.Format("[{0}] = {1},", property.Key, rightValue));
            }

            //remove the trailing comma
            updateValues = updateValues.Remove(updateValues.Length - 1, 1);

            return string.Format(" [{0}] " + SetKeyword + " {1}", input.ObjectDefinitionFullName, updateValues);
        }