MH: SupportConcept Histories eingefügt + Einfügen von ganzen Teams in Wohnheime ermöglicht
This commit is contained in:
@@ -7,6 +7,7 @@ using BeWo.Service.ServiceImplementations;
|
||||
using BS.Shared;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -131,11 +132,27 @@ namespace BeWo.Service.Dienstplanung
|
||||
{
|
||||
List<DienstInfo> list = new List<DienstInfo>();
|
||||
if (whOid == null)
|
||||
{
|
||||
list = DAOFactory.GenericDAO.GetAllActive<DienstInfo>().ToList();
|
||||
var withoutWH = new List<DienstInfo>();
|
||||
|
||||
foreach (var d in list)
|
||||
{
|
||||
if (d.Wohnheim == null)
|
||||
withoutWH.Add(d);
|
||||
}
|
||||
list.RemoveRange(withoutWH);
|
||||
|
||||
list = list.OrderBy(l => l.Wohnheim).ThenBy(d => d.DienstName).ToList();
|
||||
list.AddRange(withoutWH.OrderBy(w => w.DienstName));
|
||||
}
|
||||
else
|
||||
list = DAOFactory.SearchDAO.FindDiensteForWohnheim(whOid).ToList();
|
||||
|
||||
return MapperFactory.DienstInfoDC_DienstInfo.MapToNewDCs(list);
|
||||
var dcs = MapperFactory.DienstInfoDC_DienstInfo.MapToNewDCs(list);
|
||||
|
||||
|
||||
return dcs;//.OrderBy(d => d.Wohnheim).ThenBy(d => d.DienstName).ToList();
|
||||
}
|
||||
public static void InsertNewDienst(List<DienstInfoDC> dienst)
|
||||
{
|
||||
@@ -397,7 +414,7 @@ namespace BeWo.Service.Dienstplanung
|
||||
DAOFactory.GenericDAO.Delete(toDelete[i]);
|
||||
}
|
||||
}
|
||||
public static void RemoveAllDiensteForOneMonth(DateTime month, List<RegelmaessigerDienstDC> rd)
|
||||
public static void RemoveAllDiensteForOneMonth(CompactWohnheimDC wh, DateTime month, List<RegelmaessigerDienstDC> rd)
|
||||
{
|
||||
if (rd.Count > 0)
|
||||
{
|
||||
@@ -413,12 +430,37 @@ namespace BeWo.Service.Dienstplanung
|
||||
var alleVertretungen = DAOFactory.GenericDAO.GetAll<Dienstvertretung>();
|
||||
foreach (var dienst in alleDienste)
|
||||
{
|
||||
if (dienst.Datum.Month == month.Month)
|
||||
if (dienst.Datum.Month == month.Month && dienst.WohnheimOid == wh.WohnheimOid)
|
||||
DAOFactory.GenericDAO.Delete(dienst);
|
||||
}
|
||||
foreach (var vertretung in alleVertretungen)
|
||||
{
|
||||
if (vertretung.Datum.Month == month.Month)
|
||||
if (vertretung.Datum.Month == month.Month && vertretung.WohnheimOid == wh.WohnheimOid)
|
||||
DAOFactory.GenericDAO.Delete(vertretung);
|
||||
}
|
||||
}
|
||||
public static void RemoveAllDiensteForOneYear(CompactWohnheimDC wh, DateTime year, List<RegelmaessigerDienstDC> rd)
|
||||
{
|
||||
if (rd.Count > 0)
|
||||
{
|
||||
List<RegelmaessigerDienst> entities = new List<RegelmaessigerDienst>();
|
||||
foreach (var dienst in rd)
|
||||
{
|
||||
entities.Add(DAOFactory.GenericDAO.GetByID<RegelmaessigerDienst>((long)dienst.Oid));
|
||||
}
|
||||
DAOFactory.GenericDAO.Delete(entities);
|
||||
}
|
||||
|
||||
var alleDienste = DAOFactory.GenericDAO.GetAll<DienstEintrag>();
|
||||
var alleVertretungen = DAOFactory.GenericDAO.GetAll<Dienstvertretung>();
|
||||
foreach (var dienst in alleDienste)
|
||||
{
|
||||
if (dienst.Datum.Year == year.Year && dienst.WohnheimOid == wh.WohnheimOid)
|
||||
DAOFactory.GenericDAO.Delete(dienst);
|
||||
}
|
||||
foreach (var vertretung in alleVertretungen)
|
||||
{
|
||||
if (vertretung.Datum.Year == year.Year && vertretung.WohnheimOid == wh.WohnheimOid)
|
||||
DAOFactory.GenericDAO.Delete(vertretung);
|
||||
}
|
||||
}
|
||||
@@ -593,5 +635,12 @@ namespace BeWo.Service.Dienstplanung
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static List<CompactEmployeeDC> GetCompactEmployeesForTeam(long teamOid)
|
||||
{
|
||||
var team = DAOFactory.GenericDAO.GetByID<Team>(teamOid);
|
||||
|
||||
return MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(team.MemberList); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user