Das Übertragen eines Kalendertermins in die Zeiterfassung funktioniert jetzt wieder bei Serienterminen.

This commit is contained in:
2026-03-27 15:14:20 +01:00
parent f17bafe24b
commit ccb1a37a95
17 changed files with 435 additions and 255 deletions

View File

@@ -76,7 +76,7 @@ namespace BeWo.Scheduler.ViewModel
ServiceFacade.DoEmployeeServiceSync(s => originator = s.FindCompactEmployeeByFullname(abwesenheit.InsUser));
}
if(!(dc is null))
if(false == dc is null)
{
subject += $" ({dc.SimpleDescription})";
}

View File

@@ -162,12 +162,12 @@ namespace BeWo.ownChat
var goalCategoryDict = vm.AllGoalCategories.ToDictionary(goalCat => goalCat.ValueListEntryOid.Value);
foreach (var goal in infoDC.SupportConceptGoals)
foreach(var goal in infoDC.SupportConceptGoals)
{
if (goal.ParentOid != null && goalCategoryDict.ContainsKey(goal.ParentOid.Value))
if(goal.ParentOid != null && goalCategoryDict.ContainsKey(goal.ParentOid.Value))
{
var path = ServiceRecordListVM.GetAllParentGoalCategoies(goalCategoryDict, goal);
foreach (var goalCat in path)
foreach(var goalCat in path)
{
goalCats.Add(goalCat);
goalCategoryDict.Remove(goalCat.ValueListEntryOid.Value);
@@ -214,7 +214,6 @@ namespace BeWo.ownChat
{
vm.FetchStatistics(cb2ScOid.Value);
}
serviceRecordEditView.InitView(vm, _ServiceRecord, hideCustomerCombo);

View File

@@ -22,7 +22,6 @@ namespace BeWoPlanerMobil.Controllers
/*
* ToDo:
* 1. Filterung einbauen (Mitarbeiter, Klienten, Ressourcen, Privat, Aufgaben, Abwesenheiten)
* Das Filtern muss über den CustomCallback geschehen, damit die Termin-Liste aktualisiert wird.
* 2. "In die Zeiterfassung übertragen" und "Verfügbare Mitarbeiter prüfen" einbauen
* 3. Rechte implementieren!
* 4. Übersetzungen
@@ -94,12 +93,14 @@ namespace BeWoPlanerMobil.Controllers
private void InitViewModel()
{
if(!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || Model?.LoggedInEmployee?.EmployeeOid is null)
if(false == MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || Model?.LoggedInEmployee?.EmployeeOid is null)
{
Logout();
return;
}
var x = Model.SelectedEmployeeOidsForFiltering;
Model.PossibleEmployees = EmployeeService.GetAllAuthorizedCompactEmployees();
Model.PossibleCustomers = CustomerService.GetAllAuthorizedCompactCustomers();
Model.PossibleResources = KalenderService.GetAllResources();
@@ -263,7 +264,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult DevExpressScheduler()
{
if(!MobileSessionFacade.IsUserLoggedIn() || Model is null)
if(false == MobileSessionFacade.IsUserLoggedIn() || Model is null)
{
return RedirectToActionPermanent("Index", "Login");
}
@@ -515,7 +516,16 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("AptFltEmployeePopupListPartial");
}
Model.SelectedEmployeeOidsForFiltering = Model.PossibleEmployees.Select(employee => employee.EmployeeOid).ToList();
if(isChecked)
{
Model.SelectedEmployeesForFiltering = Model.PossibleEmployees;
Model.SelectedEmployeeOidsForFiltering = Model.PossibleEmployees.Select(employee => employee.EmployeeOid).ToList();
}
else
{
Model.SelectedEmployeesForFiltering?.Clear();
Model.SelectedEmployeeOidsForFiltering?.Clear();
}
return PartialView("AptFltEmployeePopupListPartial", Model);
}
@@ -529,7 +539,16 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("AptFltCustomerPopupListPartial");
}
Model.SelectedCustomerOidsForFiltering = Model.PossibleCustomers.Select(customer => customer.CustomerOid).ToList();
if(isChecked)
{
Model.SelectedCustomerOidsForFiltering = Model.PossibleCustomers.Select(customer => customer.CustomerOid).ToList();
Model.SelectedCustomersForFiltering = Model.PossibleCustomers;
}
else
{
Model.SelectedCustomerOidsForFiltering?.Clear();
Model.SelectedCustomersForFiltering?.Clear();
}
return PartialView("AptFltCustomerPopupListPartial", Model);
}
@@ -543,9 +562,18 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("AptFltResourcePopupListPartial");
}
Model.SelectedResourceOidsForFiltering = Model.PossibleResources.Where(resource => resource.ResourceOid.HasValue).Select(resource => resource.ResourceOid.Value).ToList();
if(isChecked)
{
Model.SelectedResourceOidsForFiltering = Model.PossibleResources.Where(resource => resource.ResourceOid.HasValue).Select(resource => resource.ResourceOid.Value).ToList();
Model.SelectedResourcesForFiltering = Model.PossibleResources;
}
else
{
Model.SelectedResourceOidsForFiltering?.Clear();
Model.SelectedResourcesForFiltering?.Clear();
}
return PartialView("AptFltResourcePopupListPartial");
return PartialView("AptFltResourcePopupListPartial", Model);
}
[Authorize]
@@ -561,14 +589,17 @@ namespace BeWoPlanerMobil.Controllers
if(selectedTeam is null)
{
return PartialView("AptFltEmployeePopupListPartial");
return PartialView("AptFltEmployeePopupListPartial", Model);
}
var fullTeamObj = EmployeeService.LoadTeam(teamOid);
Model.SelectedEmployeeOids.AddRangeIfElementsNotIn(fullTeamObj.Member.Select(member => member.EmployeeOid));
var teamMembers = fullTeamObj?.Member ?? new List<CompactEmployeeDC>();
return PartialView("AptFltEmployeePopupListPartial");
Model.SelectedEmployeesForFiltering.AddRangeIfElementsNotIn(teamMembers);
Model.SelectedEmployeeOids.AddRangeIfElementsNotIn(teamMembers.Select(member => member.EmployeeOid));
return PartialView("AptFltEmployeePopupListPartial", Model);
}
[Authorize]
@@ -582,6 +613,7 @@ namespace BeWoPlanerMobil.Controllers
var selectedEmployees = Model.PossibleEmployees.Where(possibleEmployee => selectedEmployeeOids.Contains(possibleEmployee.EmployeeOid)).ToList();
Model.SelectedEmployeesForFiltering = selectedEmployees;
Model.SelectedEmployeeOidsForFiltering = selectedEmployees.Select(employee => employee.EmployeeOid).ToList();
return PartialView("AptFltEmployeePopupListPartial", Model);
@@ -598,6 +630,9 @@ namespace BeWoPlanerMobil.Controllers
var selectedCustomers = Model.PossibleCustomers.Where(possibleCustomer => selectedCustomerOids.Contains(possibleCustomer.CustomerOid)).ToList();
Model.SelectedCustomersForFiltering = selectedCustomers;
Model.SelectedCustomerOidsForFiltering = selectedCustomers.Select(customer => customer.CustomerOid).ToList();
return PartialView("AptFltCustomerPopupListPartial", Model);
}
@@ -610,7 +645,30 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("AptFltResourcePopupListPartial");
}
var selectedResources = Model.PossibleResources.Where(possibleResource => possibleResource.ResourceOid.HasValue && selectedResourceOids.Contains(possibleResource.ResourceOid.Value)).ToList();
Model.SelectedResourcesForFiltering = selectedResources;
Model.SelectedResourceOidsForFiltering = selectedResources.Where(resource => resource.ResourceOid.HasValue).Select(resource => resource.ResourceOid.Value).ToList();
return PartialView("AptFltResourcePopupListPartial", Model);
}
[Authorize]
public string GetSelectedEmployeesForAptFlt()
{
return JsonConvert.SerializeObject(Model.SelectedEmployeeOidsForFiltering.Count);
}
[Authorize]
public string GetSelectedCustomersForAptFlt()
{
return JsonConvert.SerializeObject(Model.SelectedCustomerOidsForFiltering.Count);
}
[Authorize]
public string GetSelectedResourcesForAptFlt()
{
return JsonConvert.SerializeObject(Model.SelectedResourceOidsForFiltering.Count);
}
}
}

View File

@@ -25,7 +25,6 @@ using System.Net.Sockets;
using System.Text;
using System.Web.Mvc;
using System.Windows.Forms;
using DevExpress.XtraRichEdit.Commands.Internal;
using static BeWoPlanerMobil.Util.MobileUtils;
using static BS.Shared.ServiceRecordValidationResult;
using FormCollection = System.Web.Mvc.FormCollection;
@@ -618,7 +617,7 @@ namespace BeWoPlanerMobil.Controllers
{
try
{
if(!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if(false == MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
{
var isNewSession = Session.IsNewSession;
@@ -630,7 +629,7 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
if(!Model.SessionInitialized)
if(false == Model.SessionInitialized)
{
Model.SessionInitialized = true;
var mokSessionTimeout = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.MoKSessionTimeout, 20);
@@ -653,12 +652,17 @@ namespace BeWoPlanerMobil.Controllers
break;
}
if(!string.IsNullOrEmpty(tempDataValue))
if(false == string.IsNullOrEmpty(tempDataValue))
{
TempData[TempDataConstants.ShowPwChPopupKey] = tempDataValue;
}
}
}
if(TempData[TempDataConstants.AppointmentOccurrenceToInsertKey] is SchedulerAppointmentDC occurrenceToInsert)
{
TempData[TempDataConstants.AppointmentOccurrenceToInsertKey] = occurrenceToInsert;
}
}
catch(Exception e)
{
@@ -1293,6 +1297,10 @@ namespace BeWoPlanerMobil.Controllers
var app = DAOFactory.GenericDAO.LoadByID<SchedulerAppointment>(Model.TransferringAppointmentOid.Value);
appointmentPrototype = MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDC(app);
}
else if(TempData[TempDataConstants.AppointmentOccurrenceToInsertKey] is SchedulerAppointmentDC occurrenceToInsert)
{
appointmentPrototype = occurrenceToInsert;
}
var marker = "on" == collection[FormCollectionConstants.MarkerKey];
@@ -1318,7 +1326,7 @@ namespace BeWoPlanerMobil.Controllers
var distanz = collection[FormCollectionConstants.DistanceKey];
decimal? distanceInMeters = null;
if(!string.IsNullOrEmpty(distanz))
if(false == string.IsNullOrEmpty(distanz))
{
if(decimal.TryParse(distanz, out var parsedDistance))
{
@@ -1350,7 +1358,7 @@ namespace BeWoPlanerMobil.Controllers
durationAsString = durationAsString?.Replace('.', ',');
if(!string.IsNullOrEmpty(durationAsString))
if(false == string.IsNullOrEmpty(durationAsString))
{
decimal.TryParse(durationAsString, out dauer);
}
@@ -1417,23 +1425,23 @@ namespace BeWoPlanerMobil.Controllers
if(Model.LoggedInEmployee.EmployeeOid.HasValue)
{
if(!Model.IsInEditingMode)
if(false == Model.IsInEditingMode)
{
Model.NewServiceRecord.Employee = Model.SelectedEmployee ?? LoggedInUser.Employee;
}
else
{
if(!(Model.SelectedEmployee is null))
if(Model.SelectedEmployee != null)
{
Model.NewServiceRecord.Employee = Model.SelectedEmployee;
}
}
var sclo = Model.SupportConceptListObjects.FirstOrDefault(a => a.CostBearer2SupportConceptOid.Equals(selectedCostbearerScRelOid));
var mokSupportConceptListObject = Model.SupportConceptListObjects.FirstOrDefault(a => a.CostBearer2SupportConceptOid.Equals(selectedCostbearerScRelOid));
if(!(sclo is null))
if(mokSupportConceptListObject != null)
{
var sc = GetCompactSupportConcept(sclo.SupportConceptOid, selectedCostbearerScRelOid);
var sc = GetCompactSupportConcept(mokSupportConceptListObject.SupportConceptOid, selectedCostbearerScRelOid);
Model.NewServiceRecord.SupportConcept = sc;
@@ -1479,7 +1487,7 @@ namespace BeWoPlanerMobil.Controllers
var serviceDescOid = 0L;
if(!string.IsNullOrEmpty(collection[FormCollectionConstants.ServiceDescriptionKey]))
if(false == string.IsNullOrEmpty(collection[FormCollectionConstants.ServiceDescriptionKey]))
{
serviceDescOid = Convert.ToInt64(collection[FormCollectionConstants.ServiceDescriptionKey]);
}
@@ -1508,7 +1516,7 @@ namespace BeWoPlanerMobil.Controllers
return Model.NewServiceRecord.ServiceRecordOid.HasValue ? SaveGroupBooking() : UpdateGroupBooking();
}
if(!Model.IsInEditingMode)
if(false == Model.IsInEditingMode)
{
var oidList = OperationsService.InsertNewServiceRecords(new List<ServiceRecordDC> { Model.NewServiceRecord });
@@ -1516,57 +1524,32 @@ namespace BeWoPlanerMobil.Controllers
TempData[TempDataConstants.AfterInsertKey] = true;
if (Model.IsAllowedToCreateSignature(Model.NewServiceRecord))
if(Model.IsAllowedToCreateSignature(Model.NewServiceRecord))
{
if (Model.NewServiceRecord.CostBearer != null && Model.ShowSignature && (Model.NewServiceRecord.ServiceDescription.Category.IsBillable || Model.NewServiceRecord.ServiceDescription.Category.BillableAmount > 0m || Model.NewServiceRecord.ServiceDescription.BillableAmount > 0m))
if(Model.NewServiceRecord.CostBearer != null && Model.ShowSignature && (Model.NewServiceRecord.ServiceDescription.Category.IsBillable || Model.NewServiceRecord.ServiceDescription.Category.BillableAmount > 0m || Model.NewServiceRecord.ServiceDescription.BillableAmount > 0m))
{
TempData[TempDataConstants.ShowSignatureSuggestionPopup] = true;
}
}
if(appointmentPrototype is object)
if(false == appointmentPrototype is null)
{
var isRecurring = !(appointmentPrototype.RecurrenceInfo is null);
var serviceRecord = OperationsService.GetServiceRecordById(Model.LastCreatedServiceRecordOid);
if(isRecurring && appointmentPrototype.Type != (int) AppointmentType.ChangedOccurrence)
if(appointmentPrototype.ServiceRecordList is null)
{
var id = appointmentPrototype.RecurrenceIdReference;
var recurrenceInfo = new RecurrenceInfo();
recurrenceInfo.FromXml(appointmentPrototype.RecurrenceInfo);
var occurrenceCalculator = OccurrenceCalculator.CreateInstance(recurrenceInfo);
var pattern = StaticAppointmentFactory.CreateAppointment(AppointmentType.Pattern);
pattern.RecurrenceInfo.FromXml(appointmentPrototype.RecurrenceInfo);
pattern.Start = pattern.RecurrenceInfo.Start;
pattern.End = pattern.RecurrenceInfo.End;
var occurrence = occurrenceCalculator.CalcOccurrences(new TimeInterval(appointmentPrototype.StartDate.Value, appointmentPrototype.EndDate.Value), pattern).FirstOrDefault();
if(!(occurrence is null))
{
var index = occurrence.RecurrenceIndex;
appointmentPrototype = SchedulerController.CloneAppointment(appointmentPrototype, $"<RecurrenceInfo Id=\"{id}\" Index=\"{index}\" />", (int)AppointmentType.ChangedOccurrence);
}
else
{
appointmentPrototype = null;
}
appointmentPrototype.ServiceRecordList = new List<ServiceRecordDC>();
}
if(appointmentPrototype is object)
appointmentPrototype.ServiceRecordList.AddIfNotIn(serviceRecord);
if(appointmentPrototype.SchedulerAppointmentOid.HasValue)
{
var serviceRecord = OperationsService.GetServiceRecordById(Model.LastCreatedServiceRecordOid);
appointmentPrototype.ServiceRecordList.AddIfNotIn(serviceRecord);
if(appointmentPrototype.SchedulerAppointmentOid.HasValue)
{
KalenderService.UpdateSchedulerAppointments(new List<SchedulerAppointmentDC> { appointmentPrototype });
}
else
{
KalenderService.InsertSchedulerAppointments(new List<SchedulerAppointmentDC> { appointmentPrototype });
}
KalenderService.UpdateSchedulerAppointments(new List<SchedulerAppointmentDC> { appointmentPrototype });
}
else
{
KalenderService.InsertSchedulerAppointments(new List<SchedulerAppointmentDC> { appointmentPrototype });
}
}
}
@@ -1580,7 +1563,7 @@ namespace BeWoPlanerMobil.Controllers
var previousStartDate = Model.IsInEditingMode ? Model.SelectedServiceRecord?.Start : Model.NewServiceRecord?.Start;
var previousEndDate = Model.IsInEditingMode ? Model.SelectedServiceRecord?.End : Model.NewServiceRecord?.End;
if(!(previousStartDate is null) && !(previousEndDate is null))
if(previousStartDate.HasValue && previousEndDate.HasValue)
{
var duration = (previousEndDate - previousStartDate).Value.TotalMinutes;
@@ -1595,7 +1578,7 @@ namespace BeWoPlanerMobil.Controllers
{
Log.Error(e.Message, e);
}
if (!Model.IsInGroupBookingMode && !Model.IsInMultiBookingMode)
if (false == Model.IsInGroupBookingMode && !Model.IsInMultiBookingMode)
{
//Setze den zuletzt ausgewählten HP zurück, sonst springt die Anzeige dorthin
Model.PreviouslySelectedCostbearer2SupportConceptOid = null;
@@ -1605,7 +1588,7 @@ namespace BeWoPlanerMobil.Controllers
long? oldCatOid = null;
long? oldDescOid = null;
if(!Model.IsInEditingMode)
if(false == Model.IsInEditingMode)
{
oldCatOid = Model.SelectedServiceCategoryOid;
oldDescOid = Model.SelectedServiceDescriptionOid;
@@ -1674,6 +1657,12 @@ namespace BeWoPlanerMobil.Controllers
if(newDCList.Count == 1)
{
OperationsService.InsertNewServiceRecords(newDCList);
if(TempData[TempDataConstants.AppointmentOccurrenceToInsertKey] is SchedulerAppointmentDC occurrenceToInsert)
{
KalenderService.InsertSchedulerAppointment(occurrenceToInsert);
}
TempData[TempDataConstants.AfterInsertKey] = true;
}
else
@@ -1703,13 +1692,28 @@ namespace BeWoPlanerMobil.Controllers
TempData[TempDataConstants.AfterInsertKey] = true;
if(Model.TransferringAppointmentOid.HasValue && Model.LoggedInEmployee.EmployeeOid.HasValue)
if((Model.TransferringAppointmentOid is null && TempData[TempDataConstants.AppointmentOccurrenceToInsertKey] is null) || Model.LoggedInEmployee?.EmployeeOid is null)
{
var app = DAOFactory.GenericDAO.LoadByID<SchedulerAppointment>(Model.TransferringAppointmentOid.Value);
var appointment = MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDC(app);
return ResetEditingMode();
}
appointment.ServiceRecordList.AddRange(serviceRecords);
var appointment = Model.TransferringAppointmentOid is null ?
(SchedulerAppointmentDC) TempData[TempDataConstants.AppointmentOccurrenceToInsertKey] :
MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDC(DAOFactory.GenericDAO.LoadByID<SchedulerAppointment>(Model.TransferringAppointmentOid.Value));
if(appointment.ServiceRecordList is null)
{
appointment.ServiceRecordList = new List<ServiceRecordDC>();
}
appointment.ServiceRecordList.AddRange(serviceRecords);
// ToDo: Ist immer noch nicht mit den ServiceRecords verbunden!
if(appointment.SchedulerAppointmentOid is null)
{
KalenderService.InsertSchedulerAppointments(new List<SchedulerAppointmentDC> { appointment });
}
else
{
KalenderService.UpdateSchedulerAppointments(new List<SchedulerAppointmentDC> { appointment });
}
}
@@ -2712,6 +2716,11 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
if(TempData[TempDataConstants.AppointmentOccurrenceToInsertKey] is SchedulerAppointmentDC occurrenceToInsert)
{
TempData[TempDataConstants.AppointmentOccurrenceToInsertKey] = occurrenceToInsert;
}
var inEditMode = Model.IsInEditingMode;
var von = formCollection[FormCollectionConstants.DateKey];
@@ -2740,12 +2749,12 @@ namespace BeWoPlanerMobil.Controllers
var startHoursDt = ConvertTimeStringToDateTime(start);
var endHoursDt = ConvertTimeStringToDateTime(end);
if(!DateTime.TryParse(von, out var startDate))
if(false == DateTime.TryParse(von, out var startDate))
{
startDate = DateTime.Now.Date;
}
if(!DateTime.TryParse(bis, out var endDate))
if(false == DateTime.TryParse(bis, out var endDate))
{
endDate = DateTime.Now.Date;
}
@@ -2803,10 +2812,7 @@ namespace BeWoPlanerMobil.Controllers
if(supportConcept != null)
{
if(supportConcept.SupportConceptOid != null)
{
checkServiceRecord.SupportConcept = GetCompactSupportConcept(supportConcept.SupportConceptOid, Model.SelectedCostBearerSupportConceptOid);
}
checkServiceRecord.SupportConcept = GetCompactSupportConcept(supportConcept.SupportConceptOid, Model.SelectedCostBearerSupportConceptOid);
checkServiceRecord.Customer = supportConcept.Customer;
var costbearer = supportConcept.CostBearerList.FirstOrDefault();
@@ -3950,7 +3956,7 @@ namespace BeWoPlanerMobil.Controllers
try
{
if(!Model.IsInEditingMode)
if(false == Model.IsInEditingMode)
{
if(Model.GroupBookingSelectedCostBearerSupportConceptOids.Count == 1)
{
@@ -4235,8 +4241,6 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
/// <summary>
/// Bereitet die Übernahme eines Termins in die Zeiterfassung vor. Wird im SchedulerController aufgerufen.
@@ -4245,7 +4249,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult PrepareServiceRecordInsert()
{
if(!IsUserLoggedIn())
if(false == IsUserLoggedIn())
{
TempData[TempDataConstants.DoLogoutKey] = true;
return Logout();
@@ -4269,19 +4273,11 @@ namespace BeWoPlanerMobil.Controllers
var startRaw = TempData[TempDataConstants.AppointmentStartKey]?.ToString();
var endRaw = TempData[TempDataConstants.AppointmentEndKey]?.ToString();
var subject = TempData[TempDataConstants.AppointmentSubjectKey]?.ToString();
var isAllDay = false;
if(TempData[TempDataConstants.AppointmentIsAllDayKey] is bool isAllDayRaw && isAllDayRaw)
{
isAllDay = true;
}
else if(appointment != null)
{
isAllDay = appointment.AllDay;
}
var isAllDay = TempData[TempDataConstants.AppointmentIsAllDayKey] is true;
var customerOids = new List<long>();
var employeeOids = new List<long>();
var resourceOids = new List<long>();
if(TempData[TempDataConstants.AppointmentEmployeeOidsKey] is string employeeOidsRaw && employeeOidsRaw.Length > 0)
{
@@ -4293,22 +4289,24 @@ namespace BeWoPlanerMobil.Controllers
customerOids = Utils.ConvertCharSeparatedValuesToLongList(customerOidsRaw, ',');
}
var isStartParsingSuccessful = DateTime.TryParse(startRaw, out var parsedStart);
var isEndParsingSuccessful = DateTime.TryParse(endRaw, out var parsedEnd);
if(TempData[TempDataConstants.AppointmentResourceOidsKey] is string resourceOidsRaw && resourceOidsRaw.Length > 0)
{
resourceOids = Utils.ConvertCharSeparatedValuesToLongList(resourceOidsRaw, ',');
}
var start = appointment is null ? parsedStart : appointment.StartDate;
var end = appointment is null ? parsedEnd : appointment.EndDate;
DateTime.TryParse(startRaw, out var start);
DateTime.TryParse(endRaw, out var end);
if(appointment is object)
{
customerOids = appointment.CustomerList.Select(customer => customer.CustomerOid).ToList();
employeeOids = appointment.EmployeeList.Select(e2a => e2a.Employee.EmployeeOid).ToList();
}
if(isAllDay && start.HasValue && end.HasValue)
if(isAllDay)
{
start = start.Value.MergeDateWithHoursMinutesSeconds(0, 0, 1);
end = end.Value.MergeDateWithHoursMinutesSeconds(0, 0, 1);
start = start.MergeDateWithHoursMinutesSeconds(0, 0, 1);
end = end.MergeDateWithHoursMinutesSeconds(0, 0, 1);
}
if(employeeOids.Count == 0)
@@ -4317,11 +4315,16 @@ namespace BeWoPlanerMobil.Controllers
}
var notice = appointment?.Description ?? TempData[TempDataConstants.AppointmentSubjectKey]?.ToString();
if(appointment is null)
{
notice = TempData[TempDataConstants.AppointmentDescriptionKey]?.ToString() ??
TempData[TempDataConstants.AppointmentSubjectKey]?.ToString();
}
Model.SupportConceptListObjects.Clear(); //Macht, dass beim Init die SupportConcepts neu geladen werden
InitViewModel(true);
var supportConcepts = Model.SupportConcepts.Where(sc => customerOids.Contains(sc.Customer.CustomerOid) && sc.StartDate.HasValue && sc.EndDate.HasValue && start.Value.AreInBetweenDates(end.Value, sc.StartDate.Value, sc.EndDate.Value)).ToList();
var supportConcepts = Model.SupportConcepts.Where(sc => customerOids.Contains(sc.Customer.CustomerOid)).ToList();
var supportConceptList = new List<CompactSupportConceptDC>();
@@ -4337,6 +4340,49 @@ namespace BeWoPlanerMobil.Controllers
supportConceptList.AddIfNotIn(supportConcept);
}
// Falls es sich um einen Serientermin handelt, Ausnahme erstellen und speichern, nachdem der Eintrag in der Datenbank gespeichert wurde.
if(isSerientermin && appointment is null)
{
var customers = CustomerService.GetCompactCustomersById(customerOids);
var employees = EmployeeService.GetActiveCompactEmployeesByOids(employeeOids);
var resources = OperationsService.GetResourcesByOids(resourceOids);
appointment = new SchedulerAppointmentDC
{
StartDate = start,
EndDate = end,
ActivationType = ActivationTypeId.Active,
AllDay = isAllDay,
CustomerList = customers,
ResourceList = resources,
EmployeeList = new List<Employee2SchedulerAppointmentDC>(),
Location = TempData[TempDataConstants.AppointmentLocationKey]?.ToString(),
IsPrivate = TempData[TempDataConstants.AppointmentIsPrivateKey] is true,
Subject = subject,
SupportConceptList = supportConceptList,
Type = (int) AppointmentType.ChangedOccurrence,
Originator = Model.LoggedInUser.Employee
};
foreach(var employee in employees)
{
appointment.EmployeeList.Add(new Employee2SchedulerAppointmentDC { Employee = employee });
}
var recurrenceInfo = TempData[TempDataConstants.AppointmentRecurrenceInfoKey].ToString();
var pattern = StaticAppointmentFactory.CreateAppointment(AppointmentType.Pattern);
pattern.RecurrenceInfo.FromXml(recurrenceInfo);
pattern.Start = pattern.RecurrenceInfo.Start;
pattern.End = pattern.RecurrenceInfo.End;
var apt = pattern.CreateException(AppointmentType.ChangedOccurrence, recurrenceIndex.Value);
appointment = SchedulerAppointmentDC.RecurringExceptionFromDevExpressAppointment(apt, appointment, recurrenceIndex.Value, pattern.RecurrenceInfo.Id.ToString());
TempData[TempDataConstants.AppointmentOccurrenceToInsertKey] = appointment;
}
// Ohne Hilfeplan
if(supportConceptList.Count == 0)
{
@@ -4349,7 +4395,7 @@ namespace BeWoPlanerMobil.Controllers
if(Model.SelectedServiceDescription != null)
{
Model.SelectedServiceCategory = Model.SelectedServiceDescription.Category;
var serviceRecord = CreateServiceRecordFromScratch(start.Value, end.Value, null, Model.SelectedEmployee, notice);
var serviceRecord = CreateServiceRecordFromScratch(start, end, null, Model.SelectedEmployee, notice);
serviceRecord.ServiceDescription = Model.SelectedServiceDescription;
Model.SelectedServiceRecord = serviceRecord;
}
@@ -4377,7 +4423,7 @@ namespace BeWoPlanerMobil.Controllers
LoadSupportConceptThings(scListObject.CostBearer2SupportConceptOid, true);
}
var serviceRecord = CreateServiceRecordFromScratch(start.Value, end.Value, compactSupportConcept?.Customer, Model.SelectedEmployee, notice);
var serviceRecord = CreateServiceRecordFromScratch(start, end, compactSupportConcept?.Customer, Model.SelectedEmployee, notice);
var costBearer = compactSupportConcept?.CostBearerList.FirstOrDefault();
@@ -4391,6 +4437,7 @@ namespace BeWoPlanerMobil.Controllers
{
Model.SelectedServiceRecord = serviceRecord;
}
Model.SelectedCostBearerSupportConceptOid = cb2ScOid;
}
else // Gruppenbuchung
@@ -4399,9 +4446,9 @@ namespace BeWoPlanerMobil.Controllers
Model.GroupBookingSelectedEmployees = Model.AllEmployees.Where(w => employeeOids.Contains(w.EmployeeOid)).ToList();
var roundedDuration = (int) ((end - start)?.TotalMinutes ?? 0);
var roundedDuration = (int) (end - start).TotalMinutes;
Model.SelectedServiceRecord = new ServiceRecordDC()
Model.SelectedServiceRecord = new ServiceRecordDC
{
Start = start,
End = end,
@@ -4427,29 +4474,12 @@ namespace BeWoPlanerMobil.Controllers
if(costBearer2SupportConceptOids.Any())
{
Model.GroupBookingSelectedCostBearerSupportConceptOids = costBearer2SupportConceptOids;
//Model.SelectedConceptCostBearerRelations = costBearer2SupportConcepts;
//Model.GroupBookingSelectedSupportConcepts = supportConceptsForGroupBooking;
}
Model.GroupBookingSelectedEmployeeOids = employeeOids;
}
}
// ToDo: Falls es sich um einen Serientermin handelt, Ausnahme erstellen und speichern, nachdem der Eintrag in der Datenbank gespeichert wurde.
if(isSerientermin)
{
var recurrenceInfo = appointment.RecurrenceInfo;
var pattern = StaticAppointmentFactory.CreateAppointment(AppointmentType.Pattern);
pattern.RecurrenceInfo.FromXml(recurrenceInfo);
var apt = pattern.CreateException(AppointmentType.ChangedOccurrence, recurrenceIndex.Value);
var changedOccurrence = SchedulerAppointmentDC.RecurringExceptionFromDevExpressAppointment(apt, appointment);
var x = apt.RecurrenceIndex;
}
Model.SelectedServiceRecordOid = Model.SelectedServiceRecord?.ServiceRecordOid;
SetSelectedObjects();
@@ -4529,7 +4559,6 @@ namespace BeWoPlanerMobil.Controllers
return RedirectToActionPermanent("Main");
}
#region Mehrfachbuchung
[Authorize]
@@ -4547,8 +4576,6 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("MultiBookingSelectionPartial", Model);
}
[Authorize]
public ActionResult RemoveSupportConceptCostbearerRelFromMultiBooking(string relOid)
{
@@ -4838,6 +4865,11 @@ namespace BeWoPlanerMobil.Controllers
OperationsService.InsertNewServiceRecords(serviceRecordsToInsert);
if(TempData[TempDataConstants.AppointmentOccurrenceToInsertKey] is SchedulerAppointmentDC occurrenceToInsert)
{
KalenderService.InsertSchedulerAppointment(occurrenceToInsert);
}
TempData[TempDataConstants.AfterInsertKey] = true;
}
}

View File

@@ -1433,21 +1433,27 @@ namespace BeWoPlanerMobil.Controllers
if(appointment?.RecurrenceInfo != null)
{
TempData[TempDataConstants.AppointmentRecurrenceIndexKey] = appointment?.RecurrenceIndex;
TempData[TempDataConstants.AppointmentRecurrenceInfoKey] = appointment.RecurrenceInfo;
TempData[TempDataConstants.AppointmentRecurrenceIndexKey] = appointment.RecurrenceIndex;
}
TempData[TempDataConstants.AppointmentLocationKey] = appointment?.Location;
TempData[TempDataConstants.AppointmentIsPrivateKey] = appointment?.IsPrivate ?? false;
TempData[TempDataConstants.AppointmentDescriptionKey] = appointment?.Description;
TempData[TempDataConstants.AppointmentStartKey] = appointment?.StartDate;
TempData[TempDataConstants.AppointmentEndKey] = appointment?.EndDate;
TempData[TempDataConstants.AppointmentSubjectKey] = appointment?.Subject;
TempData[TempDataConstants.AppointmentIsAllDayKey] = appointment?.AllDay ?? false;
TempData[TempDataConstants.AppointmentCustomerOidsKey] = string.Join(",", appointment?.CustomerList.Select(s => s.CustomerOid) ?? new List<long>());
TempData[TempDataConstants.AppointmentCustomerOidsKey] = string.Join(",", appointment?.CustomerList.Select(customer => customer.CustomerOid) ?? new List<long>());
TempData[TempDataConstants.AppointmentEmployeeOidsKey] = string.Join(",", appointment?.EmployeeList.Select(s => s.Employee.EmployeeOid) ?? new List<long>());
TempData[TempDataConstants.AppointmentEmployeeOidsKey] = string.Join(",", appointment?.EmployeeList.Select(employee2Appointment => employee2Appointment.Employee.EmployeeOid) ?? new List<long>());
TempData[TempDataConstants.AppointmentResourceOidsKey] = string.Join(",", appointment?.ResourceList.Where(resource => resource.ResourceOid.HasValue).Select(resource => resource.ResourceOid.Value) ?? new List<long>());
TempData[TempDataConstants.AppointmentIsSerienterminKey] = appointment != null && appointment.SchedulerAppointmentOid is null && appointment.RecurrenceInfo is string;
return RedirectToActionPermanent("PrepareServiceRecordInsert", "Main");
}

View File

@@ -109,5 +109,11 @@
public static string IsGroupTabActiveKey => "IsGroupTabActive";
public static string AfterInsertKey => "AfterInsert";
public static string AppointmentRecurrenceIndexKey => "AppointmentRecurrenceIndex";
public static string AppointmentRecurrenceInfoKey => "AppointmentRecurrenceInfo";
public static string AppointmentResourceOidsKey => "AppointmentResourceOids";
public static string AppointmentLocationKey => "Location";
public static string AppointmentIsPrivateKey => "IsPrivate";
public static string AppointmentDescriptionKey => "Description";
public static string AppointmentOccurrenceToInsertKey => "AppointmentOccurrenceToInsert";
}
}

View File

@@ -50,7 +50,15 @@
$("#all-customers-checkbox").prop("checked", (allCustomersCount === selectedCustomersCount));
$("#customer-input-container").load("@Url.Action("UpdateCustomerSelection")", { selectedCustomerOids: selectedCustomerOids }, () => { scheduler.Refresh(); });
showSpinner();
$("#customer-input-container").load(
"@Url.Action("UpdateCustomerSelection")",
{ selectedCustomerOids: selectedCustomerOids },
() => {
scheduler.Refresh();
hideSpinner();
}
);
}
</script>

View File

@@ -54,10 +54,20 @@
const selectedEmployeeOids = $("#employee-input-container input:checked").map(function() { return $(this).attr("id").split("-")[1]; }).get();
const allEmployeesCount = $("#employee-input-container input[type=checkbox]").map(function () { return $(this).attr("id").split("-")[1]; }).get().length;
const selectedEmployeesCount = selectedEmployeeOids.length;
console.log(selectedEmployeeOids);
$("#all-employees-checkbox").prop("checked", (allEmployeesCount === selectedEmployeesCount));
$("#employee-input-container").load("@Url.Action("UpdateEmployeeSelection", "DevExpressScheduler")", {selectedEmployeeOids: selectedEmployeeOids }, () => { scheduler.Refresh(); });
showSpinner();
$("#employee-input-container").load(
"@Url.Action("UpdateEmployeeSelection", "DevExpressScheduler")",
{
selectedEmployeeOids: selectedEmployeeOids
},
() => {
scheduler.Refresh();
hideSpinner();
});
}
</script>

View File

@@ -1,5 +1,4 @@
@using BeWoPlanerMobil.Util
@using BS.Shared.Extensions
@using BS.Shared.Extensions
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
<script type="text/javascript">
@@ -9,8 +8,6 @@
$("#resource-input-container").load("@Url.Action("SelectAllResourcesForFiltering")", { isChecked: isChecked }, () => { scheduler.Refresh(); });
}
function removeSelectedResource(resourceOid) {
const checkbox = $(`#resource-${resourceOid}-checkbox`);
@@ -28,7 +25,17 @@
$("#all-resources-checkbox").prop("checked", (allResourcesCount === selectedResourcesCount));
$("#resource-input-container").load("@Url.Action("UpdateResourceSelection")", { selectedResourceOids: selectedResourceOids }, () => { scheduler.Refresh(); });
showSpinner();
$("#resource-input-container").load(
"@Url.Action("UpdateResourceSelection")",
{
selectedResourceOids: selectedResourceOids
},
() => {
scheduler.Refresh();
hideSpinner();
}
);
}
</script>

View File

@@ -1,140 +1,157 @@
@using BeWoPlanerMobil.Util.Constants
@using BeWoPlanerMobil.Util.SchedulerUtils
@using BS.Shared.DataContracts.Compact
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
@model BeWoPlanerMobil.Models.DevExpressSchedulerModel
@{
ViewBag.Title = "DevExpressScheduler";
}
<script type="text/javascript">
function UpdateSchedulerHeight() {
scheduler.SetHeight(1);
$(window).on("load", () => {
$("#employees-popup-apt-flt").on("hide.bs.modal", function(e) {
$.get("@Url.Action("GetSelectedEmployeesForAptFlt")", function(numberOfSelectedEmployees) {
$("#sel-emp-bdg").text(numberOfSelectedEmployees);
});
});
var containerHeight = ASPxClientUtils.GetDocumentClientHeight();
$("#customers-popup-apt-flt").on("hide.bs.modal", function(e) {
$.get("@Url.Action("GetSelectedCustomersForAptFlt")", function(numberOfSelectedCustomers) {
$("#sel-cus-bdg").text(numberOfSelectedCustomers);
});
});
if(document.body.scrollHeight > containerHeight) {
containerHeight = document.body.scrollHeight;
}
$("#resources-popup-apt-flt").on("hide.bs.modal", function(e) {
$.get("@Url.Action("GetSelectedResourcesForAptFlt")", function(numberOfSelectedResources) {
$("#sel-res-bdg").text(numberOfSelectedResources);
});
});
});
scheduler.SetHeight(containerHeight);
}
function UpdateSchedulerHeight() {
scheduler.SetHeight(1);
function resizeSchedulerEditForm() {
const editFormPopup = $("#abc-table").parent().parent().parent();
var containerHeight = ASPxClientUtils.GetDocumentClientHeight();
const vw = $(window).width();
if(document.body.scrollHeight > containerHeight) {
containerHeight = document.body.scrollHeight;
}
if(editFormPopup.outerWidth() !== undefined && vw < 678) {
const newWidth = vw * .95;
scheduler.SetHeight(containerHeight);
}
const allChildren = editFormPopup.parent().find("*");
function resizeSchedulerEditForm() {
const editFormPopup = $("#abc-table").parent().parent().parent();
allChildren.each((index, element) => {
const item = $(element);
const vw = $(window).width();
if(item[0].tagName === "SCRIPT") {
return;
}
if(editFormPopup.outerWidth() !== undefined && vw < 678) {
const newWidth = vw * .95;
if(item.width() > newWidth) {
item.outerWidth(newWidth);
item.css("max-width", newWidth);
}
});
const allChildren = editFormPopup.parent().find("*");
$("#abc-table").siblings().css("max-width", newWidth);
allChildren.each((index, element) => {
const item = $(element);
editFormPopup.outerWidth(newWidth);
editFormPopup.css("max-width", newWidth);
editFormPopup.css("left", "0");
editFormPopup.css("top", "0");
editFormPopup.css("position", "relative");
editFormPopup.css("margin", "0 auto");
}
}
if(item[0].tagName === "SCRIPT") {
return;
}
function OnAppointmentFormSave(s, e) {
if(IsValidAppointment()) {
scheduler.AppointmentFormSave();
}
}
if(item.width() > newWidth) {
item.outerWidth(newWidth);
item.css("max-width", newWidth);
}
});
function IsValidAppointment() {
$.validator.unobtrusive.parse("form");
$("#abc-table").siblings().css("max-width", newWidth);
return $("form").valid();
}
editFormPopup.outerWidth(newWidth);
editFormPopup.css("max-width", newWidth);
editFormPopup.css("left", "0");
editFormPopup.css("top", "0");
editFormPopup.css("position", "relative");
editFormPopup.css("margin", "0 auto");
}
}
function CloseCustomerGridLookup() {
CustomerGridLookup.ConfirmCurrentSelection();
CustomerGridLookup.HideDropDown();
}
function OnAppointmentFormSave(s, e) {
if(IsValidAppointment()) {
scheduler.AppointmentFormSave();
}
}
function CloseEmployeeGridLookup() {
EmployeeGridLookup.ConfirmCurrentSelection();
EmployeeGridLookup.HideDropDown();
}
function IsValidAppointment() {
$.validator.unobtrusive.parse("form");
function CloseResourceGridLookup() {
ResourceGridLookup.ConfirmCurrentSelection();
ResourceGridLookup.HideDropDown();
}
return $("form").valid();
}
ASPxClientControl.GetControlCollection().ControlsInitialized.AddHandler(function(s, e) {
UpdateSchedulerHeight();
});
function CloseCustomerGridLookup() {
CustomerGridLookup.ConfirmCurrentSelection();
CustomerGridLookup.HideDropDown();
}
ASPxClientControl.GetControlCollection().BrowserWindowResized.AddHandler(function(s, e) {
UpdateSchedulerHeight();
});
function CloseEmployeeGridLookup() {
EmployeeGridLookup.ConfirmCurrentSelection();
EmployeeGridLookup.HideDropDown();
}
function onActiveViewChanged(s, e) {
$.get("@Url.Action("SelectActiveViewType")", { viewTypeName: e.newView });
}
function CloseResourceGridLookup() {
ResourceGridLookup.ConfirmCurrentSelection();
ResourceGridLookup.HideDropDown();
}
function onMenuItemClicked(s, e) {
try {
if(e.itemName === "ToServiceRecord") {
e.handled = true;
scheduler.PerformCallback({ apptID: scheduler.GetSelectedAppointmentIds()[0], actionId: e.itemName });
}
ASPxClientControl.GetControlCollection().ControlsInitialized.AddHandler(function(s, e) {
UpdateSchedulerHeight();
});
if(e.itemName === "ShowAvailableEmployees") {
const start = scheduler.selection.interval.start;
const duration = scheduler.selection.interval.duration;
const tmpDate = new Date();
ASPxClientControl.GetControlCollection().BrowserWindowResized.AddHandler(function(s, e) {
UpdateSchedulerHeight();
});
const end = new Date(tmpDate.setTime(start.getTime() + duration));
function onActiveViewChanged(s, e) {
$.get("@Url.Action("SelectActiveViewType")", { viewTypeName: e.newView });
}
e.handled = true;
function onMenuItemClicked(s, e) {
try {
if(e.itemName === "ToServiceRecord") {
e.handled = true;
scheduler.PerformCallback({ apptID: scheduler.GetSelectedAppointmentIds()[0], actionId: e.itemName });
}
const startStr = getTimeStamp(start, false, false);
const endStr = getTimeStamp(end, false, false);
if(e.itemName === "ShowAvailableEmployees") {
const start = scheduler.selection.interval.start;
const duration = scheduler.selection.interval.duration;
const tmpDate = new Date();
$("#scheduler-container").load("@Url.Action("CheckEmployeeAvailability")", {startString: startStr, endString: endStr});
}
} catch(error) {
console.error(error);
}
}
const end = new Date(tmpDate.setTime(start.getTime() + duration));
function OnAppointmentMenuPopup(s, e) {
const selectedAppointment = scheduler.GetAppointmentById(scheduler.GetSelectedAppointmentIds()[0]);
console.log(selectedAppointment);
for(let i = 0; i < e.item.items.length; i++) {
const currentItem = e.item.items[i];
e.handled = true;
if(currentItem.name === "ToServiceRecord") {
const isTask = selectedAppointment.customField("IsTask");
const isAbsenceTime = selectedAppointment.customField("IsAbsenceTime");
const startStr = getTimeStamp(start, false, false);
const endStr = getTimeStamp(end, false, false);
if(isTask === true || isAbsenceTime === true) {
currentItem.SetVisible(false);
}
}
}
}
$("#scheduler-container").load("@Url.Action("CheckEmployeeAvailability")", {startString: startStr, endString: endStr});
}
} catch(error) {
console.error(error);
}
}
function OnAppointmentMenuPopup(s, e) {
const selectedAppointment = scheduler.GetAppointmentById(scheduler.GetSelectedAppointmentIds()[0]);
console.log(selectedAppointment);
for(let i = 0; i < e.item.items.length; i++) {
const currentItem = e.item.items[i];
if(currentItem.name === "ToServiceRecord") {
const isTask = selectedAppointment.customField("IsTask");
const isAbsenceTime = selectedAppointment.customField("IsAbsenceTime");
if(isTask === true || isAbsenceTime === true) {
currentItem.SetVisible(false);
}
}
}
}
</script>
<div class="dropdown">
@@ -212,17 +229,17 @@
<a href="#" class="dropdown-item" onclick="$('#employees-popup-apt-flt').modal('show')">
<i class="fas fa-user text-bewo-employee"></i>
Mitarbeiter
<span class="badge badge-bewo-employee">0</span>
<span class="badge badge-bewo-employee" id="sel-emp-bdg">0</span>
</a>
<a href="#" class="dropdown-item" onclick="$('#customers-popup-apt-flt').modal('show')">
<i class="fas fa-user text-bewo-customers"></i>
Klienten
<span class="badge badge-bewo-customers">0</span>
<span class="badge badge-bewo-customers" id="sel-cus-bdg">0</span>
</a>
<a href="#" class="dropdown-item">
<i class="fas fa-cubes text-bewo-resource" onclick="$('#resources-popup-apt-flt').modal('show')"></i>
Ressourcen
<span class="badge badge-bewo-resource">0</span>
<span class="badge badge-bewo-resource" id="sel-res-bdg">0</span>
</a>
</div>
</div>

View File

@@ -266,7 +266,7 @@
<hr />
}
@if(Model.HasRightToEditAppointment(appointment.Identifier) && !appointment.IsTask && appointment.CanBeEdited)
@if(Model.HasRightToEditAppointment(appointment.Identifier) && false == appointment.IsTask && appointment.CanBeEdited)
{
<div class="row mb-3 p-0">
@if(appointment.Oid.HasValue)
@@ -283,9 +283,9 @@
}
<div class="col-auto">
<button type="button" class="btn btn-primary" onclick="deleteAppointment(@(appointment.Oid ?? 0), '@appointment.Identifier', @appointment.IsException.ToString().ToLower(), '@appointment.Subject')">
<span class="fas fa-trash-alt"></span>
</button>
<button type="button" class="btn btn-primary" onclick="deleteAppointment(@(appointment.Oid ?? 0), '@appointment.Identifier', @appointment.IsException.ToString().ToLower(), '@appointment.Subject')">
<span class="fas fa-trash-alt"></span>
</button>
</div>
<div class="col-auto">
<button type="button" class="btn btn-bewo-service-records" onclick="copyToServiceRecord('@appointment.Identifier')">

View File

@@ -6680,6 +6680,14 @@ WHERE sc.Billable = 1 and sr.StartDate >= '{0:yyyy-MM-dd}' and sr.StartDate < '{
return transactionsCriteriaResult;
}
}
public List<Employee> GetActiveEmployeesByOids(List<long> employeeOids)
{
var criteria = CreateCriteriaIsActive<Employee>().Add(Restrictions.In(nameof(BeWoEntityBase.Oid), employeeOids));
return criteria.List<Employee>().ToList();
}
}
}

View File

@@ -528,5 +528,9 @@ namespace BeWo.Service.ServiceContracts
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<CompactTeamDC> FindLeadingCompactTeamsOfEmployee(long employeeOid);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<CompactEmployeeDC> GetActiveCompactEmployeesByOids(List<long> employeeOids);
}
}

View File

@@ -1431,5 +1431,9 @@ namespace BeWo.Service.ServiceContracts
[FaultContract(typeof(BeWoFault))]
[OperationContract]
AiVoiceDataDC GetAIVoiceTranscript(AiVoiceDataDC data);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<ResourceDC> GetResourcesByOids(List<long> resourceOids);
}
}

View File

@@ -2348,5 +2348,19 @@ namespace BeWo.Service.ServiceImplementations
throw Utils.CreateBeWoFaultException(ex);
}
}
}
public List<CompactEmployeeDC> GetActiveCompactEmployeesByOids(List<long> employeeOids)
{
try
{
var employees = DAOFactory.SearchDAO.GetActiveEmployeesByOids(employeeOids);
return MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(employees);
}
catch(Exception ex)
{
throw Utils.CreateBeWoFaultException(ex);
}
}
}
}

View File

@@ -9092,5 +9092,12 @@ namespace BeWo.Service.ServiceImplementations
throw Utils.CreateBeWoFaultException(e);
}
}
public List<ResourceDC> GetResourcesByOids(List<long> resourceOids)
{
var resources = DAOFactory.GenericDAO.GetActiveByIDs<Resource>(resourceOids);
return MapperFactory.ResourceDC_Resource.MapToNewDCs(resources);
}
}
}

View File

@@ -226,7 +226,7 @@ namespace BS.Shared.DataContracts
public override string ToString() => $"{SchedulerAppointmentOid} {StartDate:dd.MM.yyyy HH:mm}-{EndDate:dd.MM.yyyy HH:mm}: {Subject}";
public static SchedulerAppointmentDC RecurringExceptionFromDevExpressAppointment(Appointment appointment, SchedulerAppointmentDC baseAppointment)
public static SchedulerAppointmentDC RecurringExceptionFromDevExpressAppointment(Appointment appointment, SchedulerAppointmentDC baseAppointment, int recurrenceIndex, string recurrenceId)
{
return new SchedulerAppointmentDC
{
@@ -242,12 +242,12 @@ namespace BS.Shared.DataContracts
FormerBookingSequenceOid = baseAppointment.FormerBookingSequenceOid,
IsPrivate = baseAppointment.IsPrivate,
Location = baseAppointment.Location,
StartDate = appointment.Start,
EndDate = appointment.End,
StartDate = baseAppointment.StartDate,
EndDate = baseAppointment.EndDate,
RecurrenceId = appointment.RecurrenceInfo.Id.ToString(),
LabelKey = (long?) appointment.LabelKey,
RecurrenceIndex = appointment.RecurrenceIndex,
RecurrenceInfo = appointment.RecurrenceInfo.ToXml(),
RecurrenceInfo = $"<RecurrenceInfo Id=\"{recurrenceId}\" Index=\"{recurrenceIndex}\" />",
Type = (int) appointment.Type,
SupportConceptList = baseAppointment.SupportConceptList,
ServiceRecordList = baseAppointment.ServiceRecordList