Das endgültige Löschen von Klienten ist jetzt implementiert.

This commit is contained in:
Lyndon
2018-05-28 14:39:28 +02:00
parent 5d8f099cb1
commit bcc8379fe6

View File

@@ -5190,46 +5190,50 @@ namespace BeWo.Service.ServiceImplementations
private int _AbWelchemKrankheitsTag;
private bool _VertretungDringendErforderlich;
*/
//var appointments = DAOFactory.SearchDAO.FindAppointmentsForCustomer(pCustomerOid);
//var customer = DAOFactory.GenericDAO.LoadByID<Customer>(pCustomerOid);
//appointments.DoForEach(app => app.CustomerList.Remove(customer));
var appointments = DAOFactory.SearchDAO.FindAppointmentsForCustomer(pCustomerOid);
var customer = DAOFactory.GenericDAO.LoadByID<Customer>(pCustomerOid);
appointments.DoForEach(app => app.CustomerList.Remove(customer));
DAOFactory.GenericDAO.Update(appointments);
var costBearer2SupportConcepts = new List<CostBearer2SupportConcept>();
var groupsToGetReferencesRemoved = new List<GroupOfPeople>();
foreach(var sc in customer.SupportConcepts)
{
foreach(var cb2sc in sc.CostBearer2SupportConceptList)
{
groupsToGetReferencesRemoved.AddRangeIfElementsNotIn(DAOFactory.SearchDAO.GroupOfPeopleForSupportConcept(cb2sc.Oid.Value));
costBearer2SupportConcepts.AddIfNotIn(cb2sc);
}
}
foreach(var group in groupsToGetReferencesRemoved)
{
group.CostBearer2SupportConceptList.RemoveRange(costBearer2SupportConcepts);
}
DAOFactory.GenericDAO.Update(groupsToGetReferencesRemoved);
DAOFactory.GenericDAO.Update(customer.SupportConcepts);
customer.SupportConcepts.DoForEach(s => s.CostBearer2SupportConceptList?.Clear());
foreach(var assessmentSheetCategory in customer.AssessmentSheetCategoryList)
{
assessmentSheetCategory.Customers.Remove(customer);
}
var assessmentSheetEntries = DAOFactory.SearchDAO.GetAssessmentSheetEntriesForCustomer(customer.Oid.Value, DateTime.MinValue, DateTime.MaxValue);
//DAOFactory.GenericDAO.Update(appointments);
//var costBearer2SupportConcepts = new List<CostBearer2SupportConcept>();
//var groupsToGetReferencesRemoved = new List<GroupOfPeople>();
//foreach(var sc in customer.SupportConcepts)
//{
// foreach(var cb2sc in sc.CostBearer2SupportConceptList)
// {
// groupsToGetReferencesRemoved.AddRangeIfElementsNotIn(DAOFactory.SearchDAO.GroupOfPeopleForSupportConcept(cb2sc.Oid.Value));
// costBearer2SupportConcepts.AddIfNotIn(cb2sc);
// }
//}
//foreach(var group in groupsToGetReferencesRemoved)
//{
// group.CostBearer2SupportConceptList.RemoveRange(costBearer2SupportConcepts);
//}
DAOFactory.GenericDAO.Delete(assessmentSheetEntries);
//DAOFactory.GenericDAO.Update(groupsToGetReferencesRemoved);
//DAOFactory.GenericDAO.Update(customer.SupportConcepts);
DAOFactory.GenericDAO.Update(customer);
//customer.SupportConcepts.DoForEach(s => s.CostBearer2SupportConceptList?.Clear());
//foreach(var assessmentSheetCategory in customer.AssessmentSheetCategoryList)
//{
//}
DAOFactory.GenericDAO.Delete(customer.SupportConcepts);
//DAOFactory.GenericDAO.Update(customer);
//DAOFactory.GenericDAO.Delete(customer.SupportConcepts);
//DAOFactory.GenericDAO.Delete(customer);
DAOFactory.GenericDAO.Delete(DAOFactory.GenericDAO.LoadByID<Customer>(customer.Oid.Value));
}
catch(Exception e)
{