﻿<?xml version="1.0" encoding="utf-8"?>
<ReportsExport>
  <Reports>
    <Report id="0f00f3f9-a892-41d0-8c76-6a579ec55466" codekey="BackDateUserNotifications" categoryCodekey="Testing" name="Back Date User Notifications" description="Sets the notifiedDate in tblUserNotifications to the supplied value for the specified item">
      <MetaData created="2023-04-19T11:44:20" createdBy="Rolle, Administrator (Administrator)" createdBy_user_id="12" modified="2023-04-19T11:52:35" modifiedBy="Rolle, Administrator (Administrator)" modifiedBy_user_id="12" />
      <ExecutionDetails format="TableResult" commandType="SqlCommandOrQuery" exportHandler="" adminControl="" exportMultipleTablesToSheets="False" datesWithTime="False" extraParams="" />
      <Mandators mandatorMode="OnlyOwner" mandator_id="96ba2868-8baf-4e69-b1fb-d2cc6d6832e8" isStandard="False" isUsedByMenu="False" />
      <Parameters>
        <Parameter id="aee9472c-2d96-4e67-b86b-e4c2cbff8ca3" isRequired="True" allowMultiSelect="False" name="BausteinTyp (nur mit Status, schöne Namen)" contextName="BausteinTyp (nur mit Status, schöne Namen)" defaultValue="" renderHint="Undefined" disableParameter="DontDisable" />
        <Parameter id="24d85b3a-ea7b-4262-b2f6-32e62f3efe07" isRequired="True" allowMultiSelect="False" name="AuswahlItems per Typ" contextName="AuswahlItems per Typ" defaultValue="" renderHint="Undefined" disableParameter="DontDisable" />
        <Parameter id="79fd307f-f3f9-4345-a628-2551cc5ba444" isRequired="True" allowMultiSelect="False" name="Datum" contextName="Notified Date" defaultValue="" renderHint="Undefined" disableParameter="DontDisable" />
      </Parameters>
      <Roles>
        <Role id="90" />
      </Roles>
      <command>DECLARE @itemTitle NVARCHAR(256);

SELECT
    @itemTitle = title
FROM
    tblItems
WHERE
    id = @item_id

UPDATE
    tblUserNotifications
SET
    notifiedDate = @date
WHERE
    item_id = @item_id

SELECT
    CAST(@@ROWCOUNT AS NVARCHAR(5)) + ' notified dates for item "' + @itemTitle + '"/' + CAST(@item_id AS NVARCHAR(50)) + ' set to ' + CAST(@date AS NVARCHAR(20))</command>
    </Report>
  </Reports>
  <Parameters>
    <Parameter id="aee9472c-2d96-4e67-b86b-e4c2cbff8ca3" isSystem="True" name="BausteinTyp (nur mit Status, schöne Namen)" reportParameterType_id="32872b47-da0f-49d9-8853-0aa4760c5a11" queryParameterName="@itemType" />
    <Parameter id="24d85b3a-ea7b-4262-b2f6-32e62f3efe07" isSystem="False" name="AuswahlItems per Typ" reportParameterType_id="17ff1e13-3694-470a-b49a-39365569a442" queryParameterName="@item_id" />
    <Parameter id="79fd307f-f3f9-4345-a628-2551cc5ba444" isSystem="True" name="Datum" reportParameterType_id="74253ba7-a386-4620-bff7-b65c16fe1e64" queryParameterName="@date" />
    <Parameter id="93ea204b-dc5e-4c5e-a2fb-5bddfba00150" mandator_id="96ba2868-8baf-4e69-b1fb-d2cc6d6832e8" isSystem="False" name="BausteinTyp" reportParameterType_id="cf9a5701-3e0a-4d05-94f5-c9351e09b7ff" queryParameterName="@itemType" />
    <Parameter id="17e1339a-f602-4ddb-a763-50b517d774de" mandator_id="96ba2868-8baf-4e69-b1fb-d2cc6d6832e8" isSystem="False" name="Wahrheitswert" reportParameterType_id="411ec93b-ab23-41ba-91d6-e7dc0235b5af" queryParameterName="@boolean" />
  </Parameters>
  <ParameterTypes>
    <ParameterType id="32872b47-da0f-49d9-8853-0aa4760c5a11" isSystem="True" name="ItemType (with Status, nice names)" datatype="StringDDL" dataValueField="codekey" dataTextField="text">
      <query>
		  DECLARE @itemTypes AS TABLE (
		  codekey NVARCHAR(50),
		  text NVARCHAR(50)
		  )

		  INSERT INTO @itemTypes VALUES ('Theme', 'Lernprogramm')
		  INSERT INTO @itemTypes VALUES ('Test', 'Test')
		  INSERT INTO @itemTypes VALUES ('Poll', 'Poll')
		  INSERT INTO @itemTypes VALUES ('Document', 'Dokument')
		  INSERT INTO @itemTypes VALUES ('Training', 'Seminar')
		  INSERT INTO @itemTypes VALUES ('Video', 'Video')
		  INSERT INTO @itemTypes VALUES ('Module', 'Modul')

		  SELECT codekey, text FROM @itemTypes ORDER BY text
	  </query>
    </ParameterType>
    <ParameterType id="17ff1e13-3694-470a-b49a-39365569a442" isSystem="False" name="AuswahlItems (Typ)" datatype="GuidDDL" dataValueField="ItemID" dataTextField="title">
      <query>
        if @boolean = 1
        begin
        select tblItems.title + case when deleted is null then '' else ' (deleted)' end as title,
        tblExternalItems.id as itemId
        from tblExternalItems
        inner join tblItems on tblItems.id = tblExternalItems.id
        where  tblItems.mandator_id = @current_mandator_id
        order by title
        end
        else
        begin
        select title + case when deleted is null then '' else ' (deleted)' end as title,
        tblItems.id as itemId
        from tblItems
        inner join tblItemTypes on tblItemTypes.id = tblItems.itemType_id
        where tblItemTypes.codekey = @itemType and tblItems.mandator_id = @current_mandator_id
        order by title
        end
      </query>
      <Parameters>
        <Parameter id="93ea204b-dc5e-4c5e-a2fb-5bddfba00150" isRequired="False" allowMultiSelect="False" name="BausteinTyp" contextName="BausteinTyp" defaultValue="" renderHint="Undefined" disableParameter="DontDisable" />
        <Parameter id="17e1339a-f602-4ddb-a763-50b517d774de" isRequired="False" allowMultiSelect="False" name="Wahrheitswert" contextName="Wahrheitswert" defaultValue="" renderHint="Undefined" disableParameter="DontDisable" />
      </Parameters>
    </ParameterType>
    <ParameterType id="74253ba7-a386-4620-bff7-b65c16fe1e64" isSystem="True" name="Date" datatype="Date" dataValueField="" dataTextField="" />
    <ParameterType id="cf9a5701-3e0a-4d05-94f5-c9351e09b7ff" isSystem="True" name="ItemType (all)" datatype="StringDDL" dataValueField="value" dataTextField="text">
      <query>SELECT codekey value, codekey text FROM tblItemTypes</query>
    </ParameterType>
    <ParameterType id="411ec93b-ab23-41ba-91d6-e7dc0235b5af" isSystem="True" name="Boolean" datatype="StringDDL" dataValueField="Value" dataTextField="Text">
      <query>
        SELECT 0 AS Value, 'Nein' AS Text
        UNION
        SELECT 1 AS Value, 'Ja' AS Text
      </query>
    </ParameterType>
  </ParameterTypes>
</ReportsExport>