diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj
index d1312fc20..a7daf05ef 100644
--- a/BeWo/BeWo.csproj
+++ b/BeWo/BeWo.csproj
@@ -123,6 +123,9 @@
AiPromptbausteinView.xaml
+
+ AiPromptbausteinView2.xaml
+
RtfEditView.xaml
@@ -146,6 +149,10 @@
MSBuild:Compile
Designer
+
+ Designer
+ MSBuild:Compile
+
MSBuild:Compile
Designer
diff --git a/BeWo/ServiceProxy/GeneratedAiEnhancedService.cs b/BeWo/ServiceProxy/GeneratedAiEnhancedService.cs
index 23821adab..7af20fdc8 100644
--- a/BeWo/ServiceProxy/GeneratedAiEnhancedService.cs
+++ b/BeWo/ServiceProxy/GeneratedAiEnhancedService.cs
@@ -55,6 +55,22 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/SendNewMessage", ReplyAction="http://tempuri.org/IAiEnhancedService/SendNewMessageResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/SendNewMessageBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
System.Collections.Generic.List SendNewMessage(long conversation, string message);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteine", ReplyAction="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteineResponse")]
+ [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteineBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
+ System.Collections.Generic.List GetAiPromptbausteine();
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/CreateAiPromptbausteine", ReplyAction="http://tempuri.org/IAiEnhancedService/CreateAiPromptbausteineResponse")]
+ [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/CreateAiPromptbausteineBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
+ System.Collections.Generic.List CreateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDC);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteine", ReplyAction="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteineResponse")]
+ [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/UpdateAiPromptbausteineBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
+ System.Collections.Generic.Dictionary UpdateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDCs);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteine", ReplyAction="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteineResponse")]
+ [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/DeleteAiPromptbausteineBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
+ void DeleteAiPromptbausteine(System.Collections.Generic.Dictionary oid2version);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
@@ -140,5 +156,25 @@ namespace BeWo.ServiceProxy
{
return base.Channel.SendNewMessage(conversation, message);
}
+
+ public System.Collections.Generic.List GetAiPromptbausteine()
+ {
+ return base.Channel.GetAiPromptbausteine();
+ }
+
+ public System.Collections.Generic.List CreateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDC)
+ {
+ return base.Channel.CreateAiPromptbausteine(aiPromptbausteinDC);
+ }
+
+ public System.Collections.Generic.Dictionary UpdateAiPromptbausteine(System.Collections.Generic.List aiPromptbausteinDCs)
+ {
+ return base.Channel.UpdateAiPromptbausteine(aiPromptbausteinDCs);
+ }
+
+ public void DeleteAiPromptbausteine(System.Collections.Generic.Dictionary oid2version)
+ {
+ base.Channel.DeleteAiPromptbausteine(oid2version);
+ }
}
}
diff --git a/BeWo/View/Detail/AI/AiPromptbausteinView.xaml b/BeWo/View/Detail/AI/AiPromptbausteinView.xaml
index 057c86901..5af88263b 100644
--- a/BeWo/View/Detail/AI/AiPromptbausteinView.xaml
+++ b/BeWo/View/Detail/AI/AiPromptbausteinView.xaml
@@ -183,7 +183,7 @@
AcceptsReturn="True"
AcceptsTab="True"
EditMode="InplaceActive"
- IsEnabled="{Binding Path=DataContext.RowData.Row, Converter={StaticResource IsOnlyForEmployeeRightsConverter}, RelativeSource={RelativeSource TemplatedParent}}"
+ IsEnabled="{Binding Path=DataContext.RowData.Row, Converter={StaticResource IsOnlyForEmployeeRightsConverter2}, RelativeSource={RelativeSource TemplatedParent}}"
SelectAllOnGotFocus="False"
SelectAllOnMouseUp="False"
Text="{Binding Path=DataContext.RowData.Row.Text, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
diff --git a/BeWo/View/Detail/AI/AiPromptbausteinView.xaml.cs b/BeWo/View/Detail/AI/AiPromptbausteinView.xaml.cs
index d5ee6c7c1..1f7b05219 100644
--- a/BeWo/View/Detail/AI/AiPromptbausteinView.xaml.cs
+++ b/BeWo/View/Detail/AI/AiPromptbausteinView.xaml.cs
@@ -38,13 +38,13 @@ namespace BeWo.View.Detail
private readonly bool _IsInAdministrationView;
- public AiPromptbausteinView(AiPromptbausteinListVM pViewModel, bool pIsInAdministrationView = false)
+ public AiPromptbausteinView(AiPromptbausteinListVM viewmodel, bool pIsInAdministrationView = false)
{
InitializeComponent();
_IsInAdministrationView = pIsInAdministrationView;
- ViewModel = pViewModel;
+ ViewModel = viewmodel;
}
protected override void Save()
diff --git a/BeWo/View/Detail/AI/AiPromptbausteinView2.xaml b/BeWo/View/Detail/AI/AiPromptbausteinView2.xaml
new file mode 100644
index 000000000..7749f96f7
--- /dev/null
+++ b/BeWo/View/Detail/AI/AiPromptbausteinView2.xaml
@@ -0,0 +1,241 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BeWo/View/Detail/AI/AiPromptbausteinView2.xaml.cs b/BeWo/View/Detail/AI/AiPromptbausteinView2.xaml.cs
new file mode 100644
index 000000000..5f2d633f4
--- /dev/null
+++ b/BeWo/View/Detail/AI/AiPromptbausteinView2.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace BeWo.View.Detail.AI
+{
+ ///
+ /// Interaktionslogik für AiPromptbausteinView2.xaml
+ ///
+ public partial class AiPromptbausteinView2 : BeWoView
+ {
+ public AiPromptbausteinView2()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BeWo/View/Master/AdministrationView.xaml b/BeWo/View/Master/AdministrationView.xaml
index c586ced41..0dec4e45a 100644
--- a/BeWo/View/Master/AdministrationView.xaml
+++ b/BeWo/View/Master/AdministrationView.xaml
@@ -318,6 +318,13 @@
Header="{markup:Translate Ressource}"
Selected="Tabitem_Selected" />
+
+
+
AddView(TabitemSozioTherapie, new SoziotherapieSettingsView(this)));
return;
+ case nameof(TabitemAiPromptbausteine):
+ VMFactory.CreateAiPromptbausteinListAsync(
+ r => this.Dispatch(() => AddView(TabitemAiPromptbausteine, new AiPromptbausteinView(r))));
+ return;
}
throw new ArgumentOutOfRangeException(nameof(accordionItem));
diff --git a/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs b/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs
index 31fad02ad..ac386576c 100644
--- a/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs
+++ b/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs
@@ -41,10 +41,10 @@ namespace BeWo.ViewModel.ListViewModel
public AbstractDCListMapperVM(IEnumerable pDCList)
{
- _DCBackup = pDCList != null ? pDCList.ToObservableCollection() : new ObservableCollection();
+ _DCBackup = pDCList != null ? pDCList.ToObservableCollection() : new ObservableCollection();
- _DCBackup.CollectionChanged += (s, e) => _VMList.AddRange(e.NewItems.Cast().Select(CreateVM));
- }
+ _DCBackup.CollectionChanged += (s, e) => _VMList.AddRange(e.NewItems.Cast().Select(CreateVM));
+ }
public AbstractDCListMapperVM() : this(null) { }
@@ -156,6 +156,14 @@ namespace BeWo.ViewModel.ListViewModel
}
}
+ public virtual void Update(IEnumerable pDCList)
+ {
+ // Zwingt _VMList, damit es die Anweisung im Konstruktor nicht knallt
+ var t = VMList;
+
+ DCBackup.AddRange(pDCList);
+ }
+
public virtual VMType AddNewVMToList()
{
VMList.Add(NewVM);
diff --git a/BeWo/ViewModel/ListViewModel/AiPromptbausteinListVM.cs b/BeWo/ViewModel/ListViewModel/AiPromptbausteinListVM.cs
index c60560d29..bb506756d 100644
--- a/BeWo/ViewModel/ListViewModel/AiPromptbausteinListVM.cs
+++ b/BeWo/ViewModel/ListViewModel/AiPromptbausteinListVM.cs
@@ -12,7 +12,7 @@ namespace BeWo.ViewModel.ListViewModel
private readonly List _PossibleAiPromptbausteinParents;
- public AiPromptbausteinListVM(IEnumerable pDataContracts) : base(pDataContracts)
+ public AiPromptbausteinListVM(IEnumerable pDataContracts = null) : base(pDataContracts)
{
_PossibleAiPromptbausteinParents = VMList.Where(w => w.IsParent).ToList();
}
diff --git a/BeWo/ViewModel/VMFactory.cs b/BeWo/ViewModel/VMFactory.cs
index 7fc0aa1e4..e3269f8a6 100644
--- a/BeWo/ViewModel/VMFactory.cs
+++ b/BeWo/ViewModel/VMFactory.cs
@@ -932,5 +932,14 @@ namespace BeWo.ViewModel
callback(new AiConversationListVM(cb));
});
}
+
+ internal static void CreateAiPromptbausteinListAsync(Action rtn_viewmodel)
+ {
+ ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiPromptbausteine(), cb =>
+ {
+ var list = new AiPromptbausteinListVM(cb);
+ rtn_viewmodel(list);
+ });
+ }
}
}
\ No newline at end of file
diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs
index 937ed0e19..4b3abdf5f 100644
--- a/Data/Access/SearchDAO.cs
+++ b/Data/Access/SearchDAO.cs
@@ -29,3557 +29,3559 @@ using Resource = BeWo.Data.Entities.Resource;
namespace BeWo.Data.Access
{
- public class SearchDAO : AbstractBaseDAO
- {
- private static readonly Regex RecurrenceIdRegex = new Regex("(Id=\\\"[a-z0-9-]+\\\")");
-
- public IEnumerable FindValueListEntry(ValueListEntryType pType)
- {
- return CreateCriteria().Add(Restrictions.Eq(ValueListEntry.PropertyName_Type, pType)).AddOrder(Order.Asc(ValueListEntry.PropertyName_Value)).List();
- }
-
- public IEnumerable FindValueListEntries(List pTypes)
- {
- return CreateCriteria().Add(Restrictions.In(ValueListEntry.PropertyName_Type, pTypes)).AddOrder(Order.Asc(ValueListEntry.PropertyName_Value)).List();
- }
-
- public virtual IEnumerable FindEmployee(string pFirstName, string pLastName, string pPersonnelNumber)
- {
- return CreateCriteria()
- .Add(Restrictions.Like(Employee.PropertyName_PersonnelNumber, pPersonnelNumber, MatchMode.Anywhere))
- .CreateCriteria(Employee.PropertyName_Person, JoinType.InnerJoin)
- .Add(Restrictions.Like(Person.PropertyName_FirstName, pFirstName, MatchMode.Anywhere))
- .Add(Restrictions.Like(Person.PropertyName_LastName, pLastName, MatchMode.Anywhere))
- .List();
- }
-
- public virtual Employee FindEmployeeByFullname(string pFullname)
- {
- var q = Session.CreateSQLQuery(Format("SELECT e.oid FROM employee e join Person p on e.personoid = p.oid WHERE CONCAT_WS(' ', FirstName, LastName) LIKE '%{0}%' AND Type = 1", pFullname));
- var x = q.List();
-
- return x.Count > 0 ? DAOFactory.GenericDAO.GetByID(x.Last()) : null;
- }
-
- public virtual IEnumerable FindWohnheim(string pwohnheimName, string pWohnheimStrasse, string pWohnheimPlz)
- {
- return CreateCriteria()
- .Add(Restrictions.Like(Wohnheim.PropertyName_WohnheimName, pwohnheimName, MatchMode.Anywhere))
- .CreateCriteria(Wohnheim.PropertyName_Wohnheim, JoinType.InnerJoin)
- .Add(Restrictions.Like(Wohnheim.PropertyName_Strasse, pWohnheimStrasse, MatchMode.Anywhere))
- .Add(Restrictions.Like(Wohnheim.PropertyName_PlZ, pWohnheimPlz, MatchMode.Anywhere))
- .List();
- }
-
- public virtual Wohnheim FindWohnheimByFullname(string pWohnheimName)
- {
- var q = Session.CreateSQLQuery(Format("SELECT Oid FROM Wohnheim WHERE CONCAT_WS(' ', WohnheimName) LIKE '%{0}%'", pWohnheimName));
- var x = q.List();
-
- return x.Count > 0 ? DAOFactory.GenericDAO.GetByID(x.First()) : null;
- }
-
- public virtual IList FindWohneinheitBelegungForCustomer(long customerOid, DateTime datum)
- {
- var criteria = CreateCriteriaIsActive()
- .Add(Restrictions.Eq(WohneinheitBelegung.PropertyName_Customer, customerOid))
- .Add(
- Restrictions.Or(
- Restrictions.And(
- Restrictions.Le(WohneinheitBelegung.PropertyName_StartDate, datum.Date),
- Restrictions.Ge(WohneinheitBelegung.PropertyName_EndDate, datum.Date)
- ),
- Restrictions.And(
- Restrictions.Le(WohneinheitBelegung.PropertyName_StartDate, datum.Date),
- Restrictions.IsNull(WohneinheitBelegung.PropertyName_EndDate)
- )
- )
- );
-
- return criteria.List();
- }
-
- public virtual IEnumerable FindCustomer(string pFirstName, string pLastName, string pReferenceNumber)
- {
- return CreateCriteria()
- .Add(Restrictions.Like(Customer.PropertyName_ReferenceNumber, pReferenceNumber, MatchMode.Anywhere))
- .CreateCriteria(Customer.PropertyName_Person, JoinType.InnerJoin)
- .Add(Restrictions.Like(Person.PropertyName_FirstName, pFirstName, MatchMode.Anywhere))
- .Add(Restrictions.Like(Person.PropertyName_LastName, pLastName, MatchMode.Anywhere))
- .List();
- }
-
- public virtual IList FindCustomer(string pFirstName, string pLastName, DateTime pBirthDate)
- {
- return CreateCriteriaIsActiveOrArchived()
- .CreateCriteria(Customer.PropertyName_Person, JoinType.InnerJoin)
- .Add(Restrictions.Eq(Person.PropertyName_FirstName, pFirstName))
- .Add(Restrictions.Eq(Person.PropertyName_LastName, pLastName))
- .Add(Restrictions.Eq(Person.PropertyName_DateOfBirth, pBirthDate))
- .List();
- }
-
- public virtual IList GetAllDienstEintraege(long wOid, DateTime start, DateTime end)
- {
- var c = CreateCriteria()
- .Add(Restrictions.Eq("WohnheimOid", wOid))
- .Add(Restrictions.Between("Datum", start, end))
- .Add(Restrictions.Eq("IsActive", ActivationTypeId.Active));
-
- return c.List();
- }
-
- public virtual IList GetEmployeeForWohnheim(long wOid)
- {
- var c = CreateCriteria()
- .Add(Restrictions.Eq("WohnheimOid", wOid));
-
- return c.List();
- }
-
- public virtual IEnumerable FindPerson(string pFirstName, string pLastName, DateTime? pDateOfBirth, PersonType? pPersonType)
- {
- var lCriteria = CreateCriteria()
- .Add(Restrictions.Like(Person.PropertyName_FirstName, pFirstName, MatchMode.Anywhere))
- .Add(Restrictions.Like(Person.PropertyName_LastName, pLastName, MatchMode.Anywhere));
- if(pDateOfBirth != null)
- lCriteria.Add(Restrictions.Eq(Person.PropertyName_DateOfBirth, pDateOfBirth));
- if(pPersonType != null)
- lCriteria.Add(Restrictions.Eq(Person.PropertyName_Type, pPersonType));
-
- return lCriteria.List();
- }
-
- public virtual IEnumerable FindOrganisation(string pName, bool pOnlyCostBearer)
- {
- var lCriteria = CreateCriteria()
- .Add(Restrictions.Like(Organisation.PropertyName_Name, pName, MatchMode.Anywhere));
-
- if(pOnlyCostBearer)
- lCriteria.Add(Restrictions.IsNotNull(Organisation.PropertyName_CostBearer));
-
- return lCriteria.List();
- }
-
- public virtual IEnumerable FindTeams(string pTeamName, string pLeaderFirstName, string pLeaderLastName)
- {
- return CreateCriteria()
- .Add(Restrictions.Like(Team.PropertyName_Name, pTeamName, MatchMode.Anywhere))
- .CreateCriteria(Team.PropertyName_Leader, JoinType.InnerJoin)
- .CreateCriteria(Employee.PropertyName_Person)
- .Add(Restrictions.Like(Person.PropertyName_FirstName, pLeaderFirstName, MatchMode.Anywhere))
- .Add(Restrictions.Like(Person.PropertyName_LastName, pLeaderLastName, MatchMode.Anywhere))
- .List();
- }
-
- public virtual IList FindTeamsOfEmployee(long employeeOid)
- {
- return CreateCriteriaIsActiveOrArchived()
- .CreateCriteria(Team.PropertyName_MemberList, JoinType.InnerJoin)
- .Add(Restrictions.Eq(BeWoEntityBase.PropertyName_Oid, employeeOid))
- .List();
- }
-
- public virtual IEnumerable FindLeadingTeams(long employeeOid)
- {
- return CreateCriteriaIsActiveOrArchived()
- .CreateCriteria(Team.PropertyName_Leader, JoinType.InnerJoin)
- .Add(Restrictions.Eq(BeWoEntityBase.PropertyName_Oid, employeeOid))
- .List();
- }
-
- public virtual IList FindAllActiveTeamsOfEmployee(long employeeOid)
- {
- return CreateCriteriaIsActive()
- .CreateAlias(Team.PropertyName_MemberList, "m", JoinType.InnerJoin)
- .CreateAlias(Team.PropertyName_Leader, "l", JoinType.InnerJoin)
- .Add(Restrictions.Disjunction()
- .Add(Restrictions.Eq("m." + BeWoEntityBase.PropertyName_Oid, employeeOid))
- .Add(Restrictions.Eq("l." + BeWoEntityBase.PropertyName_Oid, employeeOid)))
- .List().Distinct().ToList();
-
- }
-
- public virtual IList FindCustomerOfTeam(long teamOid)
- {
- return CreateCriteriaIsActiveOrArchived()
- .CreateCriteria(Customer.PropertyName_Team2CustomerList, JoinType.InnerJoin)
- .Add(Restrictions.Eq(Team2Customer.PropertyName_TeamOid, teamOid))
- .List();
- }
-
- public IEnumerable FindBookings(long pResourceOid, DateTime pSpanStart, DateTime pSpanEnd)
- {
- var lResult = CreateCriteria()
- .CreateAlias(ResourceBookingSequence.PropertyName_Resource, "r")
- .CreateAlias(ResourceBookingSequence.PropertyName_Details, "d")
- .Add(Restrictions.Eq("r." + BeWoEntityBase.PropertyName_Oid, pResourceOid))
- .Add(Restrictions.Eq("d." + ResourceBooking.PropertyName_SequencePosition, 0))
- .Add(Restrictions.Disjunction()
- .Add(Restrictions.Between("d." + ResourceBooking.PropertyName_Start, pSpanStart, pSpanEnd))
- .Add(Restrictions.Between(ResourceBookingSequence.PropertyName_SequenceEnd, pSpanStart, pSpanEnd))
- .Add(Restrictions.Conjunction()
- .Add(Restrictions.Le("d." + ResourceBooking.PropertyName_Start, pSpanStart))
- .Add(Restrictions.Ge(ResourceBookingSequence.PropertyName_SequenceEnd, pSpanEnd))
- )
- )
- .List();
-
- return lResult;
- }
-
- public IEnumerable FindBookings(DateTime pSpanStart, DateTime pSpanEnd)
- {
- var lResult = CreateCriteria()
- .CreateAlias(ResourceBookingSequence.PropertyName_Details, "d")
- .Add(Restrictions.Eq("d." + ResourceBooking.PropertyName_SequencePosition, 0))
- .Add(Restrictions.Disjunction()
- .Add(Restrictions.Between("d." + ResourceBooking.PropertyName_Start, pSpanStart, pSpanEnd))
- .Add(Restrictions.Between(ResourceBookingSequence.PropertyName_SequenceEnd, pSpanStart, pSpanEnd))
- .Add(Restrictions.Conjunction()
- .Add(Restrictions.Le("d." + ResourceBooking.PropertyName_Start, pSpanStart))
- .Add(Restrictions.Ge(ResourceBookingSequence.PropertyName_SequenceEnd, pSpanEnd))
- )
- )
- .List();
-
- return lResult;
- }
-
- public void RemoveServiceRecordsFromAppointments(IEnumerable enumerable)
- {
- throw new NotImplementedException();
- }
-
- public List FindServiceRecords(long? pEmployeeOid, long? pCostBearer2SupportConceptOid)
- {
- var c = CreateCriteria()
- .CreateAlias(ServiceRecord.PropertyName_Employee, "e", JoinType.InnerJoin);
-
- if(pCostBearer2SupportConceptOid.HasValue)
- {
- c = c.CreateAlias(ServiceRecord.PropertyName_SupportConcept, "sc", JoinType.InnerJoin)
- .CreateAlias("sc." + SupportConcept.PropertyName_CostBearer2SupportConceptList, "c2s", JoinType.InnerJoin);
- }
-
- if(pEmployeeOid.HasValue)
- c = c.Add(Restrictions.Eq("e." + BeWoEntityBase.PropertyName_Oid, pEmployeeOid));
- if(pCostBearer2SupportConceptOid.HasValue)
- c = c.Add(Restrictions.Eq("c2s." + BeWoEntityBase.PropertyName_Oid, pCostBearer2SupportConceptOid));
-
- return c.List().ToList();
- }
-
- public List FindServiceRecordsForSupportConcept(long pSupportConceptOid)
- {
- var c = CreateCriteria()
- .CreateAlias(ServiceRecord.PropertyName_SupportConcept, "sc", JoinType.InnerJoin);
-
- c = c.Add(Restrictions.Eq("sc." + BeWoEntityBase.PropertyName_Oid, pSupportConceptOid));
- return c.List().ToList();
- }
-
- public List FindServiceRecords(long? supportConceptOid, long? costBearer2SupportConceptOid, long? serviceCategoryOid, DateTime? start, DateTime? end)
- {
- var c = CreateCriteria()
- .CreateAlias(ServiceRecord.PropertyName_Employee, "e", JoinType.InnerJoin);
-
- if(supportConceptOid.HasValue)
- {
- c = c.CreateAlias(ServiceRecord.PropertyName_SupportConcept, "sc", JoinType.InnerJoin);
- }
-
- if(serviceCategoryOid.HasValue)
- {
- c = c.CreateAlias(ServiceRecord.PropertyName_ServiceDescription, "sd", JoinType.InnerJoin)
- .CreateAlias("sd." + ServiceDescription.PropertyName_ServiceCategory, "cat", JoinType.InnerJoin);
- }
-
- if(supportConceptOid.HasValue)
- {
- c = c.Add(Restrictions.Eq("sc." + BeWoEntityBase.PropertyName_Oid, supportConceptOid));
- }
-
- if(costBearer2SupportConceptOid.HasValue)
- {
- c = c.Add(Restrictions.Eq(ServiceRecord.PropertyName_CostBearer2SupportConceptOid, costBearer2SupportConceptOid));
- }
-
- if(serviceCategoryOid.HasValue)
- {
- c = c.Add(Restrictions.Eq("cat." + BeWoEntityBase.PropertyName_Oid, serviceCategoryOid));
- }
-
- if(start.HasValue && end.HasValue)
- {
- c.Add(Restrictions.Between(ServiceRecord.PropertyName_Start, start, end));
- }
- //{
- // c = c.CreateAlias(ServiceRecord.PropertyName_SupportConcept, "sc", JoinType.InnerJoin)
- // .CreateAlias("sc." + SupportConcept.PropertyName_CostBearer2SupportConceptList, "c2s", JoinType.InnerJoin);
- //}
-
- //if (pEmployeeOid.HasValue)
- // c = c.Add(Restrictions.Eq("e." + BeWoEntityBase.PropertyName_Oid, pEmployeeOid));
-
-
- return c.List().ToList();
- }
-
- public IList FindSupportConceptApprovalPeriod2Employees(Employee emp)
- {
- var c = CreateCriteria()
- .Add(Restrictions.Eq(SupportConceptApprovalPeriod2Employee.PropertyName_Employee, emp));
- return c.List().ToList();
- }
-
- public IList FindSupportConceptApprovalPeriod2Employees(SupportConceptApprovalPeriod scap)
- {
- var c = CreateCriteria()
- .Add(Restrictions.Eq(SupportConceptApprovalPeriod2Employee.PropertyName_SupportConceptApprovalPeriod, scap));
- return c.List().ToList();
- }
-
- public IEnumerable FindServiceRecordsInSpan(long pCostBearer2SupportConceptOid, DateTimeSpan period)
- {
- var criteria = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecord.PropertyName_CostBearer2SupportConceptOid, pCostBearer2SupportConceptOid));
-
- if(period != null)
- criteria =
- criteria.Add(
- Restrictions.Or(
- Restrictions.Between(ServiceRecord.PropertyName_Start, period.StartDateTime, period.EndDateTime),
- Restrictions.Between(ServiceRecord.PropertyName_End, period.StartDateTime, period.EndDateTime)));
-
- return criteria.List().ToList();
- }
-
- public IEnumerable FindServiceRecordHistory(long serviceRecordOid)
- {
- var criteria = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecordHistory.PropertyName_ServiceRecordOid, serviceRecordOid));
-
-
- return criteria.List().ToList();
- }
-
- public IEnumerable FindEmployeeServiceRecordsWithoutCustomer(long pEmployeeOid, long? days)
- {
-
- var c = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecord.PropertyName_EmployeeOid, pEmployeeOid))
- .Add(Restrictions.IsNull(ServiceRecord.PropertyName_CostBearer2SupportConceptOid));
-
- if(days.HasValue)
- {
- var minDate = DateTime.Now.Date.AddDays(-1 * days.Value);
- c.Add(Restrictions.Ge(ServiceRecord.PropertyName_Start, minDate));
- }
-
- return c.List().ToList();
- }
-
- public IEnumerable FindEmployeeServiceRecordsWithoutCustomerInSpan(long pEmployeeOid, DateTimeSpan period)
- {
- var criteria = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecord.PropertyName_EmployeeOid, pEmployeeOid))
- .Add(Restrictions.IsNull(ServiceRecord.PropertyName_CostBearer2SupportConceptOid));
-
- if(period != null)
- {
- criteria =
- criteria.Add(
- Restrictions.Or(
- Restrictions.Between(ServiceRecord.PropertyName_Start, period.StartDateTime, period.EndDateTime),
- Restrictions.Between(ServiceRecord.PropertyName_End, period.StartDateTime, period.EndDateTime)));
- }
-
- return criteria.List().ToList();
- }
-
- public IEnumerable FindEmployeeServiceRecordsWithoutCustomerWithStartEndDate(long pEmployeeOid, DateTime start, DateTime ende)
- {
-
- var c = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecord.PropertyName_EmployeeOid, pEmployeeOid))
- .Add(Restrictions.IsNull(ServiceRecord.PropertyName_CostBearer2SupportConceptOid));
-
- var max = ende.Date.AddDays(1);
-
- c.Add(Restrictions.Ge(ServiceRecord.PropertyName_Start, start.Date))
- .Add(Restrictions.Lt(ServiceRecord.PropertyName_Start, max.Date));
-
-
- return c.List().ToList();
- }
-
- public IList FindEmployeeServiceRecords(long pEmployeeOid, DateTimeSpan pSpan, long? customerOid, ServiceRecordTypeId? srTypeFilter)
- {
- var lCriteria = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecord.PropertyName_EmployeeOid, pEmployeeOid));
-
- if(pSpan != null)
- lCriteria.Add(Restrictions.Between(ServiceRecord.PropertyName_Start, pSpan.StartDateTime, pSpan.EndDateTime));
- if(customerOid != null)
- lCriteria.Add(Restrictions.Eq(ServiceRecord.PropertyName_CustomerOid, customerOid.Value));
- if(srTypeFilter.HasValue)
- {
- lCriteria.Add(Restrictions.Eq(ServiceRecord.PropertyName_ServiceRecordType, srTypeFilter.Value));
- }
-
- var result = lCriteria.List().ToList();
-
- return result;
- }
-
- public IList FindCustomerServiceRecords(long customerOid)
- {
- var lCriteria = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecord.PropertyName_CustomerOid, customerOid));
-
- return lCriteria.List();
- }
-
- public IList FindCustomerServiceRecords(long customerOid, DateTimeSpan pSpan, long? employeeOid, ServiceRecordTypeId? srTypeFilter, bool includeEndDateInSearch)
- {
- var lCriteria = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecord.PropertyName_CustomerOid, customerOid));
-
-
- if(includeEndDateInSearch)
- {
- var orCriteria = Restrictions.Or(
- Restrictions.Between(ServiceRecord.PropertyName_Start, pSpan.StartDateTime, pSpan.EndDateTime),
- Restrictions.Between(ServiceRecord.PropertyName_End, pSpan.StartDateTime, pSpan.EndDateTime));
-
- orCriteria = Restrictions.Or(orCriteria,
- Restrictions.And(
- Restrictions.Le(ServiceRecord.PropertyName_Start, pSpan.EndDateTime),
- Restrictions.Ge(ServiceRecord.PropertyName_End, pSpan.StartDateTime)));
-
-
- lCriteria.Add(orCriteria);
- }
- else
- {
- lCriteria.Add(Restrictions.Between(ServiceRecord.PropertyName_Start, pSpan.StartDateTime, pSpan.EndDateTime));
- }
-
-
-
- if(employeeOid != null)
- lCriteria.Add(Restrictions.Eq(ServiceRecord.PropertyName_EmployeeOid, employeeOid.Value));
- if(srTypeFilter.HasValue)
- {
- lCriteria.Add(Restrictions.Eq(ServiceRecord.PropertyName_ServiceRecordType, srTypeFilter.Value));
- }
-
- return lCriteria.List();
- }
-
- public IEnumerable FindServiceRecordsInSpan(DateTimeSpan pSpan, ServiceRecordTypeId? srTypeFilter)
- {
- var lCriteria = CreateCriteria()
- .Add(Restrictions.Between(ServiceRecord.PropertyName_Start, pSpan.StartDateTime, pSpan.EndDateTime));
- if(srTypeFilter.HasValue)
- {
- lCriteria.Add(Restrictions.Eq(ServiceRecord.PropertyName_ServiceRecordType, srTypeFilter.Value));
- }
-
- return lCriteria.List().ToList();
- }
-
- public IEnumerable FindUnassignedAccountingTransactions()
- {
- return CreateCriteria()
- .Add(Restrictions.IsNull(AccountingTransaction.PropertyName_CostBearer2SupportConcept))
- .List().ToList();
- }
-
- public IEnumerable FindSupportConcept(
- string pCustomerFirstName,
- string pCustomerLastName,
- string pCustomerReferenceNumber,
- DateTime? pFrom,
- DateTime? pTill)
- {
- var lCriteria = CreateCriteria();
-
- //if (pFrom != null)
- // lCriteria.Add(Expression.Ge(SupportConcept.PropertyName_Start, pFrom));
- //if (pTill != null)
- // lCriteria.Add(Expression.Le(SupportConcept.PropertyName_End, pTill));
-
- lCriteria = lCriteria.CreateCriteria(SupportConcept.PropertyName_Customer, JoinType.InnerJoin);
-
- if(!IsNullOrEmpty(pCustomerReferenceNumber))
- lCriteria.Add(Restrictions.Eq(Customer.PropertyName_ReferenceNumber, pCustomerReferenceNumber));
-
- if(!BS.Shared.Core.Utils.AreAllNullOrEmpty(pCustomerFirstName, pCustomerLastName))
- lCriteria.CreateCriteria(Customer.PropertyName_Person)
- .Add(Restrictions.Like(Person.PropertyName_FirstName, pCustomerFirstName, MatchMode.Anywhere))
- .Add(Restrictions.Like(Person.PropertyName_LastName, pCustomerLastName, MatchMode.Anywhere));
-
- return lCriteria.List();
- }
-
- public TwoFactorCode GetLastTwoFactorCode(string loginName, string bCryptPassword)
- {
- return CreateCriteriaIsActive()
- .Add(Expression.Eq("LoginName", loginName))
- .Add(Expression.Eq("Password", bCryptPassword))
- .AddOrder(new Order("Oid", false)).List().FirstOrDefault();
- }
-
- public IEnumerable FindCurrentSupportConcepts()
- {
- return CreateCriteriaIsActive()
- //.Add(Expression.Ge(SupportConcept.PropertyName_End, DateTime.Now))
- .List();
- }
-
- public IEnumerable FindSupportConceptsInSpan(DateTimeSpan pSpan)
- {
- return CreateCriteriaIsActive()
- //.Add(Expression.Disjunction()
- // .Add(Expression.Between(SupportConcept.PropertyName_Start, pSpan.StartDateTime, pSpan.EndDateTime))
- // .Add(Expression.Between(SupportConcept.PropertyName_End, pSpan.StartDateTime, pSpan.EndDateTime))
- // .Add(Expression.Conjunction()
- // .Add(Expression.Le(SupportConcept.PropertyName_Start, pSpan.StartDateTime))
- // .Add(Expression.Ge(SupportConcept.PropertyName_End, pSpan.EndDateTime))
- // )
- // )
- .List();
- }
-
- public IEnumerable FindExpiringSupportConcepts(long? employeeOid, DateTime minDate, DateTime expiredUntil)
- {
- var c = CreateCriteriaIsActive();
- if(employeeOid == null)
- {
- return c
- .CreateCriteria(SupportConcept.PropertyName_CostBearer2SupportConceptList, JoinType.InnerJoin)
- .Add(Restrictions.Between(CostBearer2SupportConcept.PropertyName_ApprovedEndDate, minDate, expiredUntil))
- .List();
- }
-
- return c
- .CreateAlias(SupportConcept.PropertyName_CostBearer2SupportConceptList, "cb2sc", JoinType.InnerJoin)
- .CreateAlias(SupportConcept.PropertyName_Customer, "c", JoinType.InnerJoin)
- .CreateAlias("c.Employee2CustomerList", "e2c", JoinType.InnerJoin)
- .Add(Restrictions.Eq("e2c." + Employee2Customer.PropertyName_EmployeeOid, employeeOid.Value))
- .Add(Restrictions.Or(Restrictions.Or(
- Restrictions.Between("cb2sc." + CostBearer2SupportConcept.PropertyName_ApprovedEndDate, minDate, expiredUntil),
- Restrictions.Between("cb2sc." + CostBearer2SupportConcept.PropertyName_RequestedEndDate, minDate, expiredUntil)),
- Restrictions.And(Restrictions.IsNotNull("c.TerminationDate"), Restrictions.Between("c.TerminationDate", minDate, expiredUntil))))
- .List().Distinct().ToList();
- }
-
- public IEnumerable FindSupportConceptsWithConferenceDate(long? employeeOid, DateTime conferenceDateUntil)
- {
- var c = CreateCriteriaIsActive();
- if(employeeOid == null)
- {
- return c
- .Add(Restrictions.Between(SupportConcept.PropertyName_ConferenceDate, DateTime.Now, conferenceDateUntil))
- .List();
- }
-
- return c
- .CreateAlias(SupportConcept.PropertyName_Customer, "c", JoinType.InnerJoin)
- .CreateAlias("c.Employee2CustomerList", "e2c", JoinType.InnerJoin)
- .Add(Restrictions.Between(SupportConcept.PropertyName_ConferenceDate, DateTime.Now.Date, conferenceDateUntil))
- .Add(Restrictions.Eq("e2c." + Employee2Customer.PropertyName_EmployeeOid, employeeOid.Value))
- .List().Distinct().ToList();
- }
-
- public ApplicationUser FindUserForEmployee(Employee employee)
- {
- return CreateCriteriaIsActive()
- .Add(Restrictions.Eq(ApplicationUser.PropertyName_Employee, employee))
- .List().FirstOrDefault();
- }
-
- public IEnumerable FindPersonsHavingBirthday(DateTime birthdayUntil)
- {
- var ts = birthdayUntil.Subtract(DateTime.Now);
- var days = ts.Days + 1;
-
- return CreateCriteriaIsActive()
- .Add(Expression.Sql(new SqlString("dayofyear(CAST(CONCAT(Year(CURDATE()), '-', Month(" + Person.PropertyName_DateOfBirth + "), '-', Day(" + Person.PropertyName_DateOfBirth + ")) AS DATE )) between dayofyear(CURDATE()) -4 and dayofyear(CURDATE()) + " + days)))
- .List();
- }
-
- public IEnumerable FindLastLogins(string loginName, int maxResults)
- {
- return CreateCriteria()
- .Add(Restrictions.Eq(Login.PropertyName_LoginName, loginName))
- .AddOrder(Order.Desc("Oid"))
- .SetMaxResults(maxResults)
- .List();
- }
-
- public IEnumerable FindQuery(QueryType pType)
- {
- return CreateCriteria().Add(Restrictions.Eq(Query.PropertyName_Type, pType))
- .List().ToList();
- }
-
- public IList FindAccoutingTransactions(DateTimeSpan pSpan)
- {
- var lCriteria = CreateCriteriaIsActive();
-
- if(pSpan != null)
- lCriteria.Add(Restrictions.Between(AccountingTransaction.PropertyName_BookingDate, pSpan.StartDateTime, pSpan.EndDateTime));
-
- var test = lCriteria.List();
-
- return test;
- }
-
- public IEnumerable FindAccoutingTransactions(DateTimeSpan pSpan, long? pSupportConceptOid, long? pSupportConceptCostBearerRelOid)
- {
- var lCriteria = CreateCriteriaIsActive()
- .CreateAlias(AccountingTransaction.PropertyName_CostBearer2SupportConcept, "cb2sc", JoinType.LeftOuterJoin);
-
- if(pSpan != null)
- lCriteria.Add(Restrictions.Between(AccountingTransaction.PropertyName_BookingDate, pSpan.StartDateTime, pSpan.EndDateTime));
-
- if(pSupportConceptCostBearerRelOid != null)
- lCriteria.Add(Restrictions.Eq("cb2sc." + BeWoEntityBase.PropertyName_Oid, pSupportConceptCostBearerRelOid));
-
- if(pSupportConceptOid != null)
- {
- lCriteria.CreateCriteria("cb2sc." + CostBearer2SupportConcept.PropertyName_SupportConcept)
- .Add(Restrictions.Eq(BeWoEntityBase.PropertyName_Oid, pSupportConceptOid));
- }
-
- var test = lCriteria.List();
-
- return test;
- }
-
- public IList FindSettingsByValuePart(SettingsType pType, string pValuePart)
- {
- return CreateCriteria()
- .Add(Restrictions.Eq(Settings.PropertyName_Type, pType))
- .Add(Restrictions.Like(Settings.PropertyName_Value, pValuePart, MatchMode.Anywhere))
- .List();
- }
-
- public IList FindFileAttachments(TableID pObjTid, long pObjOid)
- {
- return CreateCriteriaIsActive()
- .Add(Restrictions.Eq(FileAttachment.PropertyName_ObjectOid, pObjOid))
- .Add(Restrictions.Eq(FileAttachment.PropertyName_ObjectTid, pObjTid))
- .List();
- }
-
- public IEnumerable FindFileAttachmentInfos(TableID pObjTid, long pObjOid)
- {
- return CreateCriteriaIsActive()
- .Add(Restrictions.Eq(FileAttachmentInfo.PropertyName_ObjectOid, pObjOid))
- .Add(Restrictions.Eq(FileAttachmentInfo.PropertyName_ObjectTid, pObjTid))
- .List();
- }
-
- public IList FindBeWoFolders(TableID pObjTid, long pObjOid)
- {
- var c = CreateCriteriaIsActive()
- .Add(Restrictions.Eq(BeWoFolder.PropertyName_ObjectTid, pObjTid));
-
- if(pObjOid > 0)
- {
- c.Add(Restrictions.Eq(BeWoFolder.PropertyName_ObjectOid, pObjOid));
- }
-
- return c.List();
- }
-
- //public IList FindAllActiveApprovedLVRSupportConcepts()
- //{
- // return CreateCriteriaIsActive()
- // .CreateCriteria(SupportConcept.PropertyName_CostBearer2SupportConceptList, JoinType.InnerJoin)
- // .Add(Expression.Eq(CostBearer2SupportConcept.PropertyName_Status, CostBearer2SupportConceptStatus.Approved))
- // .CreateCriteria(CostBearer2SupportConcept.PropertyName_CostBearer, JoinType.InnerJoin)
- // .Add(Expression.Eq(CostBearer.PropertyName_SystemEntryID, SystemEntryID.CostBearerLVR))
- // .List();
- //}
-
- public IList FindAllActiveApprovedSupportConcepts()
- {
- return CreateCriteriaIsActive()
- .CreateCriteria(SupportConcept.PropertyName_CostBearer2SupportConceptList, JoinType.InnerJoin)
- .Add(Restrictions.Eq(CostBearer2SupportConcept.PropertyName_Status, CostBearer2SupportConceptStatus.Approved))
-
- .List().Distinct().ToList();
- }
-
- public Employee FindEmployeeWithPersonOid(long pPersonOid)
- {
- var person = DAOFactory.GenericDAO.LoadByID(pPersonOid);
- if(person != null)
- {
- return CreateCriteria()
- .Add(Restrictions.Eq(Employee.PropertyName_Person, person)).UniqueResult();
- }
-
- return null;
- }
-
- public Customer FindCustomerWithPersonOid(long pPersonOid)
- {
- var person = DAOFactory.GenericDAO.LoadByID(pPersonOid);
- if(person != null)
- {
- return CreateCriteria()
- .Add(Restrictions.Eq(Customer.PropertyName_Person, person)).UniqueResult();
- }
-
- return null;
- }
-
- public IList FindCustomersWithPersonOids(IEnumerable pPersonOid)
- {
-
- return CreateCriteriaIsActive()
- .CreateAlias(Customer.PropertyName_Person, "p", JoinType.InnerJoin)
- .Add(Restrictions.In("p." + BeWoEntityBase.PropertyName_Oid, pPersonOid.ToArray()))
- .List();
- }
-
- public IList GetActivePersonsWithType(PersonType type)
- {
- return CreateCriteriaIsActive()
- .Add(Restrictions.Eq(Person.PropertyName_Type, type))
- .List();
- }
-
- public IEnumerable GetAllActiveCustomersWithSupportConceptData()
- {
- return CreateCriteriaIsActiveOrArchived()
- .CreateAlias(Customer.PropertyName_SupportConcepts, "sc", JoinType.LeftOuterJoin)
- .CreateCriteria("sc." + SupportConcept.PropertyName_CostBearer2SupportConceptList, JoinType.LeftOuterJoin)
- .Add(Restrictions.Eq("sc." + SupportConcept.PropertyName_IsActive, ActivationTypeId.Active))
- .List();
- }
-
- public IEnumerable GetAllActiveCustomersWithAddress()
- {
- return CreateCriteriaIsActive()
- .CreateCriteria(Customer.PropertyName_Person, JoinType.LeftOuterJoin)
- .CreateCriteria(Person.PropertyName_Address, JoinType.LeftOuterJoin)
- .List();
- }
-
- public IEnumerable GetAllCustomersWithRelatedEmployee()
- {
- return CreateCriteria()
- .CreateAlias("Person", "cp", JoinType.InnerJoin)
- .CreateAlias("cp." + Person.PropertyName_Address, "a", JoinType.LeftOuterJoin)
- .CreateAlias("Employee2CustomerList", "e2c", JoinType.LeftOuterJoin)
- .CreateAlias("e2c." + Employee2Customer.PropertyName_Employee, "e", JoinType.LeftOuterJoin)
- .CreateCriteria("e2c." + Employee2Customer.PropertyName_ValueList, JoinType.LeftOuterJoin)
- .CreateCriteria("e." + Employee.PropertyName_Person, JoinType.LeftOuterJoin)
- .List();
- }
-
- public IList FindServiceRecordsDetailsForLastDays(long costbearer2SupportConcept, long? days)
- {
- var c = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecord.PropertyName_CostBearer2SupportConceptOid, costbearer2SupportConcept));
-
- if(days.HasValue)
- {
-
- var minDate = DateTime.Now.Date.AddDays(-1 * days.Value);
- c.Add(Restrictions.Ge(ServiceRecord.PropertyName_Start, minDate));
- }
-
- return c.CreateAlias(ServiceRecord.PropertyName_ValueList, "vl", JoinType.LeftOuterJoin)
- .CreateAlias(ServiceRecord.PropertyName_ServiceDescription, "sd", JoinType.InnerJoin)
- .CreateAlias("sd." + ServiceDescription.PropertyName_ServiceCategory, "sc", JoinType.InnerJoin)
- .CreateAlias(ServiceRecord.PropertyName_Employee, "e", JoinType.InnerJoin)
- .CreateCriteria("e." + Employee.PropertyName_Person, JoinType.InnerJoin)
- .List().Distinct().ToList();
- }
-
- public IList FindServiceRecordsDetailsForLastDaysWithStartEndDate(long costbearer2SupportConcept, DateTime start, DateTime ende)
- {
- var c = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecord.PropertyName_CostBearer2SupportConceptOid, costbearer2SupportConcept));
-
-
- var max = ende.Date.AddDays(1);
-
- c.Add(Restrictions.Ge(ServiceRecord.PropertyName_Start, start.Date))
- .Add(Restrictions.Lt(ServiceRecord.PropertyName_Start, max.Date));
-
- var result = c.CreateAlias(ServiceRecord.PropertyName_ValueList, "vl", JoinType.LeftOuterJoin)
- .CreateAlias(ServiceRecord.PropertyName_ServiceDescription, "sd", JoinType.InnerJoin)
- .CreateAlias("sd." + ServiceDescription.PropertyName_ServiceCategory, "sc", JoinType.InnerJoin)
- .CreateAlias(ServiceRecord.PropertyName_Employee, "e", JoinType.InnerJoin)
- .CreateCriteria("e." + Employee.PropertyName_Person, JoinType.InnerJoin)
- .List();
-
- return result;
- }
-
- public IList FindServiceRecordsDetailWithServiceInfo(long costbearer2SupportConcept)
- {
- var c = CreateCriteria()
- .Add(Restrictions.Eq(ServiceRecord.PropertyName_CostBearer2SupportConceptOid, costbearer2SupportConcept));
-
-
- return c.CreateAlias(ServiceRecord.PropertyName_ServiceDescription, "sd", JoinType.InnerJoin)
- .CreateAlias("sd." + ServiceDescription.PropertyName_ServiceCategory, "sc", JoinType.InnerJoin)
- .List();
- }
-
- public Customer FindCustomerWithServiceRecordsWithDetail(long pCustomerOid)
- {
- return CreateCriteria()
- .Add(Restrictions.Eq(BeWoEntityBase.PropertyName_Oid, pCustomerOid))
- .CreateAlias(Customer.PropertyName_ServiceRecordList, "sr", JoinType.InnerJoin)
- .CreateCriteria("sr." + ServiceRecord.PropertyName_ValueList, JoinType.LeftOuterJoin)
- .CreateAlias("sr." + ServiceRecord.PropertyName_ServiceDescription, "sd", JoinType.InnerJoin)
- .CreateCriteria("sd." + ServiceDescription.PropertyName_ServiceCategory, JoinType.InnerJoin)
- .CreateAlias("sr." + ServiceRecord.PropertyName_CostBearer2SupportConcept, "c2s", JoinType.InnerJoin)
- .CreateCriteria("c2s." + CostBearer2SupportConcept.PropertyName_SupportConcept, JoinType.InnerJoin)
- .CreateAlias("c2s." + CostBearer2SupportConcept.PropertyName_CostBearer, "cb", JoinType.InnerJoin)
- .CreateAlias("cb." + CostBearer.PropertyName_Organisation, "org", JoinType.InnerJoin)
- .UniqueResult();
- }
-
- public ServiceRecordGroup FindServiceRecordGroup(long pGroupOid)
- {
- return CreateCriteria()
- .Add(Restrictions.Eq(BeWoEntityBase.PropertyName_Oid, pGroupOid))
- .CreateCriteria(ServiceRecordGroup.PropertyName_ServiceRecordList, JoinType.InnerJoin)
- .UniqueResult();
- }
-
- public IEnumerable GetAllActiveAndArchivedSupportConceptsCompact()
- {
- return CreateCriteria()
- .Add(Restrictions.Or(Restrictions.Eq(BeWoEntityBase.PropertyName_IsActive, ActivationTypeId.Active), Restrictions.Eq(BeWoEntityBase.PropertyName_IsActive, ActivationTypeId.Archived)))
- .CreateAlias(SupportConcept.PropertyName_CostBearer2SupportConceptList, "cb2sc", JoinType.LeftOuterJoin)
- .CreateAlias(SupportConcept.PropertyName_Customer, "c", JoinType.InnerJoin)
- .CreateAlias("c." + Customer.PropertyName_Person, "p", JoinType.InnerJoin)
- .CreateAlias("p." + Person.PropertyName_Address, "a", JoinType.LeftOuterJoin)
- .CreateAlias("c." + Customer.PropertyName_Employee2CustomerList, "e2c", JoinType.LeftOuterJoin)
- .List();
- }
-
- public IEnumerable GetAllSupportConceptsCompact()
- {
- return CreateCriteria()
- .CreateAlias(SupportConcept.PropertyName_CostBearer2SupportConceptList, "cb2sc", JoinType.LeftOuterJoin)
- .CreateAlias(SupportConcept.PropertyName_Customer, "c", JoinType.InnerJoin)
- .CreateAlias("c." + Customer.PropertyName_Person, "p", JoinType.InnerJoin)
- .CreateAlias("p." + Person.PropertyName_Address, "a", JoinType.LeftOuterJoin)
- .CreateAlias("c." + Customer.PropertyName_Employee2CustomerList, "e2c", JoinType.LeftOuterJoin)
- .List();
- }
-
- public IList GetAllActiveAndArchivedListedSupportConceptsCompact()
- {
- return Session.CreateCriteria()
- .List();
- }
-
- public IList GetAllActiveAndArchivedListedSupportConceptsCompact(List oids)
- {
- return Session.CreateCriteria()
- .Add(Restrictions.In("SupportConceptOid", oids))
- .List();
- }
-
- public IList GetAllCustomerWithServiceRecordsInSpan(DateTimeSpan pSpan)
- {
- return CreateCriteria()
- .CreateCriteria(Customer.PropertyName_ServiceRecordList, JoinType.InnerJoin)
- .Add(Restrictions.Between(ServiceRecord.PropertyName_Start, pSpan.StartDateTime, pSpan.EndDateTime))
- .List();
- }
-
- public IEnumerable GetAllAccountingTransactionsWithDetails()
- {
- return CreateCriteria()
- .AddOrder(Order.Desc(AccountingTransaction.PropertyName_BookingDate))
- .CreateAlias(AccountingTransaction.PropertyName_CostBearer2SupportConcept, "cb2sc", JoinType.LeftOuterJoin)
- .CreateCriteria("cb2sc." + CostBearer2SupportConcept.PropertyName_CostBearer, JoinType.LeftOuterJoin)
- .CreateCriteria(CostBearer.PropertyName_Organisation, JoinType.LeftOuterJoin)
- .CreateCriteria("cb2sc." + CostBearer2SupportConcept.PropertyName_SupportConcept, JoinType.LeftOuterJoin)
- .CreateCriteria(SupportConcept.PropertyName_Customer, JoinType.LeftOuterJoin)
- .CreateCriteria(Customer.PropertyName_Person, JoinType.LeftOuterJoin)
- .List();
- }
-
- public IEnumerable FindAccountingTransactionsWithImportNotice(String notice)
- {
- return CreateCriteria()
- .Add(Restrictions.Eq(AccountingTransaction.PropertyName_ImportNotice, notice)).List();
- }
-
- public IEnumerable GetAllActiveAndArchivedSupportConcepts()
- {
- return CreateCriteria()
- .Add(Restrictions.Or(Restrictions.Eq(BeWoEntityBase.PropertyName_IsActive, ActivationTypeId.Active), Restrictions.Eq(BeWoEntityBase.PropertyName_IsActive, ActivationTypeId.Archived)))
- .CreateAlias(SupportConcept.PropertyName_CostBearer2SupportConceptList, "cb2sc", JoinType.InnerJoin)
- .CreateAlias("cb2sc." + CostBearer2SupportConcept.PropertyName_CostBearer, "cb", JoinType.InnerJoin)
- .CreateAlias("cb." + CostBearer.PropertyName_Organisation, "org", JoinType.InnerJoin)
- .CreateAlias(SupportConcept.PropertyName_Customer, "c", JoinType.InnerJoin)
- .CreateAlias("c." + Customer.PropertyName_Person, "p", JoinType.InnerJoin)
- .List();
- }
-
- public IEnumerable GetAllActiveAndArchivedCustomersWithRelatedEmployee()
- {
- return CreateCriteria()
- .Add(Restrictions.Or(Restrictions.Eq(BeWoEntityBase.PropertyName_IsActive, ActivationTypeId.Active), Restrictions.Eq(BeWoEntityBase.PropertyName_IsActive, ActivationTypeId.Archived)))
- .CreateAlias(Customer.PropertyName_Person, "cp", JoinType.InnerJoin)
- .CreateAlias("cp." + Person.PropertyName_Address, "a", JoinType.LeftOuterJoin)
- .CreateAlias(Customer.PropertyName_Employee2CustomerList, "e2c", JoinType.LeftOuterJoin)
- .CreateAlias("e2c." + Employee2Customer.PropertyName_Employee, "e", JoinType.LeftOuterJoin)
- .CreateCriteria("e2c." + Employee2Customer.PropertyName_ValueList, JoinType.LeftOuterJoin)
- .CreateCriteria("e." + Employee.PropertyName_Person, JoinType.LeftOuterJoin)
- .List();
- }
-
- public IEnumerable GetSettlementInvoiceBySupportConceptOid(long supportConceptOid)
- {
- return CreateCriteriaIsActive()
- .CreateAlias(SettlementInvoice.PropertyName_InvoiceBase, "ib", JoinType.InnerJoin)
- .Add(Restrictions.Eq("ib." + InvoiceBase.PropertyName_SupportConceptOid, supportConceptOid))
- .List();
- }
-
- public IList GetSettlementInvoiceByCostBearer2SupportConceptOid(long costBearer2SupportConceptOid)
- {
- return CreateCriteriaIsActive()
- .CreateAlias(SettlementInvoice.PropertyName_InvoiceBase, "ib", JoinType.InnerJoin)
- .Add(Restrictions.Eq("ib." + InvoiceBase.PropertyName_CostBearer2SupportConceptOid, costBearer2SupportConceptOid))
- .List();
- }
-
- public IEnumerable