692 lines
33 KiB
C#
692 lines
33 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
using BeWo.ViewModel;
|
|
|
|
using BS.Shared.Extensions;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Threading;
|
|
using System.Collections.Generic;
|
|
using BeWo.Core.Service;
|
|
using BeWo.View;
|
|
using BeWo.ViewModel.ListViewModel;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using ChatController.ChatKlassen;
|
|
using DevExpress.XtraScheduler;
|
|
using BeWo.View.Detail.Zeiterfassung;
|
|
using BeWo.ServiceProxy;
|
|
using System.Linq;
|
|
using DevExpress.Xpf.Scheduling;
|
|
|
|
namespace BeWo.ownChat
|
|
{
|
|
public partial class ChatDokumentationsView
|
|
{
|
|
private ServiceRecordVM _ServiceRecord;
|
|
|
|
public ChatDokumentationsView() {}
|
|
|
|
public ChatDokumentationsView(ServiceRecordListVM list, ServiceRecordVM serviceRecord)
|
|
{
|
|
InitializeComponent();
|
|
|
|
_ServiceRecord = serviceRecord;
|
|
|
|
var newView = new ServiceRecordEditView();
|
|
newView.InitView(list, serviceRecord, false);
|
|
|
|
newView.SetSearchText(serviceRecord.Customer != null ? serviceRecord.Customer.LastName : "");
|
|
|
|
CommandBindingsCloseSave(newView, null);
|
|
|
|
Popup_Content(newView);
|
|
}
|
|
|
|
|
|
//public ChatDokumentationsView(List<ChatMessage> messages, CompactCustomerDC compactCustomer)
|
|
//{
|
|
// InitializeComponent();
|
|
|
|
// CreateControl(messages, compactCustomer);
|
|
//}
|
|
|
|
//private void CreateControl(List<ChatMessage> messages, CompactCustomerDC compactCustomer)
|
|
//{
|
|
|
|
|
|
|
|
|
|
|
|
// Cache.GetInstance().GetActiveSupportConceptCostbearer(scList =>
|
|
// VMFactory.CreateServiceRecordVMAsync(
|
|
// BeWoApp.LoggedOnUser.Employee.EmployeeOid,
|
|
// vm => this.Dispatch(
|
|
// delegate
|
|
// {
|
|
// var newView = new ServiceRecordEditView();
|
|
|
|
// vm.DispatcherObject = this;
|
|
|
|
// var dc = SupportConceptService.ErstelleServiceRecordDC(firstTime, lastTime, compactCustomer, scList);
|
|
|
|
// if(vm.PrototypeVM.SortedCategories != null && vm.PrototypeVM.SortedCategories.Count > 0)
|
|
// {
|
|
// var cat1 = vm.PrototypeVM.SortedCategories[0];
|
|
|
|
// dc.ServiceDescription = vm.PrototypeVM.Category2Services[cat1][0];
|
|
// }
|
|
|
|
// serviceRecord = new ServiceRecordVM(dc, vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals)
|
|
// {
|
|
// Notice = message
|
|
// };
|
|
|
|
// if(serviceRecord.SupportConcept == null)
|
|
// {
|
|
// MessageBox.Show(
|
|
// Translator.Translate("Es wurde kein passender Hilfeplan gefunden."),
|
|
// "ownChat Fehler", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
|
|
// return;
|
|
// }
|
|
|
|
// newView.InitView(vm, serviceRecord, false);
|
|
|
|
// newView.SetSearchText(compactCustomer != null ? compactCustomer.LastName : "");
|
|
|
|
// CommandBindingsCloseSave(newView);
|
|
|
|
// Popup_Content(newView);
|
|
|
|
// EndWaiting();
|
|
// })));
|
|
//}
|
|
|
|
//Konstruktor für Kalender
|
|
public ChatDokumentationsView(string notice, CompactCustomerDC _compactCustomer, DateTime startDate, DateTime endDate, CompactEmployeeDC employee, Action<List<ServiceRecordDC>> schedulerCallback = null, Appointment appointment = null)
|
|
{
|
|
InitializeComponent();
|
|
|
|
var customerCompact = _compactCustomer;
|
|
|
|
Cache.GetInstance().GetActiveSupportConceptCostbearer(scList =>
|
|
VMFactory.CreateServiceRecordVMAsync(
|
|
BeWoApp.LoggedOnUser.Employee.EmployeeOid,
|
|
vm => this.Dispatch(
|
|
delegate
|
|
{
|
|
if(appointment?.AllDay ?? false)
|
|
{
|
|
startDate = startDate.MergeDateWithHoursMinutesSeconds(0, 0, 1);
|
|
endDate = endDate.MergeDateWithHoursMinutesSeconds(0, 0, 1);
|
|
}
|
|
|
|
var serviceRecordEditView = new ServiceRecordEditView();
|
|
|
|
vm.DispatcherObject = this;
|
|
|
|
var dc = SupportConceptService.ErstelleServiceRecordDC(startDate, endDate, customerCompact, scList);
|
|
if(employee != null)
|
|
{
|
|
dc.Employee = employee;
|
|
}
|
|
|
|
long? scOid = null;
|
|
long? customerOid = null;
|
|
long? cb2ScOid = null;
|
|
|
|
if(customerCompact != null)
|
|
{
|
|
customerOid = customerCompact.Oid;
|
|
}
|
|
|
|
if(dc.SupportConcept != null)
|
|
{
|
|
scOid = dc.SupportConcept.SupportConceptOid;
|
|
if(dc.SupportConcept.CostBearerRelOids.Count > 0)
|
|
{
|
|
cb2ScOid = dc.SupportConcept.CostBearerRelOids[0];
|
|
}
|
|
}
|
|
|
|
if(customerOid != null && scOid != null)
|
|
{
|
|
var infoDC = ServiceFacade.DoOperationsServiceSync(s => s.GetSupportConceptTreeNodeDetailInfo(customerOid.Value, scOid, cb2ScOid));
|
|
|
|
if (infoDC.SupportConceptGoals != null && infoDC.SupportConceptGoals.Count > 0)
|
|
{
|
|
var goalCats = new List<ValueListEntryDC>();
|
|
var goals = new List<ValueListEntryDC>();
|
|
|
|
var goalCategoryDict = vm.AllGoalCategories.ToDictionary(goalCat => goalCat.ValueListEntryOid.Value);
|
|
|
|
foreach(var goal in infoDC.SupportConceptGoals)
|
|
{
|
|
if(goal.ParentOid != null && goalCategoryDict.ContainsKey(goal.ParentOid.Value))
|
|
{
|
|
var path = ServiceRecordListVM.GetAllParentGoalCategoies(goalCategoryDict, goal);
|
|
foreach(var goalCat in path)
|
|
{
|
|
goalCats.Add(goalCat);
|
|
goalCategoryDict.Remove(goalCat.ValueListEntryOid.Value);
|
|
}
|
|
}
|
|
|
|
goals.Add(goal);
|
|
}
|
|
var copyGoalCats = GoalService.CopyGoals(goalCats, false);
|
|
var copyGoals = GoalService.CopyGoals(goals, false);
|
|
|
|
vm.PrototypeVM.ChangeGoalTree(copyGoalCats, copyGoals);
|
|
}
|
|
|
|
vm.PrototypeVM.UpdateServiceAccountings(infoDC.ServiceAccountings, vm.PrototypeVM.Category2Services, true);
|
|
}
|
|
else
|
|
{
|
|
vm.PrototypeVM.UpdateServiceAccountings(null, vm.PrototypeVM.Category2Services, customerCompact != null);
|
|
}
|
|
|
|
if(vm.PrototypeVM.SortedCategories != null && vm.PrototypeVM.SortedCategories.Count > 0)
|
|
{
|
|
var cat1 = vm.PrototypeVM.SortedCategories[0];
|
|
if (vm.PrototypeVM.Category2Services.ContainsKey(cat1))
|
|
{
|
|
if (vm.PrototypeVM.Category2Services[cat1].Count > 0)
|
|
{
|
|
dc.ServiceDescription = vm.PrototypeVM.Category2Services[cat1][0];
|
|
}
|
|
}
|
|
}
|
|
|
|
_ServiceRecord = new ServiceRecordVM(dc, vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals)
|
|
{
|
|
Notice = notice,
|
|
ATEST = "NEW Service Record"
|
|
};
|
|
|
|
_ServiceRecord.SetInsertedOn(DateTime.Now);
|
|
|
|
var hideCustomerCombo = _ServiceRecord.SupportConcept == null;
|
|
if (cb2ScOid.HasValue)
|
|
{
|
|
vm.FetchStatistics(cb2ScOid.Value);
|
|
}
|
|
|
|
serviceRecordEditView.InitView(vm, _ServiceRecord, hideCustomerCombo);
|
|
|
|
serviceRecordEditView.SetSearchText(customerCompact != null ? customerCompact.LastName : "");
|
|
|
|
CommandBindingsCloseSave(serviceRecordEditView, schedulerCallback);
|
|
|
|
Popup_Content(serviceRecordEditView);
|
|
})));
|
|
}
|
|
|
|
// Konstruktor für neuen Kalender
|
|
public ChatDokumentationsView(string notice, CompactCustomerDC _compactCustomer, CompactEmployeeDC employee, DateTime firstTime, DateTime lastTime, Action schedulerCallback = null, AppointmentItem appointment = null)
|
|
{
|
|
InitializeComponent();
|
|
|
|
var customerCompact = _compactCustomer;
|
|
|
|
Cache.GetInstance().GetActiveSupportConceptCostbearer(scList =>
|
|
VMFactory.CreateServiceRecordVMAsync(
|
|
BeWoApp.LoggedOnUser.Employee.EmployeeOid,
|
|
vm => this.Dispatch(
|
|
delegate
|
|
{
|
|
var serviceRecordEditView = new ServiceRecordEditView();
|
|
|
|
vm.DispatcherObject = this;
|
|
|
|
var dc = SupportConceptService.ErstelleServiceRecordDC(firstTime, lastTime, customerCompact, scList);
|
|
if(employee != null)
|
|
{
|
|
dc.Employee = employee;
|
|
}
|
|
vm.PrototypeVM.UpdateServiceAccountings(null, vm.PrototypeVM.Category2Services, customerCompact != null);
|
|
|
|
if(vm.PrototypeVM.SortedCategories != null && vm.PrototypeVM.SortedCategories.Count > 0)
|
|
{
|
|
var cat1 = vm.PrototypeVM.SortedCategories[0];
|
|
|
|
dc.ServiceDescription = vm.PrototypeVM.Category2Services[cat1][0];
|
|
}
|
|
|
|
_ServiceRecord = new ServiceRecordVM(dc, vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals) { Notice = notice };
|
|
_ServiceRecord.SetInsertedOn(DateTime.Now);
|
|
var hideCustomerCombo = _ServiceRecord.SupportConcept == null;
|
|
serviceRecordEditView.InitView(vm, _ServiceRecord, hideCustomerCombo);
|
|
|
|
serviceRecordEditView.SetSearchText(customerCompact != null ? customerCompact.LastName : "");
|
|
|
|
CommandBindingsCloseSaveForSchedulingView(serviceRecordEditView, schedulerCallback);
|
|
|
|
Popup_Content(serviceRecordEditView);
|
|
})));
|
|
}
|
|
|
|
//GruppenBuchung Konstruktor für Kalender
|
|
public ChatDokumentationsView(string notice, DateTime startDate, DateTime endDate, List<CompactCustomerDC> _compactCustomer, List<CompactEmployeeDC> _compactEmployee, Action<List<ServiceRecordDC>> schedulerCallback = null, Appointment appointment = null)
|
|
{
|
|
InitializeComponent();
|
|
|
|
Cache.GetInstance().GetActiveSupportConceptCostbearer(scList =>
|
|
VMFactory.CreateServiceRecordVMAsync(
|
|
BeWoApp.LoggedOnUser.Employee.EmployeeOid,
|
|
vm => this.Dispatch(
|
|
delegate
|
|
{
|
|
if(appointment?.AllDay ?? false)
|
|
{
|
|
startDate = startDate.MergeDateWithHoursMinutesSeconds(0, 0, 1);
|
|
endDate = endDate.MergeDateWithHoursMinutesSeconds(0, 0, 1);
|
|
}
|
|
|
|
var newView = new ServiceRecordGroupEditView();
|
|
|
|
vm.DispatcherObject = this;
|
|
|
|
var serviceRecordGroup = new ServiceRecordGroupDC
|
|
{
|
|
StartDate = startDate,
|
|
EndDate = endDate,
|
|
CustomerCount = _compactCustomer.Count,
|
|
EmployeeCount = _compactEmployee.Count,
|
|
Notice = notice
|
|
};
|
|
|
|
var serviceRecordList = new List<ServiceRecordDC>();
|
|
|
|
foreach(var emp in _compactEmployee)
|
|
{
|
|
foreach(var cus in _compactCustomer)
|
|
{
|
|
var supportConcept = SupportConceptService.HoleHilfeplanAusListe(scList, cus, startDate, endDate);
|
|
|
|
if(supportConcept != null)
|
|
{
|
|
var serviceRecord = new ServiceRecordDC
|
|
{
|
|
Start = startDate,
|
|
End = endDate,
|
|
Employee = emp,
|
|
Customer = cus,
|
|
SupportConcept = SupportConceptService.HoleHilfeplanAusListe(scList, cus, startDate, endDate),
|
|
GroupEmployeeCount = _compactEmployee.Count,
|
|
GroupPersonCount = _compactCustomer.Count
|
|
};
|
|
|
|
if(BeWoApp.AppSettings.IsEndDateVisible)
|
|
{
|
|
serviceRecord.ServiceRecordFormat = ServiceRecordFormate.ZeiterfassungMitEndDatum;
|
|
}
|
|
else if(BeWoApp.AppSettings.IsOnlyYearMonthVisible)
|
|
{
|
|
serviceRecord.ServiceRecordFormat = ServiceRecordFormate.ZeiterfassungMitMonatJahr;
|
|
}
|
|
else
|
|
{
|
|
serviceRecord.ServiceRecordFormat = ServiceRecordFormate.OriginaleZeiterfassung;
|
|
}
|
|
|
|
serviceRecord.DurationInStunden = ZeiterfassungsDauer.Minuten;
|
|
|
|
if(serviceRecord.SupportConcept.CostBearerList != null && serviceRecord.SupportConcept.CostBearerList.Count > 0)
|
|
{
|
|
serviceRecord.CostBearer = serviceRecord.SupportConcept.CostBearerList[0].Organisation;
|
|
}
|
|
|
|
serviceRecordList.Add(serviceRecord);
|
|
}
|
|
}
|
|
}
|
|
|
|
if(serviceRecordList.Count == 0)
|
|
{
|
|
MessageBox.Show(
|
|
"Es wurden keine laufenden Hilfepläne für die ausgewählten Klienten gefunden. Die Übernahme in die Zeiterfassung ist nicht möglich.",
|
|
"Übernahme nicht möglich", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
Close();
|
|
return;
|
|
}
|
|
|
|
serviceRecordGroup.ServiceRecordList = serviceRecordList;
|
|
|
|
if(vm.PrototypeVM.SortedCategories?.Any() ?? false)
|
|
{
|
|
foreach (var cat in vm.PrototypeVM.SortedCategories)
|
|
{
|
|
if (vm.PrototypeVM.Category2Services.ContainsKey(cat) && vm.PrototypeVM.Category2Services[cat].Count > 0)
|
|
{
|
|
serviceRecordList[0].ServiceDescription = vm.PrototypeVM.Category2Services[cat][0];
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
_ServiceRecord = new ServiceRecordVM(serviceRecordList[0], vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals) {Notice = notice};
|
|
|
|
newView.InitView(vm, _ServiceRecord, serviceRecordGroup);
|
|
|
|
if(newView.CommandBindings.Count == 0)
|
|
{
|
|
newView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Close,
|
|
(s, e) =>
|
|
{
|
|
if(!newView.DoSaveCheck())
|
|
{
|
|
return;
|
|
}
|
|
|
|
Close();
|
|
}));
|
|
newView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Save,
|
|
(s, e) =>
|
|
{
|
|
var save = newView.IsValid();
|
|
|
|
if(!save)
|
|
{
|
|
return;
|
|
}
|
|
|
|
// ToDo: Hier die ServiceRecords der Gruppenbuchung übergeben. Muss das ändern wegen des asynchronen Aufrufs der Speichermethode
|
|
newView.SaveGroupBookingFromAppointmentCallback(srl =>
|
|
{
|
|
this.Dispatch(() =>
|
|
{
|
|
schedulerCallback?.Invoke(srl);
|
|
Close();
|
|
});
|
|
});
|
|
}));
|
|
}
|
|
|
|
popup_contentChat.Child = newView;
|
|
popup_contentChat.Visibility = Visibility.Visible;
|
|
})));
|
|
}
|
|
|
|
// GruppenBuchung Konstruktor für neuen Kalender
|
|
public ChatDokumentationsView(AppointmentItem appointment, string notice, DateTime firstTime, DateTime lastTime, List<CompactCustomerDC> _compactCustomer, List<CompactEmployeeDC> _compactEmployee, Action schedulerCallback = null)
|
|
{
|
|
InitializeComponent();
|
|
|
|
Cache.GetInstance().GetActiveSupportConceptCostbearer(scList =>
|
|
VMFactory.CreateServiceRecordVMAsync(
|
|
BeWoApp.LoggedOnUser.Employee.EmployeeOid,
|
|
vm => this.Dispatch(
|
|
delegate
|
|
{
|
|
var newView = new ServiceRecordGroupEditView();
|
|
|
|
vm.DispatcherObject = this;
|
|
|
|
var serviceRecordGroup = new ServiceRecordGroupDC
|
|
{
|
|
StartDate = firstTime,
|
|
EndDate = lastTime,
|
|
CustomerCount = _compactCustomer.Count,
|
|
EmployeeCount = _compactEmployee.Count,
|
|
Notice = notice
|
|
};
|
|
|
|
var serviceRecordList = new List<ServiceRecordDC>();
|
|
|
|
foreach(var emp in _compactEmployee)
|
|
{
|
|
foreach(var cus in _compactCustomer)
|
|
{
|
|
var supportConcept = SupportConceptService.HoleHilfeplanAusListe(scList, cus, firstTime, lastTime);
|
|
|
|
if(supportConcept != null)
|
|
{
|
|
var serviceRecord = new ServiceRecordDC
|
|
{
|
|
Start = firstTime,
|
|
End = lastTime,
|
|
Employee = emp,
|
|
Customer = cus,
|
|
SupportConcept = SupportConceptService.HoleHilfeplanAusListe(scList, cus, firstTime, lastTime),
|
|
GroupEmployeeCount = _compactEmployee.Count,
|
|
GroupPersonCount = _compactCustomer.Count
|
|
};
|
|
|
|
if(BeWoApp.AppSettings.IsEndDateVisible)
|
|
{
|
|
serviceRecord.ServiceRecordFormat = ServiceRecordFormate.ZeiterfassungMitEndDatum;
|
|
}
|
|
else if(BeWoApp.AppSettings.IsOnlyYearMonthVisible)
|
|
{
|
|
serviceRecord.ServiceRecordFormat =
|
|
ServiceRecordFormate.ZeiterfassungMitMonatJahr;
|
|
}
|
|
else
|
|
{
|
|
serviceRecord.ServiceRecordFormat = ServiceRecordFormate.OriginaleZeiterfassung;
|
|
}
|
|
|
|
serviceRecord.DurationInStunden = ZeiterfassungsDauer.Minuten;
|
|
|
|
if(serviceRecord.SupportConcept.CostBearerList != null && serviceRecord.SupportConcept.CostBearerList.Count > 0)
|
|
{
|
|
serviceRecord.CostBearer = serviceRecord.SupportConcept.CostBearerList[0].Organisation;
|
|
}
|
|
|
|
serviceRecordList.Add(serviceRecord);
|
|
}
|
|
}
|
|
}
|
|
|
|
if(serviceRecordList.Count == 0)
|
|
{
|
|
MessageBox.Show(
|
|
"Es wurden keine laufenden Hilfepläne für die ausgewählten Klienten gefunden. Die Übernahme in die Zeiterfassung ist nicht möglich.",
|
|
"Übernahme nicht möglich", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
Close();
|
|
return;
|
|
}
|
|
|
|
serviceRecordGroup.ServiceRecordList = serviceRecordList;
|
|
|
|
if(vm.PrototypeVM.SortedCategories != null && vm.PrototypeVM.SortedCategories.Count > 0)
|
|
{
|
|
var cat1 = vm.PrototypeVM.SortedCategories[0];
|
|
|
|
serviceRecordList[0].ServiceDescription = vm.PrototypeVM.Category2Services[cat1][0];
|
|
}
|
|
|
|
_ServiceRecord = new ServiceRecordVM(serviceRecordList[0], vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals) { Notice = notice };
|
|
|
|
newView.InitView(vm, _ServiceRecord, serviceRecordGroup);
|
|
|
|
if(newView.CommandBindings.Count == 0)
|
|
{
|
|
newView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Close,
|
|
(s, e) =>
|
|
{
|
|
if(!newView.DoSaveCheck())
|
|
{
|
|
return;
|
|
}
|
|
|
|
Close();
|
|
}));
|
|
newView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Save,
|
|
(s, e) =>
|
|
{
|
|
var save = newView.IsValid();
|
|
|
|
if(!save)
|
|
{
|
|
return;
|
|
}
|
|
|
|
newView.SaveData();
|
|
schedulerCallback?.Invoke();
|
|
Close();
|
|
}));
|
|
}
|
|
|
|
popup_contentChat.Child = newView;
|
|
|
|
popup_contentChat.Visibility = Visibility.Visible;
|
|
})));
|
|
}
|
|
|
|
private void CommandBindingsCloseSaveForSchedulingView(ServiceRecordEditView newView, Action schedulerCallback)
|
|
{
|
|
if(newView.CommandBindings.Count == 0)
|
|
{
|
|
newView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Close,
|
|
(s, e) =>
|
|
{
|
|
if(!newView.DoSaveCheck())
|
|
{
|
|
return;
|
|
}
|
|
|
|
Close();
|
|
}));
|
|
newView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Save,
|
|
(s, e) =>
|
|
{
|
|
var isValid = newView.IsValid();
|
|
|
|
if(!isValid)
|
|
{
|
|
return;
|
|
}
|
|
|
|
// TODO: Callback einbauen, das den Termin verändert (vom Kalender übergeben)
|
|
if(newView.SaveData())
|
|
{
|
|
schedulerCallback?.Invoke();
|
|
}
|
|
|
|
Close();
|
|
}));
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void CommandBindingsCloseSave(ServiceRecordEditView newView, Action<List<ServiceRecordDC>> schedulerCallback)
|
|
{
|
|
if(newView.CommandBindings.Count != 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
newView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Close,
|
|
(s, e) =>
|
|
{
|
|
if(!newView.DoSaveCheck())
|
|
{
|
|
return;
|
|
}
|
|
|
|
Close();
|
|
}));
|
|
newView.CommandBindings.Add(
|
|
new CommandBinding(
|
|
ApplicationCommands.Save,
|
|
(s, e) =>
|
|
{
|
|
var isValid = newView.IsValid();
|
|
|
|
if(!isValid)
|
|
{
|
|
return;
|
|
}
|
|
|
|
// TODO: Callback einbauen, das den Termin verändert (vom Kalender übergeben)
|
|
if(newView.SaveData())
|
|
{
|
|
var sr = newView.ServiceRecord;
|
|
if(sr.ServiceRecordOid.HasValue)
|
|
{
|
|
schedulerCallback?.Invoke(new List<ServiceRecordDC> { sr });
|
|
}
|
|
}
|
|
|
|
Close();
|
|
}));
|
|
}
|
|
|
|
private void Popup_Content(UIElement serviceRecordEditView)
|
|
{
|
|
popup_contentChat.Child = serviceRecordEditView;
|
|
popup_contentChat.Visibility = Visibility.Visible;
|
|
}
|
|
|
|
private void RootGroupBox_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DragMove();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
|
|
#region Waitlayer
|
|
private WaitLayer2 _WaitLayer;
|
|
|
|
public void StartWaiting()
|
|
{
|
|
Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)StartWaitingImmediately);
|
|
}
|
|
|
|
public void StartWaitingImmediately()
|
|
{
|
|
if(_WaitLayer is null)
|
|
{
|
|
_WaitLayer = new WaitLayer2();
|
|
//Grid.SetColumnSpan(_waitLayer, 3);
|
|
//Grid.SetRowSpan(_waitLayer, 3);
|
|
|
|
DokumentGrid.Children.Add(_WaitLayer);// wieder einkommentieren
|
|
Panel.SetZIndex(_WaitLayer, int.MaxValue);
|
|
_WaitLayer.RefreshChatUI();
|
|
}
|
|
}
|
|
|
|
public void EndWaiting()
|
|
{
|
|
Dispatcher.BeginInvoke(
|
|
DispatcherPriority.Background,
|
|
(Action)delegate
|
|
{
|
|
if(_WaitLayer != null)
|
|
{
|
|
DokumentGrid.Children.Remove(_WaitLayer);// wieder einkommentieren
|
|
_WaitLayer = null;
|
|
}
|
|
});
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|