Perseh Import weitergemacht

This commit is contained in:
Christian
2024-09-18 21:50:00 +02:00
parent 720f2e853f
commit 8158782bc3
7 changed files with 664 additions and 287 deletions

View File

@@ -13,6 +13,24 @@
Height="Auto" Width="Auto" HorizontalAlignment="Stretch"
mc:Ignorable="d" VerticalAlignment="Stretch" Focusable="True">
<view:BeWoView.Resources>
<Style x:Key="TextBoxStyle1" BasedOn="{x:Null}" TargetType="{x:Type TextBox}">
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border x:Name="bg" BorderThickness="0" BorderBrush="Black">
<ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderThickness" TargetName="bg" Value="1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--<Expander x:Name="ExpanderTemplate" IsExpanded="True">
<Expander.Header>
<Grid>
@@ -78,8 +96,9 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBox Margin="0,0,0,0" Cursor="Arrow" Background="Transparent" Height="21" Padding="0,3,0,0" VerticalAlignment="Center" BorderThickness="0"
IsReadOnly="True" Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Focusable="False" FontSize="13">
<TextBox Style="{StaticResource TextBoxStyle1}" Margin="0,0,0,0" Background="Transparent" MinHeight="21" Padding="0,3,0,0" VerticalAlignment="Center" BorderThickness="0"
IsReadOnly="False" Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Focusable="True" FontSize="13" TextWrapping="Wrap" AcceptsReturn="True">
</TextBox>
</Grid>

View File

@@ -144,13 +144,14 @@ namespace BeWo.View
foreach (var item in ziele)
{
GoalTreeItem ziel = new GoalTreeItem { Name = item.ZielName, Notice = item.ZielBeschreibung };
GoalTreeItem ziel = new GoalTreeItem { Name = item.ZielName, Notice = item.ZielBeschreibung, HilfeplanImportZiel = item };
GoalTreeItem parent = treeItems.Where(i => i.Name == item.Bereich).FirstOrDefault();
if (parent == null)
{
parent = new GoalTreeItem();
parent.Name = item.Bereich;
treeItems.Add(parent);
}
parent.Children.Add(ziel);
@@ -230,14 +231,76 @@ namespace BeWo.View
private void btnSave_Click(object sender, RoutedEventArgs e)
{
ViewModel.SupportConceptOid = _SupportConceptOid;
var result = ServiceFacade.DoCustomerServiceSync(s => s.ImportSupportConcept(ViewModel));
if (!String.IsNullOrEmpty(result))
if (ViewModel != null)
{
MessageBox.Show(result, "Import", MessageBoxButton.OK, MessageBoxImage.Information);
UpdateViewModel();
var result = ServiceFacade.DoCustomerServiceSync(s => s.ImportSupportConcept(ViewModel));
if (!String.IsNullOrEmpty(result))
{
MessageBox.Show(result, "Import", MessageBoxButton.OK, MessageBoxImage.Information);
}
CloseButtonClicked?.Invoke();
}
CloseButtonClicked?.Invoke();
}
private void UpdateViewModel()
{
ViewModel.SupportConceptOid = _SupportConceptOid;
//Update Stammdaten
foreach (var item in PanelGruppen.Children)
{
var exp = item as Expander;
if (exp != null)
{
var g = exp.Content as Grid;
foreach (var gridItem in g.Children)
{
var txt = gridItem as System.Windows.Controls.TextBox;
if (txt != null && txt.Tag != null)
{
var ii = txt.Tag as HilfeplanImportItemDC;
if (ii != null)
{
ii.Content = txt.Text;
}
}
}
}
}
//Update Ziele
foreach (var item in treeview_Goals.ItemsSource)
{
var gti = item as GoalTreeItem;
if (gti != null)
{
UpdateGoalWithChildren(null, gti);
}
}
}
private void UpdateGoalWithChildren(GoalTreeItem parent, GoalTreeItem gti)
{
if (gti.HilfeplanImportZiel != null)
{
if (parent != null)
{
gti.HilfeplanImportZiel.Bereich = parent.Name;
}
gti.HilfeplanImportZiel.ZielName = gti.Name;
}
if (gti.Children != null)
{
foreach (var c in gti.Children)
{
UpdateGoalWithChildren(gti, c);
}
}
}
private void btnClose_Click(object sender, RoutedEventArgs e)
@@ -258,6 +321,8 @@ namespace BeWo.View
public String Notice { get; set; }
public HilfeplanImportZielDC HilfeplanImportZiel { get; set; }
public BindingList<GoalTreeItem> Children
{
get => _Children ?? (_Children = new BindingList<GoalTreeItem>());

View File

@@ -1070,6 +1070,7 @@ CREATE TABLE `twofactorcode` (
UsedDate DATETIME DEFAULT NULL
) ENGINE=InnoDB;
ALTER TABLE `servicerecordhistory`
ADD INDEX `cb2scIdx` (`CostBearer2SupportConceptOid` ASC);
@@ -1077,3 +1078,153 @@ ADD INDEX `cb2scIdx` (`CostBearer2SupportConceptOid` ASC);
ALTER TABLE `vorlagentabelle`
ADD COLUMN `ImageName` VARCHAR(128) NULL AFTER `Tabellenname`;
CREATE TABLE `wohneinheit` (
`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,
`WohnheimOid` bigint NOT NULL,
`Wohnname` varchar(256) NOT NULL,
`Zimmername` varchar(256) DEFAULT NULL,
`Miete` decimal(18,10) DEFAULT NULL,
`Heizung` decimal(18,10) DEFAULT NULL,
`Strom` decimal(18,10) DEFAULT NULL,
`Betriebskosten` decimal(18,10) DEFAULT NULL,
`SonstigeKosten` decimal(18,10) DEFAULT NULL,
`Kaution` decimal(18,10) DEFAULT NULL,
`QM` decimal(18,10) DEFAULT NULL,
`Baujahr` int DEFAULT NULL,
`Mobilierung` varchar(1024) DEFAULT NULL,
`Zusatznotiz` varchar(1024) DEFAULT NULL,
`Stock` varchar(256) DEFAULT NULL,
PRIMARY KEY (`Oid`),
CONSTRAINT `FK_WOHNEINHEIT_WOHNHEIM` FOREIGN KEY (`WohnheimOid`) REFERENCES `Wohnheim` (`Oid`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
CREATE TABLE `wohneinheitbelegung` (
`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,
`WohneinheitOid` bigint NOT NULL,
`CustomerOid` bigint NOT NULL,
`StartDate` datetime NOT NULL,
`EndDate` datetime DEFAULT NULL,
`Kommentar` varchar(1024) DEFAULT NULL,
PRIMARY KEY (`Oid`),
CONSTRAINT `FK_WOHNEINHEITBELEGUNG_WOHNEINHEIT` FOREIGN KEY (`WohneinheitOid`) REFERENCES `Wohneinheit` (`Oid`),
CONSTRAINT `FK_WOHNEINHEITBELEGUNG_CUSTOMER` FOREIGN KEY (`CustomerOid`) REFERENCES `Customer` (`Oid`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
CREATE TABLE `CustomerFalldaten` (
`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,
`EigenesAktenzeichen` varchar(256),
`Auftragseingang` datetime DEFAULT NULL,
`AuftragsherkunftValueListEntryOid` bigint DEFAULT NULL,
`VermittlungsgrundlageValueListEntryOid` bigint DEFAULT NULL,
`Tagessatze` decimal(18,10) DEFAULT NULL,
`Tagessatzhohe` decimal(18,10) DEFAULT NULL,
`HoheDerGeldstrafe` decimal(18,10) DEFAULT NULL,
`ZuLeistendeArbeitsstunden` decimal(18,10) DEFAULT NULL,
`Hinweis` varchar(256),
`Termin` datetime DEFAULT NULL,
`FalldatenBearbeitungsstatus` int DEFAULT NULL,
`Auftragsruckgabe` varchar(256),
`Verlauf` varchar(256),
`AbgeleisteteStunden` decimal(18,10) DEFAULT NULL,
`ErsparteHafttage` decimal(18,10) DEFAULT NULL,
`GeleisteteRatenzahlung` decimal(18,10) DEFAULT NULL,
`Bemerkung` varchar(256),
`GeleisteteEinmalzahlung` decimal(18,10) DEFAULT NULL,
`GrundArbeitsunfahig` tinyint,
`GrundSuchtproblem` tinyint,
`GrundPsychischeProbleme` tinyint,
`GrundKeineMotivation` tinyint,
`GrundInHaft` tinyint,
`GrundUnbekannt` tinyint,
`GrundKeinKontakt` tinyint,
`GrundNichtAngetreten` tinyint,
`GrundAbbruchDerTatigkeit` tinyint,
`GrundWiderruf` tinyint,
`Grund459StPO` tinyint,
`GrundAusbleibenDerZahlung` tinyint,
`BesonderheitMehrfacheBeauftragung` tinyint,
`BesonderheitMehrfacheVermittlung` tinyint,
`BesonderheitVermittlungAusHaft` tinyint,
`BesonderheitDurchBGBWAufgesucht` tinyint,
PRIMARY KEY (`Oid`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
ALTER TABLE `customer`
ADD COLUMN `CustomerFalldatenOid` BIGINT NULL DEFAULT NULL AFTER `VersichertenStatus`;
ALTER TABLE `customer`
ADD INDEX `FK_CUSTOMERFALLDATEN_idx` (`CustomerFalldatenOid` ASC) VISIBLE;
ALTER TABLE `customer`
ADD CONSTRAINT `FK_CUSTOMERFALLDATEN`
FOREIGN KEY (`CustomerFalldatenOid`)
REFERENCES `customerfalldaten` (`Oid`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
ALTER TABLE `customerfalldaten`
ADD INDEX `FK_AUFTRAGSHERKUNFT_idx` (`AuftragsherkunftValueListEntryOid` ASC) VISIBLE,
ADD INDEX `FK_VERMITTLUNGSGRUNDLAGE_idx` (`VermittlungsgrundlageValueListEntryOid` ASC) VISIBLE;
ALTER TABLE `customerfalldaten`
ADD CONSTRAINT `FK_AUFTRAGSHERKUNFT`
FOREIGN KEY (`AuftragsherkunftValueListEntryOid`)
REFERENCES `valuelistentry` (`Oid`)
ON DELETE RESTRICT
ON UPDATE RESTRICT,
ADD CONSTRAINT `FK_VERMITTLUNGSGRUNDLAGE`
FOREIGN KEY (`VermittlungsgrundlageValueListEntryOid`)
REFERENCES `valuelistentry` (`Oid`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
ALTER TABLE `image`
ADD COLUMN `WohneinheitOid` BIGINT NULL DEFAULT NULL AFTER `PersonOid`;
ALTER TABLE `image`
ADD INDEX `FK_IMAGE_PERSON_idx` (`PersonOid` ASC) VISIBLE,
ADD INDEX `FK_IMAGE_WOHNEINHEIT_idx` (`WohneinheitOid` ASC) VISIBLE;
ALTER TABLE `image`
ADD CONSTRAINT `FK_IMAGE_PERSON`
FOREIGN KEY (`PersonOid`)
REFERENCES `person` (`Oid`)
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `FK_IMAGE_WOHNEINHEIT`
FOREIGN KEY (`WohneinheitOid`)
REFERENCES `wohneinheit` (`Oid`)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE `image`
ADD COLUMN `Filename` VARCHAR(1024) NULL DEFAULT NULL AFTER `SystemEntryID`,
ADD COLUMN `Fullname` VARCHAR(1024) NULL DEFAULT NULL AFTER `Filename`;

View File

@@ -69,6 +69,15 @@ namespace BeWo.Service.Import.Perseh
}
}
//result.Ziele = new List<HilfeplanImportZielDC>();
//result.Ziele.Add(new HilfeplanImportZielDC { Bereich = "Lernen und Wissensanwendung", ZielName = "Ziel 1", ZielBeschreibung = "Herr Sowieso hat eine seinen Bedürfnissen entsprechende und ihn stabilisierende Tagesstruktur mit einer regelmäßigen, genesungsfördernden Beschäftigung(z.B.Ergotherapie) entwickelt." });
//result.Ziele.Add(new HilfeplanImportZielDC { Bereich = "Lernen und Wissensanwendung", ZielName = "Ziel 2", ZielBeschreibung = "Herr Sowieso hat Angstbewältigungsstrategien sowie Stabilisierungstechniken erlernt und kann diese in Alltagssituationen anwenden" });
//result.Ziele.Add(new HilfeplanImportZielDC { Bereich = "Allgemeine Aufgaben und Anforderungen", ZielName = "Ziel 1", ZielBeschreibung = "Herr Sowieso hat eine seinen Bedürfnissen entsprechende und ihn stabilisierende Tagesstruktur mit einer regelmäßigen, genesungsfördernden Beschäftigung(z.B.Ergotherapie) entwickelt." });
//result.Ziele.Add(new HilfeplanImportZielDC { Bereich = "Allgemeine Aufgaben und Anforderungen", ZielName = "Ziel 2", ZielBeschreibung = "Herr Sowieso hat Angstbewältigungsstrategien sowie Stabilisierungstechniken erlernt und kann diese in Alltagssituationen anwenden" });
return result;
}
@@ -157,6 +166,7 @@ namespace BeWo.Service.Import.Perseh
if (!IgnoriereZeile(zeile))
{
ziel.ZielName += " " + zeile.Trim();
ziel.ZielBeschreibung = "Beschreibung:\n" + zeile;
}
}

View File

@@ -27,7 +27,7 @@ namespace BeWo.Service.Plugins
{
return false;
}
public virtual List<CompactCustomerDC> GetAllActiveAndArchivedCustomersCompact(long currentEmployeeOid)
{
IEnumerable<Customer> customers = DAOFactory.SearchDAO.GetAllActiveAndArchivedCustomersWithRelatedEmployee();
@@ -45,7 +45,7 @@ namespace BeWo.Service.Plugins
if (!cProcessed.ContainsKey(customer.Oid.Value))
{
CompactCustomerDC dc = CreateCompactCustomerDCWithEmployeeRelation(customer, false, true, currentEmployeeOid, teamOids);
result.Add(dc);
cProcessed.Add(customer.Oid.Value, true);
@@ -54,7 +54,7 @@ namespace BeWo.Service.Plugins
return result;
}
public virtual List<CompactCustomerDC> GetAllActiveCustomersCompact(bool fetchReferenceNumbers, long? currentEmployeeOid)
{
@@ -97,10 +97,10 @@ namespace BeWo.Service.Plugins
user = MapperFactory.UserDC_User.MapToNewDC(SessionFacade.LoggedInUser);
}
if (teamOids.Count == 0)
{
{
foreach (var t in teams)
teamOids.Add(t.TeamOid, t.TeamOid);
}
}
foreach (Customer customer in customers)
{
@@ -110,7 +110,7 @@ namespace BeWo.Service.Plugins
// Alle zugehörigen Teamnamen setzen
if (dc.RelatedTeamOids != null) // Hier muss entweder eine neue Bedingung festgelegt werden oder es muss ganz weg, sonst wird man keine Teamzuordnungen sehen, wenn man selbst in keinem Team ist
{
{
foreach (var oid in dc.RelatedTeamOids)
{
var team = teams.FirstOrDefault(t => t.TeamOid == oid);
@@ -125,7 +125,7 @@ namespace BeWo.Service.Plugins
if (dc.RelatedTeams != null && dc.RelatedTeams.Length > 0)
dc.RelatedTeams = dc.RelatedTeams.Remove(dc.RelatedTeams.Length - 2, 1);
}
result.Add(dc);
cProcessed.Add(customer.Oid.Value, true);
@@ -141,7 +141,7 @@ namespace BeWo.Service.Plugins
var dc = MapperFactory.CustomerDC_Customer.MapToNewDC(DAOFactory.GenericDAO.LoadByID<Customer>(pCustomerOid));
return dc;
}
//public virtual List<CompactCustomerDC> GetAllCustomersCompact(bool fetchReferenceNumbers, long? currentEmployeeOid)
@@ -175,7 +175,7 @@ namespace BeWo.Service.Plugins
protected CompactCustomerDC CreateCompactCustomerDCWithEmployeeRelation(Customer pEntity, bool fetchReferenceNumbers, bool fetchEmployees, long? currentEmployeeOid, Dictionary<long, long> teamOids)
{
var dc = new CompactCustomerDC();
dc.CustomerOid = pEntity.Oid.Value;
@@ -187,7 +187,7 @@ namespace BeWo.Service.Plugins
dc.TerminationDate = pEntity.TerminationDate;
dc.Sex = pEntity.Person.Sex;
dc.AbsenceTimes = MapperFactory.AbsenceTimeDC_AbsenceTime.MapToNewDCs(pEntity.AbsenceTimes);
dc.CustomerAlias = pEntity.CustomerAlias;
dc.CustomerAlias = pEntity.CustomerAlias;
if (pEntity.Person.Address != null)
{
@@ -202,7 +202,7 @@ namespace BeWo.Service.Plugins
}
SetTeamAndEmployeeRelation(dc, currentEmployeeOid, pEntity, teamOids);
if (fetchEmployees)
{
foreach (Employee2Customer e2c in pEntity.Employee2CustomerList)
@@ -287,17 +287,17 @@ namespace BeWo.Service.Plugins
else if (darfAlleDesTeamsSehen)
{
if (dc.Customer.IsRelatedToEmployee || dc.Customer.IsRelatedToTeam)
{
{
result.Add(dc);
}
}
else if (darfAlleEigenenSehen)
{
{
if (dc.IsRelatedToEmployee)
{
{
result.Add(dc);
}
}
}
}
@@ -307,7 +307,7 @@ namespace BeWo.Service.Plugins
}
public virtual List<CompactCustomerDC> GetAllAuthorizedCompactCustomers()
{
{
var user = GetLoggedInUser();
IEnumerable<Customer> customers = DAOFactory.SearchDAO.GetAllActiveAndArchivedCustomersWithRelatedEmployee();
@@ -380,10 +380,10 @@ namespace BeWo.Service.Plugins
var result = new List<CompactPersonDC>();
var alleList = new List<CompactPersonDC>();
bool darfPersonenSehen = false;
bool darfFamilieSehen = false;
if (Core.Utils.UserHasRight(user, UserRightType.PersonView_View))
{
darfPersonenSehen = true;
@@ -392,7 +392,7 @@ namespace BeWo.Service.Plugins
{
darfFamilieSehen = true;
}
IList<Person> persons = DAOFactory.GenericDAO.GetAllActive<Person>().Where(p => p.Type == PersonType.Others).ToList();
@@ -403,23 +403,23 @@ namespace BeWo.Service.Plugins
}
if (darfPersonenSehen && darfFamilieSehen)
{
{
result = alleList;
}
else if (darfPersonenSehen && !darfFamilieSehen)
{
{
result = alleList.Where(p => !p.IsFamilyMember).ToList();
}
}
else if (!darfPersonenSehen && darfFamilieSehen)
{
result = alleList.Where(p => p.IsFamilyMember).ToList();
}
return result.OrderBy(p => p.ToString()).ToList();
}
public virtual List<CompactPersonDC> GetAllPersonsByTypeCompact(PersonType pType)
{
{
var result = new List<CompactPersonDC>();
bool darfFamilieSehen = false;
@@ -444,26 +444,26 @@ namespace BeWo.Service.Plugins
darfKlientenDesTeamsSehen = true;
darfSeineKlientenSehen = true;
}
else if (UserRightHelper.LoggedInUserHasRight(UserRightType.Customer_ViewMyTeams))
{
darfKlientenDesTeamsSehen = true;
else if (UserRightHelper.LoggedInUserHasRight(UserRightType.Customer_ViewMyTeams))
{
darfKlientenDesTeamsSehen = true;
darfSeineKlientenSehen = true;
var dict = CreateTeamOidDict(user.Employee.Oid.Value);
foreach (var oid in dict.Keys)
{
var clist = DAOFactory.SearchDAO.FindCustomerOfTeam(oid);
foreach (var c in clist)
{
foreach (var e2c in c.Employee2CustomerList)
{
if (!e2c.EndDate.HasValue || e2c.EndDate.Value >= DateTime.Now.Date)
{
allowedCustomerOids.Add(e2c.CustomerOid.Value);
}
}
}
}
foreach (var oid in dict.Keys)
{
var clist = DAOFactory.SearchDAO.FindCustomerOfTeam(oid);
foreach (var c in clist)
{
foreach (var e2c in c.Employee2CustomerList)
{
if (!e2c.EndDate.HasValue || e2c.EndDate.Value >= DateTime.Now.Date)
{
allowedCustomerOids.Add(e2c.CustomerOid.Value);
}
}
}
}
foreach (var e2c in user.Employee.Employee2CustomerList)
{
if (!e2c.EndDate.HasValue || e2c.EndDate.Value >= DateTime.Now.Date)
@@ -473,19 +473,19 @@ namespace BeWo.Service.Plugins
}
}
else if (UserRightHelper.LoggedInUserHasRight(UserRightType.Customer_ViewMyCustomers))
{
darfSeineKlientenSehen = true;
foreach (var e2c in user.Employee.Employee2CustomerList)
{
if (!e2c.EndDate.HasValue || e2c.EndDate.Value >= DateTime.Now.Date)
{
allowedCustomerOids.Add(e2c.CustomerOid.Value);
}
}
}
else if (UserRightHelper.LoggedInUserHasRight(UserRightType.Customer_ViewMyCustomers))
{
darfSeineKlientenSehen = true;
foreach (var e2c in user.Employee.Employee2CustomerList)
{
if (!e2c.EndDate.HasValue || e2c.EndDate.Value >= DateTime.Now.Date)
{
allowedCustomerOids.Add(e2c.CustomerOid.Value);
}
}
}
IList<Person> persons = DAOFactory.GenericDAO.GetAll<Person>().Where(p => p.Type == pType).ToList();
IList<Person> persons = DAOFactory.GenericDAO.GetAll<Person>().Where(p => p.Type == pType).ToList();
Dictionary<long, List<CustomerPersonRelationDC>> person2CustomerOidDict = new Dictionary<long, List<CustomerPersonRelationDC>>();
@@ -528,11 +528,11 @@ namespace BeWo.Service.Plugins
{
List<CustomerPersonRelationDC> list = null;
if (person2CustomerOidDict.ContainsKey(person.Oid.Value))
{
{
list = person2CustomerOidDict[person.Oid.Value];
}
}
else
{
{
list = new List<CustomerPersonRelationDC>();
}
@@ -572,40 +572,40 @@ namespace BeWo.Service.Plugins
return result;
}
private bool UserIsAllowedToViewPerson(Person person, List<CustomerPersonRelationDC> person2CustomerList, List<long> allowedCustomerOids, bool darfFamilieSehen, bool darfAlleKlientenSehen, bool darfKlientenDesTeamsSehen, bool darfSeineKlientenSehen)
{
private bool UserIsAllowedToViewPerson(Person person, List<CustomerPersonRelationDC> person2CustomerList, List<long> allowedCustomerOids, bool darfFamilieSehen, bool darfAlleKlientenSehen, bool darfKlientenDesTeamsSehen, bool darfSeineKlientenSehen)
{
if (person.LastName == "Aßmann")
{
{
int test = 0;
}
}
if (darfFamilieSehen && darfAlleKlientenSehen)
{
{
return true;
}
//if (!darfFamilieSehen)
//{
// return person2CustomerList.Count(p => p.IstFamilie) > 0;
//}
if (darfAlleKlientenSehen)
{
return true;
}
if (darfKlientenDesTeamsSehen || darfSeineKlientenSehen)
{
foreach (var p2c in person2CustomerList)
{
if (allowedCustomerOids.Contains(p2c.Customer.CustomerOid))
{
return true;
}
}
}
return false;
}
}
private void SetFamilyMemberStatus(List<CompactPersonDC> result)
//if (!darfFamilieSehen)
//{
// return person2CustomerList.Count(p => p.IstFamilie) > 0;
//}
if (darfAlleKlientenSehen)
{
return true;
}
if (darfKlientenDesTeamsSehen || darfSeineKlientenSehen)
{
foreach (var p2c in person2CustomerList)
{
if (allowedCustomerOids.Contains(p2c.Customer.CustomerOid))
{
return true;
}
}
}
return false;
}
private void SetFamilyMemberStatus(List<CompactPersonDC> result)
{
var familyOids = DAOFactory.SearchDAO.FindFamilyMemberOids();
@@ -716,8 +716,8 @@ namespace BeWo.Service.Plugins
}
private ApplicationUser GetLoggedInUser()
{
{
if (LoggedInUserOperationContextExt.Current != null &&
LoggedInUserOperationContextExt.Current.User != null)
{
@@ -730,7 +730,7 @@ namespace BeWo.Service.Plugins
return SessionFacade.LoggedInUser;
}
return null;
}
@@ -744,7 +744,7 @@ namespace BeWo.Service.Plugins
//if (FetchTeamsForSupportConcepts())
//{
teamOids = CreateTeamOidDict(currentEmployeeOid);
teamOids = CreateTeamOidDict(currentEmployeeOid);
//}
foreach (var item in list)
@@ -842,8 +842,8 @@ namespace BeWo.Service.Plugins
dc.CostBearerRelOids.Add(iCBRel.Oid.Value);
}
}
SetTeamAndEmployeeRelation(dc.Customer, currentEmployeeOid, cust, teamOids);
dc.IsRelatedToEmployee = dc.Customer.IsRelatedToEmployee;
SetTeamAndEmployeeRelation(dc.Customer, currentEmployeeOid, cust, teamOids);
dc.IsRelatedToEmployee = dc.Customer.IsRelatedToEmployee;
return dc;
}
@@ -852,7 +852,7 @@ namespace BeWo.Service.Plugins
return System.Windows.Media.Brushes.Yellow.ToString();
}
protected virtual string GetBrushForExpiredSupportConcept()
{
{
return System.Windows.Media.Brushes.Red.ToString();
}
@@ -890,40 +890,40 @@ namespace BeWo.Service.Plugins
{
if (employeeOid == e2c.EmployeeOid.Value)
{
customerDc.IsRelatedToEmployee = true;
customerDc.IsRelatedToEmployee = true;
}
}
}
if (teamOids != null && teamOids.Count > 0)
{
foreach (var t2c in customer.Team2CustomerList)
{
if (customerDc.RelatedTeamOids == null)
{
customerDc.RelatedTeamOids = new List<long>();
}
customerDc.RelatedTeamOids.Add(t2c.TeamOid.Value);
if (teamOids != null && teamOids.Count > 0)
{
if (teamOids.ContainsKey(t2c.TeamOid.Value))
{
customerDc.IsRelatedToTeam = true;
}
foreach (var t2c in customer.Team2CustomerList)
{
if (customerDc.RelatedTeamOids == null)
{
customerDc.RelatedTeamOids = new List<long>();
}
customerDc.RelatedTeamOids.Add(t2c.TeamOid.Value);
}
}
}
if (teamOids.ContainsKey(t2c.TeamOid.Value))
{
customerDc.IsRelatedToTeam = true;
}
private List<CompactSupportConceptDC> CreateFlatSupportConceptCostBearerDCList(IEnumerable<SupportConcept> pEntityList, bool onlyWithAssignedCostbearer, long? employeeOid)
}
}
}
private List<CompactSupportConceptDC> CreateFlatSupportConceptCostBearerDCList(IEnumerable<SupportConcept> pEntityList, bool onlyWithAssignedCostbearer, long? employeeOid)
{
var list = new List<CompactSupportConceptDC>();
var customerOIDs = new Dictionary<long, long>();
var teamOids = new Dictionary<long, long>();
var teamOids = new Dictionary<long, long>();
if (employeeOid.HasValue && employeeOid > 0)
if (employeeOid.HasValue && employeeOid > 0)
{
var lEmployee = DAOFactory.GenericDAO.LoadByID<Employee>(employeeOid.Value);
IList<Employee2Customer> e2cList = lEmployee.Employee2CustomerList;
@@ -937,10 +937,10 @@ namespace BeWo.Service.Plugins
}
}
//if (FetchTeamsForSupportConcepts())
//{
teamOids = CreateTeamOidDict(employeeOid.Value);
//}
//if (FetchTeamsForSupportConcepts())
//{
teamOids = CreateTeamOidDict(employeeOid.Value);
//}
}
//var t = new List<long>();
var c2sOids = new Dictionary<long, bool>();
@@ -960,27 +960,27 @@ namespace BeWo.Service.Plugins
dc.Customer.IsRelatedToEmployee = true;
}
if (teamOids != null && teamOids.Count > 0)
{
if (teamOids != null && teamOids.Count > 0)
{
foreach (var t2c in sc.Customer.Team2CustomerList)
{
if (dc.Customer.RelatedTeamOids == null)
{
dc.Customer.RelatedTeamOids = new List<long>();
}
dc.Customer.RelatedTeamOids.Add(t2c.TeamOid.Value);
foreach (var t2c in sc.Customer.Team2CustomerList)
{
if (dc.Customer.RelatedTeamOids == null)
{
dc.Customer.RelatedTeamOids = new List<long>();
}
dc.Customer.RelatedTeamOids.Add(t2c.TeamOid.Value);
if (teamOids.ContainsKey(t2c.TeamOid.Value))
{
dc.Customer.IsRelatedToTeam = true;
}
if (teamOids.ContainsKey(t2c.TeamOid.Value))
{
dc.Customer.IsRelatedToTeam = true;
}
}
}
}
}
list.Add(dc);
list.Add(dc);
c2sOids.Add(cb2sc.Oid.Value, true);
}
}
@@ -997,6 +997,149 @@ namespace BeWo.Service.Plugins
return list;
}
public virtual long InsertNewSupportConcept(SupportConceptDC pSupportConcept)
{
CheckDefaultServiceCategory(pSupportConcept);
var lSupportConcept = MapperFactory.SupportConceptDC_SupportConcept.MapToNewEntity(pSupportConcept);
lSupportConcept.Customer.Customer2CostBearerList.AddRange(lSupportConcept.CostBearer2SupportConceptList.Where(cb2sc => !lSupportConcept.Customer.Customer2CostBearerList.Exists(c2cb => c2cb.CostBearer.Equals(cb2sc.CostBearer))).Select(c2cb => new Customer2CostBearer { CostBearer = c2cb.CostBearer, ReferenceNumber = c2cb.CustomerReferenceNumber }));
DAOFactory.GenericDAO.Insert(lSupportConcept);
MakeSupportConceptHistoryEntry(lSupportConcept, lSupportConcept.Oid.Value, StatementType.Insert);
return lSupportConcept.Oid.Value;
}
public virtual long UpdateSupportConcept(SupportConceptDC pSupportConcept)
{
CheckDefaultServiceCategory(pSupportConcept);
var lOriginal = DAOFactory.GenericDAO.LoadByID<SupportConcept>(pSupportConcept.SupportConceptOid.Value);
MapperFactory.SupportConceptDC_SupportConcept.MergeWithEntity(pSupportConcept, lOriginal);
lOriginal.Customer.Customer2CostBearerList.AddRange(lOriginal.CostBearer2SupportConceptList.Where(cb2sc => !lOriginal.Customer.Customer2CostBearerList.Exists(c2cb => c2cb.CostBearer.Equals(cb2sc.CostBearer))).Select(c2cb => new Customer2CostBearer { CostBearer = c2cb.CostBearer, ReferenceNumber = c2cb.CustomerReferenceNumber }));
DAOFactory.GenericDAO.Update(lOriginal);
MakeSupportConceptHistoryEntry(lOriginal, lOriginal.Oid.Value, StatementType.Update);
return lOriginal.Oid.Value;
}
public static void MakeSupportConceptHistoryEntry(SupportConcept lOriginal, long? Oid, StatementType statementType)
{
var supportConceptHistoryEntry = new SupportConceptHistory()
{
ChangeType = statementType,
SupportConcept_ApprovalDate = lOriginal.ApprovalDate,
SupportConcept_Conference = lOriginal.Conference,
SupportConcept_ConferenceDate = lOriginal.ConferenceDate,
SupportConcept_ConferenceVenue = lOriginal.ConferenceVenue,
SupportConcept_ConsultingNeeded = lOriginal.ConsultingNeeded,
//SupportConcept_CostBearer2SupportConceptList = lOriginal.CostBearer2SupportConceptList,
SupportConcept_CustomerOid = lOriginal.Customer.Oid,
SupportConcept_EmployeeOid = lOriginal.Originator.Oid,
SupportConcept_RenewalSendDate = lOriginal.RenewalSendDate,
SupportConcept_RequisitionSendDate = lOriginal.RequisitionSendDate,
SupportConcept_SupportConceptSendDate = lOriginal.RequisitionSendDate,
SupportConceptOid = lOriginal.Oid,
Notice = lOriginal.Notice
};
DAOFactory.GenericDAO.Insert(supportConceptHistoryEntry);
List<CostBearer2SupportConceptHistory> cb2schToInsert = new List<CostBearer2SupportConceptHistory>();
List<SupportConceptApprovalPeriodHistory> scApprovalPeriodHistoriesToInsert = new List<SupportConceptApprovalPeriodHistory>();
foreach (var originalC2S in lOriginal.CostBearer2SupportConceptList)
{
var C2SHistory = new CostBearer2SupportConceptHistory()
{
//CostBearer2SupportConcept_AccountingTransactions = originalC2S.AccountingTransactions,
CostBearer2SupportConcept_ApprovedEndDate = originalC2S.ApprovedEndDate,
CostBearer2SupportConcept_ApprovedStartDate = originalC2S.ApprovedStartDate,
CostBearer2SupportConcept_AuswahlBezeichnung = originalC2S.AuswahlBezeichnung,
CostBearer2SupportConcept_CostBearerContactPersonOid = originalC2S.CostBearerContactPerson?.Oid,
CostBearer2SupportConcept_CostBearerOid = originalC2S.CostBearer?.Oid,
CostBearer2SupportConcept_CustomerReferenceNumber = originalC2S.CustomerReferenceNumber,
CostBearer2SupportConcept_MonthlyPayment = originalC2S.MonthlyPayment,
CostBearer2SupportConcept_RequestedEndDate = originalC2S.RequestedEndDate,
CostBearer2SupportConcept_RequestedStartDate = originalC2S.RequestedStartDate,
//CostBearer2SupportConcept_ServiceRecords = originalC2S.ServiceRecords,
CostBearer2SupportConcept_Status = originalC2S.Status,
//CostBearer2SupportConcept_SupportConceptApprovalPeriodList = originalC2S.ApprovalPeriodList
CostBearer2SupportConcept_SupportConceptHistoryOid = lOriginal.Oid.Value,
ChangeType = statementType,
Notice = originalC2S.Notice
};
DAOFactory.GenericDAO.Insert(C2SHistory);
foreach (var item in originalC2S.ApprovalPeriodList)
{
var scApprovalPeriodHistory = new SupportConceptApprovalPeriodHistory()
{
ChangeType = statementType,
SupportConceptApprovalPeriod_ApprovedBEInterval = item.ApprovedBEInterval,
SupportConceptApprovalPeriod_ApprovedBEPerInterval = item.ApprovedBEPerInterval,
SupportConceptApprovalPeriod_ApprovedBETotal = item.ApprovedBETotal,
SupportConceptApprovalPeriod_ApprovedFixedAmount = item.ApprovedFixedAmount,
SupportConceptApprovalPeriod_ApprovedFixedAmountInterval = item.ApprovedFixedAmountInterval,
SupportConceptApprovalPeriod_Bewilligungsart = item.Bewilligungsart,
SupportConceptApprovalPeriod_BudgetOid = item.Budget?.Oid.Value,
SupportConceptApprovalPeriod_ContactCountInterval = item.ContactCountInterval,
SupportConceptApprovalPeriod_ContactCountPerInterval = item.ContactCountPerInterval,
SupportConceptApprovalPeriod_CostBearer2SupportConceptHistoryOid = originalC2S.Oid.Value,
SupportConceptApprovalPeriod_EndDate = item.EndDate,
SupportConceptApprovalPeriod_IsApprovedBEShifting = item.IsApprovedBEShifting,
SupportConceptApprovalPeriod_IsApprovedFixedAmountShifting = item.IsApprovedFixedAmountShifting,
SupportConceptApprovalPeriod_MonthlyPayment = item.MonthlyPayment,
SupportConceptApprovalPeriod_StartDate = item.StartDate,
SupportConceptApprovalPeriod_SupportConceptApprovalPeriod2Employee = item.SupportConceptApprovalPeriod2Employee,
SupportConceptApprovalPeriod_SupportConceptHistoryOid = supportConceptHistoryEntry.Oid.Value,
Notice = item.Notice
};
DAOFactory.GenericDAO.Insert(scApprovalPeriodHistory);
}
}
//MakeHistoryEntry(lOriginal.Customer2PersonList, originalCustomer2PersonList, lOriginal.Oid, statementType);
//MakeHistoryEntry(lOriginal.Customer2OrganisationList, originalC2OList, lOriginal.Oid, statementType);
//MakeHistoryEntry(lOriginal.Employee2CustomerList, originale2CList, lOriginal.Oid, statementType);
}
public static void CheckDefaultServiceCategory(SupportConceptDC pSupportConcept)
{
if (pSupportConcept.ServiceAccountings != null)
{
ServiceCategoryDC defaultCat = null;
foreach (ServiceAccountingDC sa in pSupportConcept.ServiceAccountings)
{
if (sa.ServiceDescription.ScopeType == ScopeTypeId.Individual)
{
if (sa.ServiceDescription.Category == null)
{
if (defaultCat == null)
{
ServiceCategory defaultCatEntity = DAOFactory.SearchDAO.FindDefaultIndividualServiceCategory();
if (defaultCatEntity == null)
{
defaultCatEntity = new ServiceCategory();
defaultCatEntity.Name = "Individuelle Leistungen";
defaultCatEntity.ScopeType = ScopeTypeId.Individual;
defaultCatEntity.IsBillable = true;
defaultCatEntity.BillableAmount = 100;
DAOFactory.GenericDAO.Insert(defaultCatEntity);
}
defaultCat = MapperFactory.ServiceCategoryDC_ServiceCategory.MapToNewDC(defaultCatEntity);
}
sa.ServiceDescription.Category = defaultCat;
}
}
}
}
}
public virtual CompactSupportConceptDC CreateFlatSupportConcept(SupportConcept sc, CostBearer2SupportConcept cb2sc)
{
var dc = new CompactSupportConceptDC();
@@ -1246,6 +1389,8 @@ namespace BeWo.Service.Plugins
return lResult;
}
public virtual SupportConceptCostBearerRelDC CreateSCCostBearerRelForSupportConceptTree(CostBearer2SupportConcept pEntity)
{
var dc = new SupportConceptCostBearerRelDC();
@@ -1306,18 +1451,128 @@ namespace BeWo.Service.Plugins
return dc;
}
public virtual long InsertNewCustomer(CustomerDC pCustomerDc)
{
Customer lCustomer = MapperFactory.CustomerDC_Customer.MapToNewEntity(pCustomerDc);
DAOFactory.GenericDAO.Insert(lCustomer);
public virtual long InsertNewCustomer(CustomerDC pCustomerDc)
{
Customer lCustomer = MapperFactory.CustomerDC_Customer.MapToNewEntity(pCustomerDc);
DAOFactory.GenericDAO.Insert(lCustomer);
return lCustomer.Oid.Value;
}
return lCustomer.Oid.Value;
}
public virtual String ImportSupportConcept(HilfeplanImportDC hidc)
{
var customer = FindOrCreateCustomer(hidc);
var supportConcept = FindOrCreateSupportConcept(hidc, customer);
MatchZiele(hidc, supportConcept);
//String firstname = hidc.Gruppen
//var customerDc = new CustomerDC();
//customerDc.p
//var sc = InsertNewSupportConcept();
if (hidc.SupportConceptOid.HasValue)
{
}
return "Import erfolgreich";
}
private void MatchZiele(HilfeplanImportDC hidc, SupportConcept supportConcept)
{
}
private Customer FindOrCreateCustomer(HilfeplanImportDC hidc)
{
if (hidc.Gruppen != null)
{
var stammdaten = hidc.Gruppen.FirstOrDefault(g => g.Label == "Stammdaten");
String firstname = GetValueFromImportItem(stammdaten, "Firstname");
String lastname = GetValueFromImportItem(stammdaten, "Lastname");
DateTime? birthdate = null;
if (DateTime.TryParse(GetValueFromImportItem(stammdaten, "Birthdate"), out var dt))
{
birthdate = dt;
}
Customer customer = null;
if (!String.IsNullOrEmpty(firstname) && !String.IsNullOrEmpty(lastname) && birthdate.HasValue)
{
customer = DAOFactory.SearchDAO.FindCustomer(firstname, lastname, birthdate.Value).FirstOrDefault();
}
if (customer == null)
{
//Create Customer
}
if (stammdaten != null && stammdaten.Items != null)
{
// liste.Add(ErstelleStammdatenFeld("BEI_NRW für den Zeitraum vom", "ApprovalPeriod", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("GP-Nummer/Az", "CustomerReferenceNumber", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Name", "Lastname", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Vorname", "Firstname", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Titel", "Titel", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Geburtsdatum", "Birthdate", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Geschlecht", "Sex", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Nationalität", "Nationality", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Beruf", "Job", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Familienstand", "FamilyStatus", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Anzahl und Alter der Kinder", "Children", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("PLZ", "PostalCode", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Ort", "Town", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Straße", "Street", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Telefon", "Phone", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("Fax", "Fax", zeilen, idx, out idx));
// liste.Add(ErstelleStammdatenFeld("E-Mail", "EMail", zeilen, idx, out idx));
}
return customer;
}
return null;
}
private string GetValueFromImportItem(HilfeplanImportItemDC stammdaten, string fieldName)
{
if (stammdaten != null && stammdaten.Items != null)
{
var item = stammdaten.Items.FirstOrDefault(i => i.FieldName == fieldName);
if (item != null)
{
return item.Content;
}
}
return null;
}
private SupportConcept FindOrCreateSupportConcept(HilfeplanImportDC hidc, Customer customer)
{
if (hidc.SupportConceptOid.HasValue)
{
return DAOFactory.GenericDAO.LoadByID<SupportConcept>(hidc.SupportConceptOid.Value);
}
else
{
var stammdaten = hidc.Gruppen.FirstOrDefault(g => g.Label == "Stammdaten");
var approvalPeriod = GetValueFromImportItem(stammdaten, "ApprovalPeriod");
if (!String.IsNullOrEmpty(approvalPeriod))
{
}
}
return null;
}
}
}

View File

@@ -51,7 +51,7 @@ namespace BeWo.Service.Plugins
//t = "4950382346"; // Holsinger
//t = "5973016645"; // Verein Lebensgestaltung Hanau
//t = "7375324044"; // Diakonie KK Kleve
//t = "1441747891"; // BeWo Mobil Köln
t = "1441747891"; // BeWo Mobil Köln
//t = "5120047701"; // Trialog
//t = "3629696651"; // Soziale Dienste Niederrhein (SDN)
//t = "9893557471"; // Caritas Frankfurt
@@ -223,7 +223,7 @@ namespace BeWo.Service.Plugins
//t = "7817461089"; // FAB e.V. (Familienarbeit und Beratung e.V.)
//t = "5207911843"; // Pro Balance
//t = "8619663355"; // HSH Cologne
t = "1652658918"; // LH Frankfurt Oder
//t = "1652658918"; // LH Frankfurt Oder
//t = "7696927868"; // Kuhring Betreuung
//t = "6251348980"; // BeWo Gün
//t = "6782533512"; // LH Dorsten

View File

@@ -75,7 +75,7 @@ namespace BeWo.Service.ServiceImplementations
try
{
ServiceLogic.SetActivationType<SupportConcept>(pOid, pVersion, ActivationTypeId.Archived);
MakeSupportConceptHistoryEntry(DAOFactory.GenericDAO.GetByID<SupportConcept>(pOid), pOid, StatementType.Archived);
CustomerService.MakeSupportConceptHistoryEntry(DAOFactory.GenericDAO.GetByID<SupportConcept>(pOid), pOid, StatementType.Archived);
}
catch (Exception e)
{
@@ -181,7 +181,7 @@ namespace BeWo.Service.ServiceImplementations
try
{
ServiceLogic.SetActivationType<SupportConcept>(pOid, pVersion, ActivationTypeId.Deleted);
MakeSupportConceptHistoryEntry(DAOFactory.GenericDAO.GetByID<SupportConcept>(pOid), pOid, StatementType.Delete);
CustomerService.MakeSupportConceptHistoryEntry(DAOFactory.GenericDAO.GetByID<SupportConcept>(pOid), pOid, StatementType.Delete);
}
catch (Exception e)
{
@@ -195,7 +195,7 @@ namespace BeWo.Service.ServiceImplementations
{
ServiceLogic.SetActivationType<SupportConcept>(pOid2Version, ActivationTypeId.Deleted);
foreach (var item in pOid2Version)
MakeSupportConceptHistoryEntry(DAOFactory.GenericDAO.GetByID<SupportConcept>(item.Key), item.Key, StatementType.Delete);
CustomerService.MakeSupportConceptHistoryEntry(DAOFactory.GenericDAO.GetByID<SupportConcept>(item.Key), item.Key, StatementType.Delete);
}
catch (Exception e)
{
@@ -1041,17 +1041,11 @@ namespace BeWo.Service.ServiceImplementations
{
try
{
CheckDefaultServiceCategory(pSupportConcept);
var s = PluginLoader.FindClass<CustomerService>();
var lSupportConcept = MapperFactory.SupportConceptDC_SupportConcept.MapToNewEntity(pSupportConcept);
return s.InsertNewSupportConcept(pSupportConcept);
lSupportConcept.Customer.Customer2CostBearerList.AddRange(lSupportConcept.CostBearer2SupportConceptList.Where(cb2sc => !lSupportConcept.Customer.Customer2CostBearerList.Exists(c2cb => c2cb.CostBearer.Equals(cb2sc.CostBearer))).Select(c2cb => new Customer2CostBearer { CostBearer = c2cb.CostBearer, ReferenceNumber = c2cb.CustomerReferenceNumber }));
DAOFactory.GenericDAO.Insert(lSupportConcept);
MakeSupportConceptHistoryEntry(lSupportConcept, lSupportConcept.Oid.Value, StatementType.Insert);
return lSupportConcept.Oid.Value;
}
catch (Exception e)
{
@@ -1389,17 +1383,9 @@ namespace BeWo.Service.ServiceImplementations
try
{
// Alle dazugehörigen ServiceRecords holen
CheckDefaultServiceCategory(pSupportConcept);
var s = PluginLoader.FindClass<CustomerService>();
return s.UpdateSupportConcept(pSupportConcept);
var lOriginal = DAOFactory.GenericDAO.LoadByID<SupportConcept>(pSupportConcept.SupportConceptOid.Value);
MapperFactory.SupportConceptDC_SupportConcept.MergeWithEntity(pSupportConcept, lOriginal);
lOriginal.Customer.Customer2CostBearerList.AddRange(lOriginal.CostBearer2SupportConceptList.Where(cb2sc => !lOriginal.Customer.Customer2CostBearerList.Exists(c2cb => c2cb.CostBearer.Equals(cb2sc.CostBearer))).Select(c2cb => new Customer2CostBearer { CostBearer = c2cb.CostBearer, ReferenceNumber = c2cb.CustomerReferenceNumber }));
DAOFactory.GenericDAO.Update(lOriginal);
MakeSupportConceptHistoryEntry(lOriginal, lOriginal.Oid.Value, StatementType.Update);
return lOriginal.Oid.Value;
}
catch (Exception e)
{
@@ -1938,39 +1924,7 @@ namespace BeWo.Service.ServiceImplementations
return result;
}
private static void CheckDefaultServiceCategory(SupportConceptDC pSupportConcept)
{
if (pSupportConcept.ServiceAccountings != null)
{
ServiceCategoryDC defaultCat = null;
foreach (ServiceAccountingDC sa in pSupportConcept.ServiceAccountings)
{
if (sa.ServiceDescription.ScopeType == ScopeTypeId.Individual)
{
if (sa.ServiceDescription.Category == null)
{
if (defaultCat == null)
{
ServiceCategory defaultCatEntity = DAOFactory.SearchDAO.FindDefaultIndividualServiceCategory();
if (defaultCatEntity == null)
{
defaultCatEntity = new ServiceCategory();
defaultCatEntity.Name = "Individuelle Leistungen";
defaultCatEntity.ScopeType = ScopeTypeId.Individual;
defaultCatEntity.IsBillable = true;
defaultCatEntity.BillableAmount = 100;
DAOFactory.GenericDAO.Insert(defaultCatEntity);
}
defaultCat = MapperFactory.ServiceCategoryDC_ServiceCategory.MapToNewDC(defaultCatEntity);
}
sa.ServiceDescription.Category = defaultCat;
}
}
}
}
}
//private void CheckDefaultGoalCategory(SupportConceptDC pSupportConcept)
//{
@@ -2141,84 +2095,7 @@ namespace BeWo.Service.ServiceImplementations
var person = lOriginal.Person;
MakeNewPersonHistoryEntry(person, statementType);
}
private static void MakeSupportConceptHistoryEntry(SupportConcept lOriginal, long? Oid, StatementType statementType)
{
var supportConceptHistoryEntry = new SupportConceptHistory()
{
ChangeType = statementType,
SupportConcept_ApprovalDate = lOriginal.ApprovalDate,
SupportConcept_Conference = lOriginal.Conference,
SupportConcept_ConferenceDate = lOriginal.ConferenceDate,
SupportConcept_ConferenceVenue = lOriginal.ConferenceVenue,
SupportConcept_ConsultingNeeded = lOriginal.ConsultingNeeded,
//SupportConcept_CostBearer2SupportConceptList = lOriginal.CostBearer2SupportConceptList,
SupportConcept_CustomerOid = lOriginal.Customer.Oid,
SupportConcept_EmployeeOid = lOriginal.Originator.Oid,
SupportConcept_RenewalSendDate = lOriginal.RenewalSendDate,
SupportConcept_RequisitionSendDate = lOriginal.RequisitionSendDate,
SupportConcept_SupportConceptSendDate = lOriginal.RequisitionSendDate,
SupportConceptOid = lOriginal.Oid,
Notice = lOriginal.Notice
};
DAOFactory.GenericDAO.Insert(supportConceptHistoryEntry);
List<CostBearer2SupportConceptHistory> cb2schToInsert = new List<CostBearer2SupportConceptHistory>();
List<SupportConceptApprovalPeriodHistory> scApprovalPeriodHistoriesToInsert = new List<SupportConceptApprovalPeriodHistory>();
foreach (var originalC2S in lOriginal.CostBearer2SupportConceptList)
{
var C2SHistory = new CostBearer2SupportConceptHistory()
{
//CostBearer2SupportConcept_AccountingTransactions = originalC2S.AccountingTransactions,
CostBearer2SupportConcept_ApprovedEndDate = originalC2S.ApprovedEndDate,
CostBearer2SupportConcept_ApprovedStartDate = originalC2S.ApprovedStartDate,
CostBearer2SupportConcept_AuswahlBezeichnung = originalC2S.AuswahlBezeichnung,
CostBearer2SupportConcept_CostBearerContactPersonOid = originalC2S.CostBearerContactPerson?.Oid,
CostBearer2SupportConcept_CostBearerOid = originalC2S.CostBearer?.Oid,
CostBearer2SupportConcept_CustomerReferenceNumber = originalC2S.CustomerReferenceNumber,
CostBearer2SupportConcept_MonthlyPayment = originalC2S.MonthlyPayment,
CostBearer2SupportConcept_RequestedEndDate = originalC2S.RequestedEndDate,
CostBearer2SupportConcept_RequestedStartDate = originalC2S.RequestedStartDate,
//CostBearer2SupportConcept_ServiceRecords = originalC2S.ServiceRecords,
CostBearer2SupportConcept_Status = originalC2S.Status,
//CostBearer2SupportConcept_SupportConceptApprovalPeriodList = originalC2S.ApprovalPeriodList
CostBearer2SupportConcept_SupportConceptHistoryOid = lOriginal.Oid.Value,
ChangeType = statementType,
Notice = originalC2S.Notice
};
DAOFactory.GenericDAO.Insert(C2SHistory);
foreach (var item in originalC2S.ApprovalPeriodList)
{
var scApprovalPeriodHistory = new SupportConceptApprovalPeriodHistory()
{
ChangeType = statementType,
SupportConceptApprovalPeriod_ApprovedBEInterval = item.ApprovedBEInterval,
SupportConceptApprovalPeriod_ApprovedBEPerInterval = item.ApprovedBEPerInterval,
SupportConceptApprovalPeriod_ApprovedBETotal = item.ApprovedBETotal,
SupportConceptApprovalPeriod_ApprovedFixedAmount = item.ApprovedFixedAmount,
SupportConceptApprovalPeriod_ApprovedFixedAmountInterval = item.ApprovedFixedAmountInterval,
SupportConceptApprovalPeriod_Bewilligungsart = item.Bewilligungsart,
SupportConceptApprovalPeriod_BudgetOid = item.Budget?.Oid.Value,
SupportConceptApprovalPeriod_ContactCountInterval = item.ContactCountInterval,
SupportConceptApprovalPeriod_ContactCountPerInterval = item.ContactCountPerInterval,
SupportConceptApprovalPeriod_CostBearer2SupportConceptHistoryOid = originalC2S.Oid.Value,
SupportConceptApprovalPeriod_EndDate = item.EndDate,
SupportConceptApprovalPeriod_IsApprovedBEShifting = item.IsApprovedBEShifting,
SupportConceptApprovalPeriod_IsApprovedFixedAmountShifting = item.IsApprovedFixedAmountShifting,
SupportConceptApprovalPeriod_MonthlyPayment = item.MonthlyPayment,
SupportConceptApprovalPeriod_StartDate = item.StartDate,
SupportConceptApprovalPeriod_SupportConceptApprovalPeriod2Employee = item.SupportConceptApprovalPeriod2Employee,
SupportConceptApprovalPeriod_SupportConceptHistoryOid = supportConceptHistoryEntry.Oid.Value,
Notice = item.Notice
};
DAOFactory.GenericDAO.Insert(scApprovalPeriodHistory);
}
}
//MakeHistoryEntry(lOriginal.Customer2PersonList, originalCustomer2PersonList, lOriginal.Oid, statementType);
//MakeHistoryEntry(lOriginal.Customer2OrganisationList, originalC2OList, lOriginal.Oid, statementType);
//MakeHistoryEntry(lOriginal.Employee2CustomerList, originale2CList, lOriginal.Oid, statementType);
}
private static void MakeHistoryEntry<T>(IList<T> lNewList, List<T> lOriginalList, long? customerOid, StatementType sType) where T : BeWoEntityBase
{
@@ -2550,7 +2427,7 @@ namespace BeWo.Service.ServiceImplementations
try
{
ServiceLogic.SetActivationType<SupportConcept>(pOid, pVersion, ActivationTypeId.Active);
MakeSupportConceptHistoryEntry(DAOFactory.GenericDAO.GetByID<SupportConcept>(pOid), pOid, StatementType.Reactivate);
CustomerService.MakeSupportConceptHistoryEntry(DAOFactory.GenericDAO.GetByID<SupportConcept>(pOid), pOid, StatementType.Reactivate);
}
catch (Exception e)
{