private static BulkUpdateProperties GetBulkUpdateContent(ResourceId resource, List <ulong> ids, int index, string testDateTime, TestCoreFramework.Enums.FieldType type, HrbcFieldCreator fieldCreator) { Func <ResourceId, KeyValuePair <object, FieldPropertyCollection>, KeyValuePair <string, FieldContent> > userFieldDataGenerator = (resourceId, x) => new KeyValuePair <string, FieldContent>(x.Value.Name, new FieldContent { Content = testDateTime }); var fields = fieldCreator.Data.Where(x => x.Value.Field.Resource == resource) .Select(x => userFieldDataGenerator(resource, x)) .Concat(new List <KeyValuePair <string, FieldContent> > { new KeyValuePair <string, FieldContent>(SearchConstants.FieldTypeToApplicationFieldNameMap[type], new FieldContent { Content = testDateTime }) }) .Concat(SearchConstants.SystemFieldsValues[resource].Where(x => type == x.Key).Select(field => new KeyValuePair <string, FieldContent>(field.Value, new FieldContent { Content = testDateTime }))) .ToDictionary(pair => pair.Key, pair => pair.Value); var bulkUpdate = new BulkUpdateProperties(); bulkUpdate.Create = new Create(); bulkUpdate.Create.Resource = resource.ToString(); bulkUpdate.Create.Tag = resource.ToString(); bulkUpdate.Create.Records = new Records(); bulkUpdate.Create.Records.Ids = ids; bulkUpdate.Create.Records.PhpSearch = string.Empty; bulkUpdate.Create.Fields = fields; bulkUpdate.Create.CheckPhasePermissions = true; return(bulkUpdate); }
private static BulkUpdateProperties GetBulkUpdateContent(ResourceId resource, List <ulong> ids, string date) { var bulkUpdate = new BulkUpdateProperties(); bulkUpdate.Create = new Create(); bulkUpdate.Create.Resource = resource.ToString(); bulkUpdate.Create.Tag = resource.ToString(); bulkUpdate.Create.Records = new Records(); bulkUpdate.Create.Records.Ids = ids; bulkUpdate.Create.Records.PhpSearch = string.Empty; bulkUpdate.Create.Fields = new Dictionary <string, FieldContent> { [UpdateDate] = new FieldContent() { Content = date } }; bulkUpdate.Create.CheckPhasePermissions = true; return(bulkUpdate); }
private static BulkUpdateProperties GetBulkUpdateContent(Filters filterInput = Filters.Append) { var bulkUpdate = new BulkUpdateProperties(); bulkUpdate.Create = new Create(); bulkUpdate.Create.Resource = Resource.ToString(); bulkUpdate.Create.Tag = Resource.ToString(); bulkUpdate.Create.Records = new Records(); bulkUpdate.Create.Records.Ids = SelectionRecordIds(Record, Filter, Resource, RecordCreator); bulkUpdate.Create.Records.PhpSearch = string.Empty; var fields = new Dictionary <string, FieldContent>(); foreach (var field in Fields) { foreach (var item in GetFieldsParameter(filterInput, field.Key, field.Value.ToString())) { fields[item.Key] = item.Value; } } bulkUpdate.Create.Fields = fields; return(bulkUpdate); }