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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 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");
                    }
                    helper.InsertReferenceListItem(refListId.Value, Item);
                }
            };

            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);
        }