public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new ReferenceListDbHelper(connection, transaction);
                    var id     = helper.GetReferenceListId(Namespace, Name);
                    if (id == null)
                    {
                        return;
                    }

                    if (Description.IsSet)
                    {
                        helper.UpdateReferenceListDescription(id, Description.Value);
                    }
                    if (NoSelectionValue.IsSet)
                    {
                        helper.UpdateReferenceListNoSelectionValue(id, NoSelectionValue.Value);
                    }
                }
            };

            processor.Process(exp);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new NotificationDbHelper(connection, transaction);

                    if (TemplateId.HasValue)
                    {
                        helper.DeleteNotificationTemplate(TemplateId.Value);
                    }
                    else if (DeleteAll)
                    {
                        var templateId = helper.GetNotificationId(Namespace, Name);
                        if (templateId == null)
                        {
                            throw new Exception($"Reference list '{Namespace}.{Name}' not found");
                        }

                        // delete all if filter is not specified
                        helper.DeleteNotificationTemplates(Namespace, Name);
                    }
                    else
                    {
                        throw new NotSupportedException();
                    }
                }
            };

            processor.Process(exp);
        }
Пример #3
0
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new ReferenceListDbHelper(connection, transaction);

                    var refListId = helper.GetReferenceListId(Namespace, Name);
                    if (refListId == null)
                    {
                        throw new Exception($"Reference list '{Namespace}.{Name}' not found");
                    }

                    if (DeleteAll)
                    {
                        // delete all if filter is not specified
                        helper.DeleteReferenceListItems(Namespace, Name);
                    }
                    else
                    if (ItemValue.HasValue)
                    {
                        helper.DeleteReferenceListItem(Namespace, Name, ItemValue.Value);
                    }
                }
            };

            processor.Process(exp);
        }
        private void ExecuteProcessor(IMigrationProcessor migrationProcessor, CancellationToken cancellationToken)
        {
            _logService.Info($"Executing {migrationProcessor}");

            try
            {
                var lastSyncVersion = _syncRepository.GetSyncParams().LastSyncVersion;
                if (lastSyncVersion.HasValue && lastSyncVersion > 0)
                {
                    if (!cancellationToken.IsCancellationRequested)
                    {
                        migrationProcessor.Process(cancellationToken);
                    }
                }
            }
            catch (FatalException)
            {
                throw;
            }
            catch (Exception ex)
            {
                _logService.Error("Error occurred. Sleeping before trying again", ex);
            }

            _logService.Info($"{migrationProcessor} executed");
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) => {
                    var helper    = new NotificationDbHelper(connection, transaction);
                    var refListId = helper.InsertNotification(Namespace, Name, Description);
                }
            };

            processor.Process(exp);
        }
Пример #6
0
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new NotificationDbHelper(connection, transaction);

                    var notificationId = helper.GetNotificationId(Namespace, Name);
                    if (notificationId == null)
                    {
                        throw new Exception($"Notification '{Namespace}.{Name}' not found");
                    }

                    if (!Template.Id.IsSet)
                    {
                        Template.Id.Set(Guid.NewGuid());
                    }
                    var templateId = Template.Id.Value;

                    helper.InsertNotificationTemplate(notificationId.Value, Template);

                    if (Template.Name.IsSet)
                    {
                        helper.UpdateTemplateName(templateId, Template.Name.Value);
                    }
                    if (Template.Subject.IsSet)
                    {
                        helper.UpdateTemplateSubject(templateId, Template.Subject.Value);
                    }
                    if (Template.Body.IsSet)
                    {
                        helper.UpdateTemplateBody(templateId, Template.Body.Value);
                    }
                    if (Template.BodyFormat.IsSet)
                    {
                        helper.UpdateTemplateBodyFormat(templateId, Template.BodyFormat.Value);
                    }
                    if (Template.SendType.IsSet)
                    {
                        helper.UpdateTemplateSendType(templateId, Template.SendType.Value);
                    }
                    if (Template.IsEnabled.IsSet)
                    {
                        helper.UpdateTemplateIsEnabled(templateId, Template.IsEnabled.Value);
                    }
                }
            };

            processor.Process(exp);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new ReferenceListDbHelper(connection, transaction);
                    helper.DeleteReferenceListItems(Namespace, Name);
                    helper.DeleteReferenceList(Namespace, Name);
                }
            };

            processor.Process(exp);
        }
Пример #8
0
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new NotificationDbHelper(connection, transaction);
                    helper.DeleteNotificationTemplates(Namespace, Name);
                    helper.DeleteNotification(Namespace, Name);
                }
            };

            processor.Process(exp);
        }
Пример #9
0
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) => {
                    var helper    = new ReferenceListDbHelper(connection, transaction);
                    var refListId = helper.InsertReferenceList(Namespace, Name, Description);

                    if (NoSelectionValue.IsSet)
                    {
                        helper.UpdateReferenceListNoSelectionValue(refListId, NoSelectionValue.Value);
                    }
                }
            };

            processor.Process(exp);
        }
Пример #10
0
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new ReferenceListDbHelper(connection, transaction);

                    var refListId = helper.GetReferenceListId(Namespace, Name);
                    if (refListId == null)
                    {
                        throw new Exception($"Reference list '{Namespace}.{Name}' not found");
                    }
                    helper.InsertReferenceListItem(refListId.Value, Item);
                }
            };

            processor.Process(exp);
        }
Пример #11
0
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new NotificationDbHelper(connection, transaction);
                    var id     = helper.GetNotificationId(Namespace, Name);
                    if (id == null)
                    {
                        return;
                    }

                    if (Description.IsSet)
                    {
                        helper.UpdateNotificationDescription(id, Description.Value);
                    }
                }
            };

            processor.Process(exp);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new NotificationDbHelper(connection, transaction);

                    if (Template.Name.IsSet)
                    {
                        helper.UpdateTemplateName(Id, Template.Name.Value);
                    }
                    if (Template.Subject.IsSet)
                    {
                        helper.UpdateTemplateSubject(Id, Template.Subject.Value);
                    }
                    if (Template.Body.IsSet)
                    {
                        helper.UpdateTemplateBody(Id, Template.Body.Value);
                    }
                    if (Template.BodyFormat.IsSet)
                    {
                        helper.UpdateTemplateBodyFormat(Id, Template.BodyFormat.Value);
                    }
                    if (Template.SendType.IsSet)
                    {
                        helper.UpdateTemplateSendType(Id, Template.SendType.Value);
                    }
                    if (Template.IsEnabled.IsSet)
                    {
                        helper.UpdateTemplateIsEnabled(Id, Template.IsEnabled.Value);
                    }
                }
            };

            processor.Process(exp);
        }
        public override void ExecuteWith(IMigrationProcessor processor)
        {
            var exp = new PerformDBOperationExpression()
            {
                Operation = (connection, transaction) =>
                {
                    var helper = new ReferenceListDbHelper(connection, transaction);
                    var listId = helper.GetReferenceListId(Namespace, Name);
                    if (listId == null)
                    {
                        throw new Exception($"ReferenceList '{Namespace}.{Name}' not found");
                    }

                    var itemId = helper.GetReferenceListItemId(listId.Value, ItemValue);
                    if (itemId == null)
                    {
                        throw new Exception($"Item {ItemValue} not found in the ReferenceList '{Namespace}.{Name}'");
                    }

                    if (ItemText.IsSet)
                    {
                        helper.UpdateReferenceListItemText(itemId, ItemText.Value);
                    }
                    if (Description.IsSet)
                    {
                        helper.UpdateReferenceListItemDescription(itemId, Description.Value);
                    }
                    if (OrderIndex.IsSet)
                    {
                        helper.UpdateReferenceListItemOrderIndex(itemId, OrderIndex.Value);
                    }
                }
            };

            processor.Process(exp);
        }
Пример #14
0
 public override void ExecuteWith(IMigrationProcessor processor)
 {
     processor.Process(this);
 }
 public override void ExecuteWith(IMigrationProcessor processor)
 {
     Column.TableName = TableName;
     processor.Process(this);
 }
 public override void ExecuteWith(IMigrationProcessor processor)
 {
     processor.Process(this);
 }
 public override void ExecuteWith(IMigrationProcessor processor)
 {
     Column.TableName = TableName;
     processor.Process(this);
 }