Esempio n. 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ColumnNames">Column names</param>
 /// <param name="ColumnValues">Column values</param>
 /// <param name="ColumnNameHash">Column name hash</param>
 public Row(Hashtable ColumnNameHash, string[] ColumnNames, params object[] ColumnValues)
 {
     Contract.Requires <ArgumentNullException>(ColumnValues != null, "ColumnValues");
     this.ColumnNameHash = ColumnNameHash;
     this.ColumnNames    = ColumnNames;
     this.ColumnValues   = (object[])ColumnValues.Clone();
 }
        /// <summary>
        /// Executes current flow element in fragment.
        /// </summary>
        /// <returns>Count of participants which has been processed.</returns>
        protected override int FragmentExecute()
        {
            var columnValues = ColumnValues?.ToList();

            if (columnValues == null || columnValues.Count == 0)
            {
                return(SetItemCompleted((Select)GetAudienceQuery()));
            }
            var audienceByContact = GetAudienceContacts();
            var entitySchema      = UserConnection.EntitySchemaManager.GetInstanceByName(EntityName);
            var entitySettings    = GetEntitySettingsFromLookup();
            var entityCollection  = GetEntitiesCollectionByContactList(audienceByContact.Values, entitySchema,
                                                                       entitySettings, out var contactColumnAlias);

            foreach (var entity in entityCollection)
            {
                var contactId       = entity.GetTypedColumnValue <Guid>(contactColumnAlias);
                var participantId   = audienceByContact.FirstOrDefault(x => x.Value == contactId).Key;
                var isEntityUpdated = UpdateEntity(entity, contactId, participantId, entitySettings);
                if (!isEntityUpdated)
                {
                    UpdateParicipantStatus(participantId, CampaignConstants.CampaignParticipantErrorStatusId);
                    continue;
                }
            }
            return(SetItemCompleted((Select)GetAudienceQuery()));
        }
Esempio n. 3
0
            public IFilterValue GetColumn(String headerName)
            {
                IFilterValue fv = ColumnValues.Where(cv => cv.Header.IndexOf(headerName) != -1).FirstOrDefault();

                if (fv == null && ColumnValues.Where(cv => cv.Header == headerName).Count() == 1)
                {
                    InvalidRow = true;
                }
                return(fv);
            }
 public override XE BuildRequestDocument()
 {
     var request = BuildBaseDocument(RequestCode.Kind.GetAccount);
     request.Add(new XE(C.QueryCriteria, new XA(C.conditions, Conditions),
         ColumnValues.Select(condition =>
             new XE(C.Condition, new XA(C.name, condition.Column), new XA(C.value, condition.Value)))));
     request.Add(new XE(C.ResultSetDefinition,
         Columns.Select(column =>
             new XE(C.Column, column.Name))));
     return request;
 }
Esempio n. 5
0
            public IFilterValue DoMatchHeader(String columnName)
            {
                String columnHeader = $"{columnName}";
                var    doubleQuoted = ColumnValues.Where(row => row.Header.IndexOf("\"\"") != -1);

                if (doubleQuoted.Count() > 0)
                {
                    columnHeader = $"\"{columnHeader}\"";
                }
                return(ColumnValues.Where(cv => cv.Header == columnHeader).FirstOrDefault());
            }
Esempio n. 6
0
        public void Then_expected_values_are_set()
        {
            var expectedheader = "expectedHeader";
            var expectedValues = new List <string> {
                "abc", "foo"
            };

            var columnValues = new ColumnValues(expectedheader, expectedValues);

            columnValues.Header.Should().Be(expectedheader);
            columnValues.Values.Should().BeEquivalentTo(expectedValues);
        }
        public override XE BuildRequestDocument()
        {
            var request = BuildBaseDocument(RequestCode.Kind.GetCustomer);

            request.Add(
                new XE(C.QueryCriteria, new XA(C.conditions, Conditions),
                       ColumnValues.Select(cv => new XE(C.Condition, new XA(C.name, cv.Column), new XA(C.value, cv.Value)))));
            request.Add(new XE(C.ResultSetDefinition,
                               Columns.Select(c =>
                                              new XE(C.Column, c.Name))));
            return(request);
        }
Esempio n. 8
0
        public Insert Set(ColumnPredicate columnPredicate)
        {
            if (columnPredicate.Comparison != Comparison.Equal)
            {
                throw new NotSupportedException("Only Equal (==) comparisons are supported for this method.");
            }

            if (columnPredicate.NextInGroup != null)
            {
                throw new NotSupportedException("Multiple comparison operators are not supported for this method.");
            }

            ColumnValues.Add(columnPredicate.Column, columnPredicate.Value);
            return(this);
        }
Esempio n. 9
0
        public Solver(List <List <int> > puzzle)
        {
            for (var i = 0; i < 9; i++)
            {
                RowValues.Add(new List <bool> {
                    false, false, false, false, false, false, false, false, false, false
                });
                ColumnValues.Add(new List <bool> {
                    false, false, false, false, false, false, false, false, false, false
                });
                SquareValues.Add(new List <bool> {
                    false, false, false, false, false, false, false, false, false, false
                });
            }

            this.Puzzle = puzzle;
            this.ConfigureInitialPossibilities();
            this.Solve();
        }
Esempio n. 10
0
 public Example(ExampleColumns columnNames, Dictionary<string, string> columnValues)
 {
     ColumnNames = columnNames;
     ColumnValues = new ColumnValues(columnValues);
 }
Esempio n. 11
0
 public ColumnValueWrapper ByName(string name)
 {
     return(ColumnValues.Find(x => x.Column.ColumnName == name));
 }
Esempio n. 12
0
        public void GetValues(string propName)
        {
            Task.Run(() =>
            {
                for (int i = 0; i < _ranges.Length; i++)
                {
                    var lowBound  = Convert.ToDouble(_ranges[i]);
                    int highBound = 0;
                    int count     = 0;
                    string title  = "";


                    if (i != _ranges.Length - 1)
                    {
                        highBound = _ranges[i + 1];
                    }

                    var pacients = IoC.IoC.Container.Resolve <DataContext>().Pacients;
                    var param    = Expression.Parameter(typeof(Pacient));

                    if (i == 0)
                    {
                        //Creates lambda expresion
                        var condition =
                            Expression.Lambda <Func <Pacient, bool> >(
                                Expression.LessThanOrEqual(
                                    Expression.Convert(Expression.Property(param, propName), lowBound.GetType()),
                                    Expression.Constant(lowBound)
                                    ),
                                param
                                ).Compile();

                        count = pacients.ToList().Count(condition);
                        title = $"less then {lowBound}";
                    }

                    else if (i == _ranges.Length - 1)
                    {
                        //Creates lambda expresion
                        var condition =
                            Expression.Lambda <Func <Pacient, bool> >(
                                Expression.GreaterThanOrEqual(
                                    Expression.Convert(Expression.Property(param, propName), lowBound.GetType()),
                                    Expression.Constant(lowBound)
                                    ),
                                param
                                ).Compile();

                        count = pacients.ToList().Count(condition);

                        title = $"more then {lowBound}";
                    }
                    else
                    {
                        var lessCond =
                            Expression.Lambda <Func <Pacient, bool> >(
                                Expression.GreaterThanOrEqual(
                                    Expression.Convert(Expression.Property(param, propName), lowBound.GetType()),
                                    Expression.Constant(lowBound)
                                    ),
                                param
                                ).Compile();

                        var greaterCond =
                            Expression.Lambda <Func <Pacient, bool> >(
                                Expression.LessThanOrEqual(
                                    Expression.Convert(Expression.Property(param, propName), highBound.GetType()),
                                    Expression.Constant(highBound)
                                    ),
                                param
                                ).Compile();

                        count = pacients.ToList().Where(lessCond).Where(greaterCond).Count();


                        title = $"{lowBound} - {highBound}";
                    }


                    ColumnValues.Add(count);
                    ColumnLabels[i] = title;
                }
            });
        }
Esempio n. 13
0
 public Insert Set(IQueryableColumn column, object value)
 {
     ColumnValues.Add(column, value);
     return(this);
 }
Esempio n. 14
0
            public void RemoveColumn(String headerName)
            {
                CsvColumn csc = ColumnValues.Where(cv => cv.Header.IndexOf(headerName) != -1).FirstOrDefault();

                ColumnValues?.Remove(csc);
            }
Esempio n. 15
0
            public void AddColumn(String headerName, String value)
            {
                CsvColumn csc = new CsvColumn(headerName, value);

                ColumnValues.Add(csc);
            }
Esempio n. 16
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ColumnNames">Column names</param>
 /// <param name="ColumnValues">Column values</param>
 /// <param name="ColumnNameHash">Column name hash</param>
 public Row(Hashtable ColumnNameHash, string[] ColumnNames, params object[] ColumnValues)
 {
     this.ColumnNameHash = ColumnNameHash;
     this.ColumnNames    = ColumnNames;
     this.ColumnValues   = (object[])ColumnValues.Clone();
 }
Esempio n. 17
0
 public bool IsSet(IQueryableColumn column)
 {
     return(ColumnValues.ContainsKey(column));
 }