Folder + bisschen Logik
This commit is contained in:
@@ -95,6 +95,34 @@ namespace BeWo.ServiceProxy
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteineBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
|
||||
void DeleteAiPromptbausteine(System.Collections.Generic.Dictionary<long, long> oid2version);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteinFolder", ReplyAction="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteinFolderResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteinFolderBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinFolderDC> GetAiPromptbausteinFolder(BS.Shared.AiActionType aiActionType);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinFolder", ReplyAction="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinFolderResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinFolderBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinFolderDC> InsertAiPromptbausteinFolder(System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinFolderDC> folders);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinPrompt", ReplyAction="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinPromptResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/InsertAiPromptbausteinPromptBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinPromptDC> InsertAiPromptbausteinPrompt(System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinPromptDC> prompts);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinFolder", ReplyAction="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinFolderResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinFolderBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinFolderDC> UpdateAiPromptbausteinFolder(System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinFolderDC> folders);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinPrompt", ReplyAction="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinPromptResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteinPromptBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinPromptDC> UpdateAiPromptbausteinPrompt(System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinPromptDC> prompts);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinFolder", ReplyAction="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinFolderResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinFolderBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
|
||||
void DeleteAiPromptbausteinFolder(System.Collections.Generic.Dictionary<long, long> oid2version);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinPrompt", ReplyAction="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinPromptResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteinPromptBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
|
||||
void DeleteAiPromptbausteinPrompt(System.Collections.Generic.Dictionary<long, long> oid2version);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/ExecuteAiFunctionServiceRecordDocumentation" +
|
||||
"", ReplyAction="http://tempuri.org/IAiEnhancedService/ExecuteAiFunctionServiceRecordDocumentation" +
|
||||
"Response")]
|
||||
@@ -232,6 +260,41 @@ namespace BeWo.ServiceProxy
|
||||
base.Channel.DeleteAiPromptbausteine(oid2version);
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinFolderDC> GetAiPromptbausteinFolder(BS.Shared.AiActionType aiActionType)
|
||||
{
|
||||
return base.Channel.GetAiPromptbausteinFolder(aiActionType);
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinFolderDC> InsertAiPromptbausteinFolder(System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinFolderDC> folders)
|
||||
{
|
||||
return base.Channel.InsertAiPromptbausteinFolder(folders);
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinPromptDC> InsertAiPromptbausteinPrompt(System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinPromptDC> prompts)
|
||||
{
|
||||
return base.Channel.InsertAiPromptbausteinPrompt(prompts);
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinFolderDC> UpdateAiPromptbausteinFolder(System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinFolderDC> folders)
|
||||
{
|
||||
return base.Channel.UpdateAiPromptbausteinFolder(folders);
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinPromptDC> UpdateAiPromptbausteinPrompt(System.Collections.Generic.List<BS.Shared.DataContracts.AiPromptbausteinPromptDC> prompts)
|
||||
{
|
||||
return base.Channel.UpdateAiPromptbausteinPrompt(prompts);
|
||||
}
|
||||
|
||||
public void DeleteAiPromptbausteinFolder(System.Collections.Generic.Dictionary<long, long> oid2version)
|
||||
{
|
||||
base.Channel.DeleteAiPromptbausteinFolder(oid2version);
|
||||
}
|
||||
|
||||
public void DeleteAiPromptbausteinPrompt(System.Collections.Generic.Dictionary<long, long> oid2version)
|
||||
{
|
||||
base.Channel.DeleteAiPromptbausteinPrompt(oid2version);
|
||||
}
|
||||
|
||||
public BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords.AiFunctionDocResponse ExecuteAiFunctionServiceRecordDocumentation(BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords.AiFunctionDocRequest request)
|
||||
{
|
||||
return base.Channel.ExecuteAiFunctionServiceRecordDocumentation(request);
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
TreeViewItem.Selected="treeView_Selected">
|
||||
<TreeView.Resources>
|
||||
<Style x:Key="igoal_treeitemstyle" TargetType="TreeViewItem">
|
||||
<Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
|
||||
</Style>
|
||||
</TreeView.Resources>
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
MaxHeight="100"
|
||||
IsEnabled="{Binding IsEditingMode}"
|
||||
MaxLength="1024"
|
||||
Style="{StaticResource TextBoxNotice}"
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace BeWo.ViewModel
|
||||
public bool IsExpanded
|
||||
{
|
||||
get => _IsExpanded;
|
||||
set => SetProperty(ref _IsExpanded, value, nameof(IsExpanded), () => DataContract.IsExpanded);
|
||||
set => SetProperty(ref _IsExpanded, value, nameof(IsExpanded));
|
||||
}
|
||||
|
||||
public AiActionType ActionType
|
||||
@@ -99,10 +99,15 @@ namespace BeWo.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanAdd
|
||||
public bool CanAddFolder
|
||||
{
|
||||
get => DataContract.CanAdd;
|
||||
set => DataContract.CanAdd = value;
|
||||
get => DataContract.CanAddFolder;
|
||||
set => DataContract.CanAddFolder = value;
|
||||
}
|
||||
public bool CanAddPrompt
|
||||
{
|
||||
get => DataContract.CanAddPrompt;
|
||||
set => DataContract.CanAddPrompt = value;
|
||||
}
|
||||
public bool CanEdit
|
||||
{
|
||||
@@ -110,6 +115,15 @@ namespace BeWo.ViewModel
|
||||
set => DataContract.CanEdit = value;
|
||||
}
|
||||
|
||||
public bool IsNewFeature
|
||||
{
|
||||
get => DataContract.IsNewFeature;
|
||||
}
|
||||
public bool IsEnabled
|
||||
{
|
||||
get => !IsNewFeature;
|
||||
}
|
||||
|
||||
public AiPromptbausteinFolderVM Parent { get; set; }
|
||||
|
||||
public FontWeight FontWeight => !IsNew && ParentFolderOid is null ? FontWeights.SemiBold : FontWeights.Medium;
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
foreach (var vm in VMList)
|
||||
{
|
||||
vm.Parent = parent;
|
||||
vm.ParentFolderOid = parent?.DataContract?.Oid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,14 +134,31 @@ namespace BeWo.ViewModel.View.Administration
|
||||
|
||||
var actions = new List<Action<IAiEnhancedService>>();
|
||||
|
||||
//if (toadd_dcs.Any())
|
||||
// actions.Add(x => x.CreateAiPromptbausteineTree(toadd_dcs.ToList()));
|
||||
if (toadd_folder.Any())
|
||||
actions.Add(x => x.InsertAiPromptbausteinFolder(toadd_folder_dcs.ToList()));
|
||||
|
||||
//if (toupdate_dcs.Any())
|
||||
// actions.Add(x => x.UpdateAiPromptbausteineTree(toupdate_dcs.ToList()));
|
||||
if (toadd_prompts.Any())
|
||||
actions.Add(x => x.InsertAiPromptbausteinPrompt(toadd_prompts.ToList()));
|
||||
|
||||
//if (todelete.Any())
|
||||
// actions.Add(x => x.DeleteAiPromptbausteineTree(todelete.ToDictionary(x1 => x1.Oid.Value, x2 => x2.Version.Value)));
|
||||
if (toupdate_folder_dcs.Any())
|
||||
{
|
||||
foreach (var folder_dc in toupdate_folder_dcs)
|
||||
{
|
||||
folder_dc.SubPrompts = null;
|
||||
folder_dc.SubFolders = null;
|
||||
}
|
||||
|
||||
actions.Add(x => x.UpdateAiPromptbausteinFolder(toupdate_folder_dcs.ToList()));
|
||||
}
|
||||
|
||||
if (toupdate_prompt.Any())
|
||||
actions.Add(x => x.UpdateAiPromptbausteinPrompt(toupdate_prompt.ToList()));
|
||||
|
||||
if (todelete_folder.Any())
|
||||
actions.Add(x => x.DeleteAiPromptbausteinFolder(todelete_folder.ToDictionary(x1 => x1.Oid.Value, x2 => x2.Version.Value)));
|
||||
|
||||
if (todelete_prompt.Any())
|
||||
actions.Add(x => x.DeleteAiPromptbausteinPrompt(todelete_prompt.ToDictionary(x1 => x1.Oid.Value, x2 => x2.Version.Value)));
|
||||
|
||||
ServiceFacade.DoMultipleAiEnhancedServicesAsync(actions, () =>
|
||||
{
|
||||
@@ -150,11 +167,14 @@ namespace BeWo.ViewModel.View.Administration
|
||||
}
|
||||
internal void ReloadVMList()
|
||||
{
|
||||
var folders_dc = PredefinedAiPromptbausteinFolders.CreateSubTree(AiActionType);
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(
|
||||
req => req.GetAiPromptbausteinFolder(AiActionType),
|
||||
callback =>
|
||||
{
|
||||
Folders = new AiPromptbausteinFolderListVM(callback);
|
||||
|
||||
Folders = new AiPromptbausteinFolderListVM(folders_dc);
|
||||
|
||||
FirePropertyChanged(nameof(Folders));
|
||||
FirePropertyChanged(nameof(Folders));
|
||||
});
|
||||
}
|
||||
public void UpdateVMList(AiPromptbausteinTreeListVM new_list)
|
||||
{
|
||||
@@ -212,8 +232,11 @@ namespace BeWo.ViewModel.View.Administration
|
||||
|
||||
new_vm.Creator = CurrentEmployee;
|
||||
new_vm.Parent = sel_folder;
|
||||
new_vm.CanAdd = true;
|
||||
new_vm.ParentFolderOid = sel_folder?.DataContract?.Oid;
|
||||
new_vm.CanAddFolder = true;
|
||||
new_vm.CanAddPrompt = true;
|
||||
new_vm.CanEdit = true;
|
||||
new_vm.ActionType = AiActionType;
|
||||
|
||||
var vm = new AiPromptbausteinFolderViewModel(new_vm, true);
|
||||
|
||||
@@ -265,7 +288,7 @@ namespace BeWo.ViewModel.View.Administration
|
||||
|
||||
bool canOpenAddFolderDialog()
|
||||
{
|
||||
return SelectedFolder?.CanAdd ?? true;
|
||||
return SelectedFolder?.CanAddFolder ?? true;
|
||||
}
|
||||
bool canOpenEditFolderDialog()
|
||||
{
|
||||
@@ -355,7 +378,7 @@ namespace BeWo.ViewModel.View.Administration
|
||||
|
||||
bool canOpenAddPromptDialog()
|
||||
{
|
||||
return SelectedFolder?.CanAdd ?? false;
|
||||
return SelectedFolder?.CanAddPrompt ?? false;
|
||||
}
|
||||
bool canOpenEditPromptDialog()
|
||||
{
|
||||
|
||||
@@ -2778,6 +2778,19 @@ WHERE sc.Billable = 1 and sr.StartDate >= '{0:yyyy-MM-dd}' and sr.StartDate < '{
|
||||
return criteria.List<TextModule>();
|
||||
}
|
||||
|
||||
public IEnumerable<AiPromptbausteinFolder> GetOwnActiveRootAiPromptbausteineFolders(AiActionType? aiActionType = null)
|
||||
{
|
||||
var criteria = CreateCriteriaIsActive<AiPromptbausteinFolder>()
|
||||
.Add(Restrictions.IsNull(nameof(AiPromptbausteinFolder.ParentFolderOid)));
|
||||
|
||||
if (aiActionType is AiActionType actionType)
|
||||
{
|
||||
criteria.Add(Restrictions.Eq(nameof(AiPromptbausteinFolder.ActionType), actionType));
|
||||
}
|
||||
|
||||
return criteria.List<AiPromptbausteinFolder>();
|
||||
}
|
||||
|
||||
public IEnumerable<AiPromptbausteinTree> GetActiveRootAiPromptbausteine(AiActionType? aiActionType = null)
|
||||
{
|
||||
var criteria = CreateCriteriaIsActive<AiPromptbausteinTree>()
|
||||
|
||||
@@ -239,6 +239,7 @@
|
||||
<Compile Include="Entities\AiConfig.cs" />
|
||||
<Compile Include="Entities\AiPromptbaustein.cs" />
|
||||
<Compile Include="Entities\AiModel.cs" />
|
||||
<Compile Include="Entities\AiPromptbausteinFolder.cs" />
|
||||
<Compile Include="Entities\AiPromptbausteinPrompt.cs" />
|
||||
<Compile Include="Entities\AiPromptbausteinTree.cs" />
|
||||
<Compile Include="Entities\AiSetting.cs" />
|
||||
@@ -868,6 +869,9 @@
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Mappings\AiPromptbausteinPrompt.hbm.xml" />
|
||||
<EmbeddedResource Include="Mappings\AiPromptbausteinFolder.hbm.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Content Include="Mappings\Timesheet2Mail.hbm.xml" />
|
||||
<EmbeddedResource Include="Mappings\ContactHistory.hbm.xml">
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
36
Data/Entities/AiPromptbausteinFolder.cs
Normal file
36
Data/Entities/AiPromptbausteinFolder.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
|
||||
namespace BeWo.Data.Entities
|
||||
{
|
||||
public class AiPromptbausteinFolder : BeWoEntityBase
|
||||
{
|
||||
public AiPromptbausteinFolder()
|
||||
{
|
||||
_Tid = TableID.AiPromptbausteinFolder;
|
||||
}
|
||||
|
||||
public virtual string Title { get; set; }
|
||||
|
||||
public virtual string Description { get; set; }
|
||||
|
||||
public virtual long? ParentFolderOid { get; set; }
|
||||
|
||||
public virtual long? CreatorOid { get; set; }
|
||||
|
||||
public virtual bool IsPublic { get; set; }
|
||||
|
||||
public virtual int Position { get; set; }
|
||||
|
||||
public virtual bool IsExpanded { get; set; }
|
||||
|
||||
public virtual AiActionType ActionType { get; set; }
|
||||
|
||||
public virtual IList<AiPromptbausteinFolder> SubFolders { get; set; } = new List<AiPromptbausteinFolder>();
|
||||
|
||||
public virtual IList<AiPromptbausteinPrompt> SubPrompts { get; set; } = new List<AiPromptbausteinPrompt>();
|
||||
}
|
||||
}
|
||||
34
Data/Mappings/AiPromptbausteinFolder.hbm.xml
Normal file
34
Data/Mappings/AiPromptbausteinFolder.hbm.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="BeWo.Data.Entities.AiPromptbausteinFolder,BeWo.Data" table="AiPromptbausteinFolder">
|
||||
<id name="Oid" column ="Oid" unsaved-value="null">
|
||||
<generator class="identity" />
|
||||
</id>
|
||||
<version type="Int64" column="Version" name="Version" />
|
||||
<property name="InsTs"/>
|
||||
<property name="InsUser"/>
|
||||
<property column="Tid" type="BS.Shared.TableID, BS.Shared" name="_Tid" access="field" />
|
||||
<property name="UdpUser"/>
|
||||
<property name="IsActive" type="BS.Shared.ActivationTypeId, BS.Shared" />
|
||||
<property name="SystemEntryID" type="BS.Shared.SystemEntryID, BS.Shared" />
|
||||
<property name="Notice"/>
|
||||
<property name="Title"/>
|
||||
<property name="Description"/>
|
||||
<property name="ParentFolderOid"/>
|
||||
<property name="CreatorOid"/>
|
||||
<property name="IsPublic"/>
|
||||
<property name="Position"/>
|
||||
<property name="ActionType" type="BS.Shared.AiActionType, BS.Shared"/>
|
||||
|
||||
<bag name="SubFolders" table="aipromptbausteinfolder" generic="true" cascade="all-delete-orphan" batch-size="250" where="IsActive = 1">
|
||||
<key column="ParentFolderOid" />
|
||||
<one-to-many class="BeWo.Data.Entities.AiPromptbausteinFolder, BeWo.Data" />
|
||||
</bag>
|
||||
|
||||
<bag name="SubPrompts" table="aipromptbausteinprompt" generic="true" cascade="all-delete-orphan" batch-size="250" where="IsActive = 1">
|
||||
<key column="ParentFolderOid" />
|
||||
<one-to-many class="BeWo.Data.Entities.AiPromptbausteinPrompt, BeWo.Data" />
|
||||
</bag>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -9,17 +9,19 @@ CREATE TABLE `AiPromptbausteinPrompt` (
|
||||
`IsActive` tinyint DEFAULT NULL,
|
||||
`SystemEntryID` int DEFAULT NULL,
|
||||
`Title` varchar(255),
|
||||
`Description` varchar(255),
|
||||
`Description` mediumtext,
|
||||
`ParentFolderOid` bigint DEFAULT NULL,
|
||||
`CreatorOid` bigint,
|
||||
`IsPublic` tinyint,
|
||||
`Position` int,
|
||||
`Prompt` varchar(255),
|
||||
`Prompt` mediumtext,
|
||||
`ShowPrompt` tinyint,
|
||||
`ShowPromptByTenant` tinyint,
|
||||
`IsOwnsoftPrompt` tinyint,
|
||||
`OwnsoftRefLink` varchar(255),
|
||||
PRIMARY KEY (`Oid`),
|
||||
KEY `FK_AIPROMPTBAUSTEINPROMPT_EMPLOYEE_IDX` (`CreatorOid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINPROMPT_EMPLOYEE` FOREIGN KEY (`CreatorOid`) REFERENCES `employee` (`Oid`)
|
||||
KEY `FK_AIPROMPTBAUSTEINPROMPT_PARENT_IDX` (`ParentFolderOid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINPROMPT_EMPLOYEE` FOREIGN KEY (`CreatorOid`) REFERENCES `employee` (`Oid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINPROMPT_PARENT` FOREIGN KEY (`ParentFolderOid`) REFERENCES `aipromptbausteinfolder` (`Oid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
|
||||
23
Model/Changes_2026-01-12 AI Promptbausteinfolder.txt
Normal file
23
Model/Changes_2026-01-12 AI Promptbausteinfolder.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
CREATE TABLE `AiPromptbausteinFolder` (
|
||||
`Oid` bigint NOT NULL AUTO_INCREMENT,
|
||||
`InsTs` datetime DEFAULT NULL,
|
||||
`InsUser` varchar(256) DEFAULT NULL,
|
||||
`Notice` varchar(1024) DEFAULT NULL,
|
||||
`Tid` int DEFAULT NULL,
|
||||
`UdpUser` varchar(256) DEFAULT NULL,
|
||||
`Version` bigint DEFAULT NULL,
|
||||
`IsActive` tinyint DEFAULT NULL,
|
||||
`SystemEntryID` int DEFAULT NULL,
|
||||
`Title` varchar(255),
|
||||
`Description` mediumtext,
|
||||
`ParentFolderOid` bigint DEFAULT NULL,
|
||||
`CreatorOid` bigint DEFAULT NULL,
|
||||
`IsPublic` tinyint,
|
||||
`Position` int,
|
||||
`ActionType` int,
|
||||
PRIMARY KEY (`Oid`),
|
||||
KEY `FK_AIPROMPTBAUSTEINFOLDER_EMPLOYEE_IDX` (`CreatorOid`),
|
||||
KEY `FK_AIPROMPTBAUSTEINFOLDER_PARENT_IDX` (`ParentFolderOid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINFOLDER_EMPLOYEE` FOREIGN KEY (`CreatorOid`) REFERENCES `employee` (`Oid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINFOLDER_PARENT` FOREIGN KEY (`ParentFolderOid`) REFERENCES `aipromptbausteintree` (`Oid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
@@ -0,0 +1,59 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.ServiceImplementations;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
|
||||
namespace BeWo.Service.DCEntityMapper
|
||||
{
|
||||
public class AiPromptbausteinFolderDC_AiPromptbausteinFolder : BeWoDataContract_BeWoEntityBase<AiPromptbausteinFolder, AiPromptbausteinFolderDC>
|
||||
{
|
||||
public override AiPromptbausteinFolderDC MergeWithDC(AiPromptbausteinFolder pEntity, AiPromptbausteinFolderDC pDataContract)
|
||||
{
|
||||
base.MergeWithDC(pEntity, pDataContract);
|
||||
|
||||
pDataContract.Title = pEntity.Title;
|
||||
pDataContract.Description = pEntity.Description;
|
||||
pDataContract.ParentFolderOid = pEntity.ParentFolderOid;
|
||||
pDataContract.IsPublic = pEntity.IsPublic;
|
||||
pDataContract.Position = pEntity.Position;
|
||||
pDataContract.IsExpanded = pEntity.IsExpanded;
|
||||
pDataContract.ActionType = pEntity.ActionType;
|
||||
pDataContract.SubFolders = MapperFactory.AiPromptbausteinFolder.MapToNewDCs(pEntity.SubFolders);
|
||||
pDataContract.SubPrompts = MapperFactory.AiPromptbausteinPrompt.MapToNewDCs(pEntity.SubPrompts);
|
||||
|
||||
if (pEntity.CreatorOid is long oid)
|
||||
pDataContract.Creator = new EmployeeServiceImp().GetActiveCompactEmployeeWithOid(oid);
|
||||
|
||||
return pDataContract;
|
||||
}
|
||||
|
||||
public override AiPromptbausteinFolder MergeWithEntity(AiPromptbausteinFolderDC pDataContract, AiPromptbausteinFolder pEntity)
|
||||
{
|
||||
base.MergeWithDC(pEntity, pDataContract);
|
||||
|
||||
pEntity.Title = pDataContract.Title;
|
||||
pEntity.Description = pDataContract.Description;
|
||||
pEntity.CreatorOid = pDataContract.Creator.EmployeeOid;
|
||||
pEntity.IsPublic = pDataContract.IsPublic;
|
||||
pEntity.Position = pDataContract.Position;
|
||||
pEntity.ActionType = pDataContract.ActionType;
|
||||
|
||||
if(pDataContract.ParentFolderOid is long oid && oid >= 0)
|
||||
pEntity.ParentFolderOid = pDataContract.ParentFolderOid;
|
||||
|
||||
if (pDataContract.SubFolders is object)
|
||||
MapperFactory.AiPromptbausteinFolder.MergeWithEntitys(pDataContract.SubFolders, pEntity.SubFolders);
|
||||
|
||||
if (pDataContract.SubPrompts is object)
|
||||
MapperFactory.AiPromptbausteinPrompt.MergeWithEntitys(pDataContract.SubPrompts, pEntity.SubPrompts);
|
||||
|
||||
return pEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,8 @@ namespace BeWo.Service.DCEntityMapper
|
||||
pEntity.Prompt = pDataContract.Prompt;
|
||||
pEntity.ShowPrompt = pDataContract.ShowPrompt;
|
||||
pEntity.ShowPromptByTenant = pDataContract.ShowPromptByTenant;
|
||||
pEntity.IsOwnsoftPrompt = pDataContract.IsOwnsoftPrompt;
|
||||
pEntity.OwnsoftRefLink = pDataContract.OwnsoftRefLink;
|
||||
//pEntity.IsOwnsoftPrompt = pDataContract.IsOwnsoftPrompt;
|
||||
//pEntity.OwnsoftRefLink = pDataContract.OwnsoftRefLink;
|
||||
|
||||
return pEntity;
|
||||
}
|
||||
|
||||
@@ -818,6 +818,8 @@ namespace BeWo.Service.DCEntityMapper
|
||||
public static AiModelDC_AiModel AiModel { get; } = new AiModelDC_AiModel();
|
||||
public static AiConfigDC_AiConfig AiConfig { get; } = new AiConfigDC_AiConfig();
|
||||
public static AiPromptbausteinTreeDC_AiPromptbaustein AiPromptbausteinTree { get; } = new AiPromptbausteinTreeDC_AiPromptbaustein();
|
||||
public static AiPromptbausteinFolderDC_AiPromptbausteinFolder AiPromptbausteinFolder { get; } = new AiPromptbausteinFolderDC_AiPromptbausteinFolder();
|
||||
public static AiPromptbausteinPromptDC_AiPromptbausteinPrompt AiPromptbausteinPrompt { get; } = new AiPromptbausteinPromptDC_AiPromptbausteinPrompt();
|
||||
public static AiPromptbausteinTreeDC_AiPromptbausteinTree AiPromptbausteinTreeTree { get; } = new AiPromptbausteinTreeDC_AiPromptbausteinTree();
|
||||
public static AddressDC_Address Address { get; } = new AddressDC_Address();
|
||||
public static GkvAbrechnungLightDC_GkvAbrechnungLight GkvAbrechnungLight { get; } = new GkvAbrechnungLightDC_GkvAbrechnungLight();
|
||||
|
||||
@@ -144,5 +144,109 @@ namespace BeWo.Service.Plugins
|
||||
aiPromptbausteinListe.Add(aiPromptbaustein);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IEnumerable<AiPromptbausteinFolderDC> GetAiPromptbausteinFolder(AiActionType aiActionType)
|
||||
{
|
||||
var own_bib = PredefinedAiPromptbausteinFolders.CreateOwnBibNode(aiActionType);
|
||||
var shared_bib = PredefinedAiPromptbausteinFolders.CreateSharedBibNode(aiActionType);
|
||||
var public_bib = PredefinedAiPromptbausteinFolders.CreatePublicBibNode(aiActionType);
|
||||
|
||||
var own = DAOFactory.SearchDAO.GetOwnActiveRootAiPromptbausteineFolders(aiActionType);
|
||||
var own_dcs = MapperFactory.AiPromptbausteinFolder.MapToNewDCs(own);
|
||||
|
||||
foreach (var dc in own_dcs)
|
||||
{
|
||||
initOwnFolder(dc);
|
||||
}
|
||||
|
||||
own_bib.SubFolders.AddRange(own_dcs);
|
||||
|
||||
return new List<AiPromptbausteinFolderDC>() {
|
||||
own_bib, shared_bib, public_bib
|
||||
};
|
||||
}
|
||||
private void initOwnFolder(AiPromptbausteinFolderDC folder)
|
||||
{
|
||||
folder.CanAddFolder = true;
|
||||
folder.CanAddPrompt = true;
|
||||
folder.CanEdit = true;
|
||||
|
||||
foreach (var prompt in folder.SubPrompts)
|
||||
{
|
||||
prompt.CanEdit = true;
|
||||
}
|
||||
|
||||
foreach (var next_folder in folder.SubFolders)
|
||||
{
|
||||
initOwnFolder(next_folder);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<AiPromptbausteinFolderDC> InsertAiPromptbausteinFolder(IEnumerable<AiPromptbausteinFolderDC> folders)
|
||||
{
|
||||
var entities = MapperFactory.AiPromptbausteinFolder.MapToNewEntities(folders);
|
||||
|
||||
DAOFactory.GenericDAO.Insert(entities);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IEnumerable<AiPromptbausteinPromptDC> InsertAiPromptbausteinPrompt(IEnumerable<AiPromptbausteinPromptDC> prompts)
|
||||
{
|
||||
var entities = MapperFactory.AiPromptbausteinPrompt.MapToNewEntities(prompts);
|
||||
|
||||
DAOFactory.GenericDAO.Insert(entities);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IEnumerable<AiPromptbausteinFolderDC> UpdateAiPromptbausteinFolder(IEnumerable<AiPromptbausteinFolderDC> folders)
|
||||
{
|
||||
var originale = DAOFactory.GenericDAO.LoadByIDs<AiPromptbausteinFolder>(folders.Select(sc => sc.Oid.Value));
|
||||
var folders2 = folders.ToList();
|
||||
MapperFactory.AiPromptbausteinFolder.MergeWithEntitys(folders2, originale);
|
||||
|
||||
DAOFactory.GenericDAO.Update(originale);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IEnumerable<AiPromptbausteinPromptDC> UpdateAiPromptbausteinPrompt(IEnumerable<AiPromptbausteinPromptDC> prompts)
|
||||
{
|
||||
var originale = DAOFactory.GenericDAO.LoadByIDs<AiPromptbausteinPrompt>(prompts.Select(sc => sc.Oid.Value));
|
||||
var prompts2 = prompts.ToList();
|
||||
MapperFactory.AiPromptbausteinPrompt.MergeWithEntitys(prompts2, originale);
|
||||
|
||||
DAOFactory.GenericDAO.Update(originale);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void DeleteAiPromptbausteinFolder(Dictionary<long, long> oid2version)
|
||||
{
|
||||
var originale = DAOFactory.GenericDAO.LoadByIDs<AiPromptbausteinFolder>(oid2version.Select(e => e.Key));
|
||||
originale.DoForEach(or => MapperFactory.AiPromptbausteinFolder.ConcurrencyCheck(oid2version[or.Oid.Value], or));
|
||||
|
||||
|
||||
DAOFactory.GenericDAO.SetActivationType(originale, BS.Shared.ActivationTypeId.Deleted);
|
||||
}
|
||||
private void delete_folder_rec(AiPromptbausteinFolder folder)
|
||||
{
|
||||
foreach (var sub_folder in folder.SubFolders)
|
||||
{
|
||||
delete_folder_rec(sub_folder);
|
||||
}
|
||||
|
||||
DAOFactory.GenericDAO.SetActivationType(folder, BS.Shared.ActivationTypeId.Deleted);
|
||||
}
|
||||
|
||||
public void DeleteAiPromptbausteinPrompt(Dictionary<long, long> oid2version)
|
||||
{
|
||||
var originale = DAOFactory.GenericDAO.LoadByIDs<AiPromptbausteinPrompt>(oid2version.Select(e => e.Key));
|
||||
originale.DoForEach(or => MapperFactory.AiPromptbausteinPrompt.ConcurrencyCheck(oid2version[or.Oid.Value], or));
|
||||
|
||||
DAOFactory.GenericDAO.SetActivationType(originale, BS.Shared.ActivationTypeId.Deleted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +242,7 @@
|
||||
<Compile Include="DCEntityMapper\AiConversationDC_AiConversation.cs" />
|
||||
<Compile Include="DCEntityMapper\AiConfigDC_AiConfig.cs" />
|
||||
<Compile Include="DCEntityMapper\AiModelDC_AiModel.cs" />
|
||||
<Compile Include="DCEntityMapper\AiPromptbausteinFolderDC_AiPromptbausteinFolder.cs" />
|
||||
<Compile Include="DCEntityMapper\AiPromptbausteinPromptDC_AiPromptbausteinPrompt.cs" />
|
||||
<Compile Include="DCEntityMapper\AiPromptbausteinTreeDC_AiPromptbaustein.cs" />
|
||||
<Compile Include="DCEntityMapper\AiPromptbausteinTreeDC_AiPromptbausteinTree.cs" />
|
||||
|
||||
@@ -112,6 +112,41 @@ namespace BeWo.Service.ServiceContracts.Enhanced
|
||||
[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineRemove)]
|
||||
void DeleteAiPromptbausteine(Dictionary<long, long> oid2version);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineView)]
|
||||
IEnumerable<AiPromptbausteinFolderDC> GetAiPromptbausteinFolder(AiActionType aiActionType);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineAdd)]
|
||||
IEnumerable<AiPromptbausteinFolderDC> InsertAiPromptbausteinFolder(IEnumerable<AiPromptbausteinFolderDC> folders);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineAdd)]
|
||||
IEnumerable<AiPromptbausteinPromptDC> InsertAiPromptbausteinPrompt(IEnumerable<AiPromptbausteinPromptDC> prompts);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineEdit)]
|
||||
IEnumerable<AiPromptbausteinFolderDC> UpdateAiPromptbausteinFolder(IEnumerable<AiPromptbausteinFolderDC> folders);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineEdit)]
|
||||
IEnumerable<AiPromptbausteinPromptDC> UpdateAiPromptbausteinPrompt(IEnumerable<AiPromptbausteinPromptDC> prompts);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineRemove)]
|
||||
void DeleteAiPromptbausteinFolder(Dictionary<long, long> oid2version);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineRemove)]
|
||||
void DeleteAiPromptbausteinPrompt(Dictionary<long, long> oid2version);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequireWcfAuthorization(UserRightType.AiModulePromptbausteineView)]
|
||||
|
||||
@@ -7,6 +7,7 @@ using BS.Shared;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel;
|
||||
|
||||
@@ -80,6 +81,27 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
|
||||
public void DeleteAiPromptbausteine(Dictionary<long, long> oid2version)
|
||||
=> GetAiPromptbausteineService().DeleteAiPromptbausteine(oid2version);
|
||||
|
||||
public IEnumerable<AiPromptbausteinFolderDC> GetAiPromptbausteinFolder(AiActionType aiActionType)
|
||||
=> GetAiPromptbausteineService().GetAiPromptbausteinFolder(aiActionType);
|
||||
|
||||
public IEnumerable<AiPromptbausteinFolderDC> InsertAiPromptbausteinFolder(IEnumerable<AiPromptbausteinFolderDC> folders)
|
||||
=> GetAiPromptbausteineService().InsertAiPromptbausteinFolder(folders);
|
||||
|
||||
public IEnumerable<AiPromptbausteinPromptDC> InsertAiPromptbausteinPrompt(IEnumerable<AiPromptbausteinPromptDC> prompts)
|
||||
=> GetAiPromptbausteineService().InsertAiPromptbausteinPrompt(prompts);
|
||||
|
||||
public IEnumerable<AiPromptbausteinFolderDC> UpdateAiPromptbausteinFolder(IEnumerable<AiPromptbausteinFolderDC> folders)
|
||||
=> GetAiPromptbausteineService().UpdateAiPromptbausteinFolder(folders);
|
||||
|
||||
public IEnumerable<AiPromptbausteinPromptDC> UpdateAiPromptbausteinPrompt(IEnumerable<AiPromptbausteinPromptDC> prompts)
|
||||
=> GetAiPromptbausteineService().UpdateAiPromptbausteinPrompt(prompts);
|
||||
|
||||
public void DeleteAiPromptbausteinFolder(Dictionary<long, long> oid2version)
|
||||
=> GetAiPromptbausteineService().DeleteAiPromptbausteinFolder(oid2version);
|
||||
|
||||
public void DeleteAiPromptbausteinPrompt(Dictionary<long, long> oid2version)
|
||||
=> GetAiPromptbausteineService().DeleteAiPromptbausteinPrompt(oid2version);
|
||||
|
||||
private AiPromptbausteineService GetAiPromptbausteineService()
|
||||
{
|
||||
return new AiPromptbausteineService();
|
||||
|
||||
@@ -194,7 +194,8 @@ namespace BS.Shared
|
||||
Person2Team = 184,
|
||||
AiPromptbaustein = 185,
|
||||
AiPromptbausteinTree = 186,
|
||||
AiPromptbausteinPrompt = 187
|
||||
AiPromptbausteinPrompt = 187,
|
||||
AiPromptbausteinFolder = 188
|
||||
}
|
||||
|
||||
public enum SystemEntryID
|
||||
|
||||
@@ -20,8 +20,10 @@ namespace BS.Shared.DataContracts
|
||||
[DataMember] public List<AiPromptbausteinFolderDC> SubFolders { get; set; }
|
||||
[DataMember] public List<AiPromptbausteinPromptDC> SubPrompts { get; set; }
|
||||
|
||||
[DataMember] public bool CanAdd { get; set; }
|
||||
[DataMember] public bool CanAddFolder { get; set; }
|
||||
[DataMember] public bool CanAddPrompt { get; set; }
|
||||
[DataMember] public bool CanEdit { get; set; }
|
||||
[DataMember] public bool IsNewFeature { get; set; }
|
||||
}
|
||||
|
||||
public static class PredefinedAiPromptbausteinFolders
|
||||
@@ -46,7 +48,7 @@ namespace BS.Shared.DataContracts
|
||||
};
|
||||
}
|
||||
|
||||
private static AiPromptbausteinFolderDC CreateOwnBibNode(AiActionType aiActionType)
|
||||
public static AiPromptbausteinFolderDC CreateOwnBibNode(AiActionType aiActionType)
|
||||
{
|
||||
return new AiPromptbausteinFolderDC()
|
||||
{
|
||||
@@ -58,12 +60,12 @@ namespace BS.Shared.DataContracts
|
||||
SubPrompts = new List<AiPromptbausteinPromptDC>(),
|
||||
Title = AiPromptbausteineTexts.OwnBibNodeTitle,
|
||||
Version = 1,
|
||||
CanAdd = true,
|
||||
CanAddFolder = true,
|
||||
IsExpanded = true,
|
||||
};
|
||||
}
|
||||
|
||||
private static AiPromptbausteinFolderDC CreateSharedBibNode(AiActionType aiActionType)
|
||||
public static AiPromptbausteinFolderDC CreateSharedBibNode(AiActionType aiActionType)
|
||||
{
|
||||
return new AiPromptbausteinFolderDC()
|
||||
{
|
||||
@@ -76,10 +78,11 @@ namespace BS.Shared.DataContracts
|
||||
Title = AiPromptbausteineTexts.SharedBibNodeTitle,
|
||||
Version = 1,
|
||||
IsExpanded = true,
|
||||
IsNewFeature =true
|
||||
};
|
||||
}
|
||||
|
||||
private static AiPromptbausteinFolderDC CreatePublicBibNode(AiActionType aiActionType)
|
||||
public static AiPromptbausteinFolderDC CreatePublicBibNode(AiActionType aiActionType)
|
||||
{
|
||||
return new AiPromptbausteinFolderDC()
|
||||
{
|
||||
@@ -92,6 +95,7 @@ namespace BS.Shared.DataContracts
|
||||
Title = AiPromptbausteineTexts.PublicBibNodeTitle,
|
||||
Version = 1,
|
||||
IsExpanded = true,
|
||||
IsNewFeature = true
|
||||
};
|
||||
}
|
||||
|
||||
@@ -107,7 +111,8 @@ namespace BS.Shared.DataContracts
|
||||
SubPrompts = new List<AiPromptbausteinPromptDC>(),
|
||||
Title = "Beispiel Ordner",
|
||||
Version = 1,
|
||||
CanAdd = true,
|
||||
CanAddFolder = true,
|
||||
CanAddPrompt = true,
|
||||
CanEdit = true
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user