private bool UpdateEntity(Entity entity, Guid contactId, Guid participantId,
                           CmpgnUpdObjElEntity entitySettings)
 {
     try {
         FillEntityColumns(entity, contactId, entitySettings.Columns, entitySettings.RestrictedColumns);
         entity.UseAdminRights = false;
         return(entity.Save(false));
     } catch (Exception ex) {
         CampaignLogger.ErrorFormat(nameof(CampaignAddObjectFlowElement), ex, entity.SchemaName,
                                    $"Id = {entity.PrimaryColumnValue} ParticipantId = {participantId}");
         return(false);
     }
 }
        private EntityCollection GetEntitiesCollectionByContactList(IEnumerable <Guid> contacts,
                                                                    EntitySchema entitySchema, CmpgnUpdObjElEntity entitySettings, out string contactColumnAlias)
        {
            var esq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, EntityName)
            {
                UseAdminRights      = false,
                IgnoreDisplayValues = GlobalAppSettings.FeatureIgnoreDisplayValuesInDataUserTasks
            };

            esq.AddAllSchemaColumns();
            var contactColumnName = entitySettings.ContactColumnPath;

            if (string.IsNullOrEmpty(contactColumnName))
            {
                contactColumnAlias = null;
                return(default(EntityCollection));
            }
            if (!esq.Columns.Any(x => x.Name == contactColumnName))
            {
                contactColumnAlias = esq.AddColumn(contactColumnName).Name;
            }
            else
            {
                contactColumnAlias = contactColumnName;
            }
            var filterGroup = new EntitySchemaQueryFilterCollection(esq, LogicalOperationStrict.Or);

            foreach (var contactId in contacts)
            {
                var filter = esq.CreateFilterWithParameters(FilterComparisonType.Equal, contactColumnName, contactId);
                filterGroup.Add(filter);
            }
            esq.Filters.Add(filterGroup);
            return(esq.GetEntityCollection(UserConnection));
        }
 public CmpgnUpdObjElEntity(CmpgnUpdObjElEntity source)
     : base(source)
 {
 }