Beispiel #1
0
        public IAddReferenceListSyntax AddItem(long value, string item, Int64?orderIndex = null, string description = null)
        {
            var listItem = new ReferenceListItemDefinition {
                Item        = item,
                ItemValue   = value,
                OrderIndex  = orderIndex,
                Description = description
            };
            var addRefListItem = new AddReferenceListItemExpression
            {
                Item      = listItem,
                Namespace = Expression.Namespace,
                Name      = Expression.Name
            };

            _context.Expressions.Add(addRefListItem);

            return(this);
        }
        internal Guid InsertReferenceListItem(Guid refListId, ReferenceListItemDefinition item)
        {
            var id  = Guid.NewGuid();
            var sql = @"INSERT INTO Frwk_ReferenceListItems
           (Id
           ,TenantId
           ,Description
           ,HardLinkToApplication
           ,Item
           ,ItemValue
           ,OrderIndex
           ,ParentId
           ,ReferenceListId)
     VALUES
           (@Id
           ,@TenantId
           ,@Description
           ,@HardLinkToApplication
           ,@Item
           ,@ItemValue
           ,@OrderIndex
           ,@ParentId
           ,@ReferenceListId)";

            ExecuteNonQuery(sql, command => {
                command.AddParameter("@Id", id);
                command.AddParameter("@TenantId", null);
                command.AddParameter("@Description", item.Description);
                command.AddParameter("@HardLinkToApplication", 0);
                command.AddParameter("@Item", item.Item);
                command.AddParameter("@ItemValue", item.ItemValue);
                command.AddParameter("@OrderIndex", item.OrderIndex ?? item.ItemValue);
                command.AddParameter("@ParentId", null);
                command.AddParameter("@ReferenceListId", refListId);
            });

            return(id);
        }