Warnung beim Ändern unterschriebener ServiceRecords. Unterschriften werden beim Ändern des Datums oder der Zeit gelöscht.
This commit is contained in:
@@ -1677,47 +1677,48 @@ namespace BeWo.Core
|
||||
cbDc = node.SupportConceptTreeNodeDC.CostBearer;
|
||||
relDc = node.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC;
|
||||
}
|
||||
|
||||
|
||||
var dc = vm.CommitToDataContract();
|
||||
dc.Employee = selectedEmployee ?? BeWoApp.LoggedOnUser.Employee;
|
||||
dc.SupportConcept = scDc;
|
||||
dc.CostBearer = cbDc;
|
||||
|
||||
|
||||
|
||||
if (relDc != null)
|
||||
dc.CostBearer2SupportConceptOid = relDc.CostBearer2SupportConceptOid;
|
||||
{
|
||||
dc.CostBearer2SupportConceptOid = relDc.CostBearer2SupportConceptOid;
|
||||
}
|
||||
|
||||
var r = new List<ServiceRecordValidationResultDC>();
|
||||
var validationResults = new List<ServiceRecordValidationResultDC>();
|
||||
|
||||
var maxdays = BeWoApp.AppSettings.MaxDaysEditServiceRecordsAllowed;
|
||||
|
||||
if (withoutClient && BeWoApp.AppSettings.MaxDaysEditServiceRecordsAllowed <= 0)
|
||||
{
|
||||
maxdays = -1;
|
||||
}
|
||||
|
||||
if (BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth))
|
||||
{
|
||||
maxdays = -1;
|
||||
}
|
||||
|
||||
ServiceFacade.DoOperationsServiceSync(o => validationResults = o.ValidateServiceRecord(dc, statistics, maxdays, employeeOids, cb2ScOids));
|
||||
|
||||
ServiceFacade.DoOperationsServiceSync(o => r = o.ValidateServiceRecord(dc, statistics, maxdays, employeeOids, cb2ScOids));
|
||||
|
||||
|
||||
if (r.Count > 0)
|
||||
if (validationResults.Count > 0)
|
||||
{
|
||||
var exitLoop = false;
|
||||
|
||||
foreach (var result in r)
|
||||
foreach (var result in validationResults)
|
||||
{
|
||||
switch (result.ResultType)
|
||||
{
|
||||
case ServiceRecordValidationResult.OutsideOfSupportConcept:
|
||||
MessageBox.Show("Das gewählte Datum '" + vm.StartDate.ToShortDateString() + "' liegt außerhalb des Zeitraums des gewählten Hilfeplans (" + relDc.DateRangeString + ").\nDas Speichern ist nicht möglich.", "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
MessageBox.Show($"Das gewählte Datum '{vm.StartDate.ToShortDateString()}' liegt außerhalb des Zeitraums des gewählten Hilfeplans ({relDc.DateRangeString}).\nDas Speichern ist nicht möglich.", "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
lValid = false;
|
||||
exitLoop = true;
|
||||
break;
|
||||
case ServiceRecordValidationResult.OutOfEditLimit:
|
||||
MessageBox.Show("Sie können keine neuen Leistungen für den " + vm.StartDate.ToShortDateString() + " dokumentieren, da bereits der " + BeWoApp.AppSettings.MaxDaysEditServiceRecordsAllowed + ". des nachfolgenden Monats überschritten ist.", "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
MessageBox.Show($"Sie können keine neuen Leistungen für den {vm.StartDate.ToShortDateString()} dokumentieren, da bereits der {BeWoApp.AppSettings.MaxDaysEditServiceRecordsAllowed}. des nachfolgenden Monats überschritten ist.", "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
lValid = false;
|
||||
exitLoop = true;
|
||||
break;
|
||||
@@ -1726,11 +1727,11 @@ namespace BeWo.Core
|
||||
{
|
||||
if (BeWoApp.AppSettings.AnzTageZeiterfassErfolgt == 1)
|
||||
{
|
||||
MessageBox.Show("Sie können keine neuen Leistungen für den " + vm.StartDate.ToShortDateString() + " dokumentieren, da die Zeiterfassung innerhalb von einem Tag erfolgen muss.", "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
MessageBox.Show($"Sie können keine neuen Leistungen für den {vm.StartDate.ToShortDateString()} dokumentieren, da die Zeiterfassung innerhalb von einem Tag erfolgen muss.", "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Sie können keine neuen Leistungen für den " + vm.StartDate.ToShortDateString() + " dokumentieren, da die Zeiterfassung innerhalb von " + BeWoApp.AppSettings.AnzTageZeiterfassErfolgt + " Tagen erfolgen muss.", "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
MessageBox.Show($"Sie können keine neuen Leistungen für den {vm.StartDate.ToShortDateString()} dokumentieren, da die Zeiterfassung innerhalb von {BeWoApp.AppSettings.AnzTageZeiterfassErfolgt} Tagen erfolgen muss.", "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
lValid = false;
|
||||
@@ -1746,10 +1747,10 @@ namespace BeWo.Core
|
||||
case ServiceRecordValidationResult.ServiceRecordOverlapping:
|
||||
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecord_AllowCreateOverlappingFLS))
|
||||
{
|
||||
MessageBox.Show("An dem gewählten Datum '" + vm.StartDate.ToShortDateString() + " " + vm.StartDate.ToShortTimeString() + "' existiert bereits ein Eintrag (" + result.Message + " bei Klient/in " + result.CustomerName + ") .\nSpeichern nicht möglich.", "Speichern nicht möglich", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
MessageBox.Show($"An dem gewählten Datum '{vm.StartDate.ToShortDateString()} {vm.StartDate.ToShortTimeString()}' existiert bereits ein Eintrag ({result.Message} bei Klient/in {result.CustomerName}) .\nSpeichern nicht möglich.", "Speichern nicht möglich", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
lValid = false;
|
||||
}
|
||||
else if (MessageBox.Show("An dem gewählten Datum '" + vm.StartDate.ToShortDateString() + " " + vm.StartDate.ToShortTimeString() + "' existiert bereits ein Eintrag (" + result.Message + " bei Klient/in " + result.CustomerName + ").\nMöchten Sie trotzdem speichern?", "Speichern", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
|
||||
else if (MessageBox.Show($"An dem gewählten Datum '{vm.StartDate.ToShortDateString()} {vm.StartDate.ToShortTimeString()}' existiert bereits ein Eintrag ({result.Message} bei Klient/in {result.CustomerName}).\nMöchten Sie trotzdem speichern?", "Speichern", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
|
||||
{
|
||||
lValid = false;
|
||||
exitLoop = true;
|
||||
@@ -1759,25 +1760,23 @@ namespace BeWo.Core
|
||||
|
||||
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecord_AllowCreateOverlappingFLSForEmployee))
|
||||
{
|
||||
MessageBox.Show("An dem gewählten Datum '" + vm.StartDate.ToShortDateString() + " " + vm.StartDate.ToShortTimeString() + "' existiert bereits ein Eintrag von " + result.EmployeeName + "\n(" + result.Message + ").\nSpeichern nicht möglich.", "Speichern nicht möglich", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
MessageBox.Show($"An dem gewählten Datum '{vm.StartDate.ToShortDateString()} {vm.StartDate.ToShortTimeString()}' existiert bereits ein Eintrag von {result.EmployeeName}\n({result.Message}).\nSpeichern nicht möglich.", "Speichern nicht möglich", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
lValid = false;
|
||||
}
|
||||
else if (MessageBox.Show("An dem gewählten Datum '" + vm.StartDate.ToShortDateString() + " " + vm.StartDate.ToShortTimeString() + "' existiert bereits ein Eintrag von " + result.EmployeeName + "\n(" + result.Message + ").\n\nMöchten Sie trotzdem speichern?", "Speichern", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
|
||||
else if (MessageBox.Show($"An dem gewählten Datum '{vm.StartDate.ToShortDateString()} {vm.StartDate.ToShortTimeString()}' existiert bereits ein Eintrag von {result.EmployeeName}\n({result.Message}).\n\nMöchten Sie trotzdem speichern?", "Speichern", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
|
||||
{
|
||||
lValid = false;
|
||||
exitLoop = true;
|
||||
}
|
||||
break;
|
||||
case ServiceRecordValidationResult.ApprovedFLSOverspending:
|
||||
String klient = "diesen Hilfeplan";
|
||||
if (!String.IsNullOrEmpty(result.CustomerName))
|
||||
var klient = "diesen Hilfeplan";
|
||||
if (!string.IsNullOrEmpty(result.CustomerName))
|
||||
{
|
||||
klient = "Klient/in " + result.CustomerName;
|
||||
}
|
||||
String msg =
|
||||
String.Format(
|
||||
"Die für {2} genehmigten FLS ({0:N}) werden mit diesem Eintrag überschritten. ({1:N}).",
|
||||
result.ApprovedHours, result.HoursNew, klient);
|
||||
|
||||
var msg = string.Format("Die für {2} genehmigten FLS ({0:N}) werden mit diesem Eintrag überschritten. ({1:N}).", result.ApprovedHours, result.HoursNew, klient);
|
||||
|
||||
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecord_AllowCreateMoreFLSThanApproved))
|
||||
{
|
||||
@@ -1791,17 +1790,17 @@ namespace BeWo.Core
|
||||
}
|
||||
break;
|
||||
case ServiceRecordValidationResult.SettlementInvoiceAlreadyExisting:
|
||||
String klient2 = "diesen Hilfeplan";
|
||||
if (!String.IsNullOrEmpty(result.CustomerName))
|
||||
var klient2 = "diesen Hilfeplan";
|
||||
if (!string.IsNullOrEmpty(result.CustomerName))
|
||||
{
|
||||
klient2 = "Klient/in " + result.CustomerName;
|
||||
}
|
||||
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.BookServiceRecordAfterSettlementInvoice))
|
||||
{
|
||||
MessageBox.Show(String.Format("Sie können den Eintrag nicht bearbeiten, da bereits eine Spitzabrechnung für {0} erstellt wurde.", klient2), "Speichern nicht möglich", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
MessageBox.Show($"Sie können den Eintrag nicht bearbeiten, da bereits eine Spitzabrechnung für {klient2} erstellt wurde.", "Speichern nicht möglich", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
lValid = false;
|
||||
}
|
||||
else if (MessageBox.Show(String.Format("Es existiert bereits eine Spitzabrechnung für {0}. Um diesen Eintrag zu berücksichtigen, muss eventuell eine neue Spitzabrechnung erstellt werden.\nMöchten Sie trotzdem speichern?", klient2), "Speichern", MessageBoxButton.YesNo, MessageBoxImage.Warning).Equals(MessageBoxResult.No))
|
||||
else if (MessageBox.Show($"Es existiert bereits eine Spitzabrechnung für {klient2}. Um diesen Eintrag zu berücksichtigen, muss eventuell eine neue Spitzabrechnung erstellt werden.\nMöchten Sie trotzdem speichern?", "Speichern", MessageBoxButton.YesNo, MessageBoxImage.Warning).Equals(MessageBoxResult.No))
|
||||
{
|
||||
lValid = false;
|
||||
exitLoop = true;
|
||||
@@ -1822,14 +1821,23 @@ namespace BeWo.Core
|
||||
lValid = false;
|
||||
exitLoop = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case ServiceRecordValidationResult.SignatureExists:
|
||||
if(MessageBox.Show(result.Message, "Speichern", MessageBoxButton.YesNo, MessageBoxImage.Warning).Equals(MessageBoxResult.No))
|
||||
{
|
||||
lValid = false;
|
||||
exitLoop = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (exitLoop) break;
|
||||
if (exitLoop)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return lValid;
|
||||
}
|
||||
|
||||
@@ -2200,7 +2208,7 @@ namespace BeWo.Core
|
||||
}
|
||||
public static void EditServiceRecord(ServiceRecordListVM listvm, ServiceRecordVM vm)
|
||||
{
|
||||
if (vm == null)
|
||||
if (vm == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2316,5 +2324,12 @@ namespace BeWo.Core
|
||||
|
||||
beWoWindow.ShowDialog();
|
||||
}
|
||||
|
||||
public static bool CheckForExistingSignatures(ServiceRecordDC serviceRecord)
|
||||
{
|
||||
var validationResult = ServiceFacade.DoOperationsServiceSync(s => s.CheckForExistingSignature(serviceRecord));
|
||||
|
||||
return validationResult != null && MessageBox.Show(validationResult.Message, "Speichern", MessageBoxButton.YesNo, MessageBoxImage.Warning).Equals(MessageBoxResult.Yes) || validationResult == null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -29,7 +28,6 @@ using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Translation;
|
||||
using DevExpress.Web;
|
||||
using DevExpress.Xpf.Docking;
|
||||
using DevExpress.Xpf.Editors;
|
||||
using DevExpress.Xpf.Grid;
|
||||
@@ -479,7 +477,7 @@ namespace BeWo.View.Detail
|
||||
|
||||
_ViewModel = value;
|
||||
|
||||
_ViewModel.ServiceRecordListChanged += _ViewModel_ServiceRecordListChanged;
|
||||
_ViewModel.ServiceRecordListChanged += ViewModel_ServiceRecordListChanged;
|
||||
|
||||
if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.ServiceRecordView_Create) && !BeWoApp.LoggedOnUser.HasRight(UserRightType.CreateAll))
|
||||
{
|
||||
@@ -883,8 +881,6 @@ namespace BeWo.View.Detail
|
||||
foreach (var child in from item in ViewModel.PrototypeVM.GoalTree from child in item.Children where child.IsChecked select child)
|
||||
child.IsChecked = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void SelectedItemChanged(FlatSupportConceptTreeNodeDC selectedNode)
|
||||
{
|
||||
@@ -995,8 +991,7 @@ namespace BeWo.View.Detail
|
||||
return lValid;
|
||||
}
|
||||
|
||||
|
||||
private void _ViewModel_ServiceRecordListChanged(object sender, EventArgs e)
|
||||
private void ViewModel_ServiceRecordListChanged(object sender, EventArgs e)
|
||||
{
|
||||
var list = _ViewModel.ServiceRecordsForSelectedCustomer.OrderByDescending(srVM => srVM.StartDate).ToList();
|
||||
|
||||
@@ -1193,7 +1188,6 @@ namespace BeWo.View.Detail
|
||||
// foreach (var iVM in ViewModel.CreateFromPrototype())
|
||||
// MessageBox.Show("Der gewählte Zeitpunkt '" + iVM.DateAndTime.Value.ToShortDateString() + " " + iVM.DateAndTime.Value.ToShortTimeString() + "' überschneidet sich mit einem bereits existierenden Eintrag desselben Hilfeplans.\nSpeichern nicht möglich.", "Speichern nicht möglich", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
|
||||
private bool SaveSingleBooking()
|
||||
{
|
||||
@@ -1201,9 +1195,11 @@ namespace BeWo.View.Detail
|
||||
|
||||
FlatSupportConceptTreeNodeDC selectedNode = null;
|
||||
if (ViewModel.CustomerNodes.Count > 0)
|
||||
selectedNode = ViewModel.CustomerNodes[0];
|
||||
{
|
||||
selectedNode = ViewModel.CustomerNodes[0];
|
||||
}
|
||||
|
||||
if (!WithoutClient && (selectedNode == null || selectedNode.SupportConceptTreeNodeDC == null))
|
||||
if (!WithoutClient && selectedNode?.SupportConceptTreeNodeDC == null)
|
||||
{
|
||||
MessageBox.Show("Bitte wählen Sie zuerst einen Hilfeplan, für den Sie Leistungen dokumentieren möchten.", "Speichern", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
lValid = false;
|
||||
@@ -1211,7 +1207,6 @@ namespace BeWo.View.Detail
|
||||
|
||||
if (lValid)
|
||||
{
|
||||
|
||||
lValid = BeWoUtils.ValidateServiceRecordVM(ViewModel.PrototypeVM, ViewModel.StatisticsDC, selectedNode, false, ViewModel.SelectedEmployee, null, null);
|
||||
|
||||
if (lValid)
|
||||
|
||||
@@ -405,14 +405,19 @@ namespace BeWo.View.Detail
|
||||
|
||||
var lValid = !(!_HideCustomers && selectedNode == null);
|
||||
|
||||
lValid = ValidationTrigger.Validate(rootGrid) && lValid;
|
||||
lValid = ValidationTrigger.Validate(rootGrid) && lValid;
|
||||
|
||||
if (lValid)
|
||||
{
|
||||
var copyVm = _ServiceRecordVM.Clone();
|
||||
copyVm.DataContract.ServiceRecordOid = _ServiceRecordVM.DataContract.ServiceRecordOid;
|
||||
lValid = BeWoUtils.ValidateServiceRecordVM(copyVm, ViewModel.StatisticsDC, _ServiceRecordVM.ChoosenNode, false, _ServiceRecordVM.Employee, null, null);
|
||||
}
|
||||
lValid = BeWoUtils.ValidateServiceRecordVM(copyVm, ViewModel.StatisticsDC, _ServiceRecordVM.ChoosenNode, false, _ServiceRecordVM.Employee, null, null);
|
||||
|
||||
if(lValid)
|
||||
{
|
||||
lValid = BeWoUtils.CheckForExistingSignatures(copyVm.CommitToDataContract());
|
||||
}
|
||||
}
|
||||
|
||||
return lValid;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,11 @@ namespace BeWo.View.Detail
|
||||
copyVm.DataContract.ServiceRecordOid = _ServiceRecordVM.DataContract.ServiceRecordOid;
|
||||
lValid = BeWoUtils.ValidateServiceRecordVM(copyVm, null, vm, false, ViewModel.SelectedEmployee, employeeOids, cb2scOids);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(lValid)
|
||||
{
|
||||
lValid = BeWoUtils.CheckForExistingSignatures(_ServiceRecordVM.CommitToDataContract());
|
||||
}
|
||||
|
||||
// if (BeWoApp.AppSettings.MaxDaysEditServiceRecordsAllowed > 0)
|
||||
@@ -262,25 +266,29 @@ namespace BeWo.View.Detail
|
||||
|
||||
internal override bool DoSaveCheck()
|
||||
{
|
||||
if (this.IsDirty)
|
||||
if (IsDirty)
|
||||
{
|
||||
MessageBoxResult lResult = this.ShowSaveQuestion();
|
||||
var lResult = ShowSaveQuestion();
|
||||
if (lResult == MessageBoxResult.Cancel)
|
||||
{
|
||||
this.Focus();
|
||||
Focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (lResult == MessageBoxResult.Yes)
|
||||
{
|
||||
if (!this.IsCustomerChangeAllowed())
|
||||
if (!IsCustomerChangeAllowed())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (IsValid())
|
||||
this.SaveData();
|
||||
{
|
||||
SaveData();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,7 +485,6 @@ namespace BeWo.View.Detail
|
||||
item.CostBearer.CostBearerOid = item.SupportConcept.CostBearerList[0].CostBearerOid;
|
||||
}
|
||||
|
||||
|
||||
if (dc.GroupOid.HasValue)
|
||||
{
|
||||
ServiceFacade.DoOperationsServiceAsync(s => s.UpdateServiceRecordGroup(_Group), UpdateViewModel);
|
||||
|
||||
@@ -2390,7 +2390,7 @@ namespace BeWo.ViewModel
|
||||
pDataContract.RTFNotice5 = _RTFNotice5;
|
||||
|
||||
pDataContract.ServiceRecordType = _ServiceRecordType;
|
||||
pDataContract.DistanceInMeter = (int)_DistanceInMeter;
|
||||
pDataContract.DistanceInMeter = (int) (_DistanceInMeter ?? 0);
|
||||
pDataContract.DurationInStunden = DauerEinheit;
|
||||
pDataContract.Employee = _Employee;
|
||||
pDataContract.Customer = _Customer;
|
||||
@@ -2415,6 +2415,7 @@ namespace BeWo.ViewModel
|
||||
pDataContract.GroupRoundedDuration = GroupRoundedDuration;
|
||||
pDataContract.GroupOid = GroupOid;
|
||||
pDataContract.BackgroundColor = BackgroundColor;
|
||||
pDataContract.SignatureOid = _SignatureOid;
|
||||
|
||||
return pDataContract;
|
||||
}
|
||||
|
||||
@@ -2080,6 +2080,12 @@ namespace BeWoPlanerMobil.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
var signatureValidationResult = OperationsService.CheckForExistingSignature(checkServiceRecord);
|
||||
if(signatureValidationResult != null && newResult.KannTrotzdemGespeichertWerden)
|
||||
{
|
||||
newResult.Message += $"<br />{signatureValidationResult.Message}<br /><br />";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(newResult.Message))
|
||||
{
|
||||
newResult.Message += newResult.KannTrotzdemGespeichertWerden ? "<br />Möchten Sie trotzdem speichern?<br /><br />" : "<br />Speichern nicht möglich.<br /><br />";
|
||||
|
||||
@@ -203,18 +203,20 @@ namespace BeWo.Service.Plugins
|
||||
var result = new List<ServiceRecordValidationResultDC>();
|
||||
|
||||
if (!newServiceRecord.Start.HasValue)
|
||||
return result;
|
||||
|
||||
|
||||
if (!ValidateSignature(newServiceRecord))
|
||||
{
|
||||
result.Add(new ServiceRecordValidationResultDC
|
||||
{
|
||||
ResultType = ServiceRecordValidationResult.Custom,
|
||||
Message = "Der Eintrag wurde bereits unterschrieben. Das Verändern von Datum und Uhrzeit ist nicht möglich."
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// TODO: CheckForExistingSignature an den Stellen einbauen an denen ValidateServiceRecord aufgerufen wird
|
||||
// if (!ValidateSignature(newServiceRecord))
|
||||
// {
|
||||
// result.Add(new ServiceRecordValidationResultDC
|
||||
// {
|
||||
// ResultType = ServiceRecordValidationResult.SignatureExists,
|
||||
// Message = "Der Eintrag wurde bereits unterschrieben. Das Verändern von Datum und Uhrzeit führt zur Löschen der Unterschrift!"
|
||||
// });
|
||||
// }
|
||||
|
||||
bool isGroupRecord = (cb2scOids != null && cb2scOids.Count > 1) ||
|
||||
(employeeOids != null && employeeOids.Count > 1);
|
||||
|
||||
@@ -1025,5 +1027,61 @@ namespace BeWo.Service.Plugins
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// Nur bei Updates von ServiceRecords
|
||||
public virtual ServiceRecordValidationResultDC CheckForExistingSignature(ServiceRecordDC serviceRecord)
|
||||
{
|
||||
if(serviceRecord == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var serviceRecords = new List<ServiceRecordDC> {serviceRecord};
|
||||
|
||||
if (serviceRecord.GroupOid.HasValue)
|
||||
{
|
||||
var serviceRecordGroup = DAOFactory.SearchDAO.FindServiceRecordGroup(serviceRecord.GroupOid.Value);
|
||||
if(serviceRecordGroup?.ServiceRecordList.Any() ?? false)
|
||||
{
|
||||
serviceRecords.AddRange(MapperFactory.ServiceRecordDC_ServiceRecord.MapToNewDCs(serviceRecordGroup.ServiceRecordList.Where(sr => sr.Oid != serviceRecord.ServiceRecordOid)));
|
||||
}
|
||||
}
|
||||
|
||||
var message = serviceRecords.Count > 1
|
||||
? "Es existiert bereits eine Unterschrift. Das Ändern des Datums oder der Uhrzeiten führt zur Löschung der vorhandenen Unterschrift"
|
||||
: "Es existieren bereits Unterschriften. Das Ändern des Datums oder der Uhrzeiten führt zur Löschung der vorhandenen Unterschriften";
|
||||
|
||||
var result = new ServiceRecordValidationResultDC
|
||||
{
|
||||
ResultType = ServiceRecordValidationResult.SignatureExists,
|
||||
Message = message
|
||||
};
|
||||
|
||||
var originals = DAOFactory.GenericDAO.LoadByIDs<ServiceRecord>(serviceRecords.Where(sr => sr.ServiceRecordOid.HasValue).Select(sr => sr.ServiceRecordOid.Value));
|
||||
|
||||
var oldVsNew = new Dictionary<ServiceRecord, ServiceRecordDC>();
|
||||
var orderedOldOnes = originals.Where(x => x.Oid.HasValue).OrderBy(x => x.Oid.Value).ToList();
|
||||
var orderedNewOnes = serviceRecords.Where(x => x.ServiceRecordOid.HasValue).OrderBy(x => x.ServiceRecordOid.Value).ToList();
|
||||
|
||||
foreach (var oldSr in orderedOldOnes)
|
||||
{
|
||||
var newSr = orderedNewOnes.FirstOrDefault(f => f.ServiceRecordOid == oldSr.Oid);
|
||||
|
||||
if (newSr != null)
|
||||
{
|
||||
oldVsNew.Add(oldSr, newSr);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var kvp in oldVsNew)
|
||||
{
|
||||
if ((kvp.Key.Start != kvp.Value.Start || kvp.Key.End != kvp.Value.End) && kvp.Key.SignatureOid.HasValue)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ using BS.Shared.DataContracts.Reports;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel;
|
||||
using BeWo.Data.Entities;
|
||||
|
||||
|
||||
namespace BeWo.Service.ServiceContracts
|
||||
@@ -1180,5 +1179,9 @@ namespace BeWo.Service.ServiceContracts
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
string GetInformationStringForUrlaubsplaner(UrlaubskontoDC dc, decimal tageUrlaub, decimal tageKrank, bool urlaubVerfallen);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
ServiceRecordValidationResultDC CheckForExistingSignature(ServiceRecordDC serviceRecord);
|
||||
}
|
||||
}
|
||||
@@ -1094,6 +1094,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
dc.GroupPersonCount = item.GroupPersonCount;
|
||||
dc.GroupRoundedDuration = item.GroupRoundedDuration;
|
||||
dc.GroupOid = item.GroupOid;
|
||||
dc.SignatureOid = item.SignatureOid;
|
||||
|
||||
result.Add(dc);
|
||||
|
||||
@@ -2083,7 +2084,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: vorhandene Quittierungsbelegsunterschriften löschen!
|
||||
// TODO: vorhandene Unterschriften löschen!
|
||||
public ServiceRecordGroupDC UpdateServiceRecordGroup(ServiceRecordGroupDC pServiceRecordGroup)
|
||||
{
|
||||
try
|
||||
@@ -2093,20 +2094,15 @@ namespace BeWo.Service.ServiceImplementations
|
||||
var originalStart = lOriginal.StartDate;
|
||||
var originalEnde = lOriginal.EndDate;
|
||||
|
||||
if (originalStart.HasValue && originalEnde.HasValue && pServiceRecordGroup.StartDate.HasValue &&
|
||||
pServiceRecordGroup.EndDate.HasValue)
|
||||
if (originalStart.HasValue && originalEnde.HasValue && pServiceRecordGroup.StartDate.HasValue && pServiceRecordGroup.EndDate.HasValue)
|
||||
{
|
||||
var minutesOrg = originalEnde.Value.Subtract(originalStart.Value).TotalMinutes;
|
||||
var minutesNew = pServiceRecordGroup.EndDate.Value.Subtract(pServiceRecordGroup.StartDate.Value).TotalMinutes;
|
||||
|
||||
//Start und Ende korrigieren
|
||||
|
||||
if (Math.Abs(minutesNew - minutesOrg) < 0.1 && pServiceRecordGroup.StartDate.Value.Hour == 0 && pServiceRecordGroup.StartDate.Value.Minute == 0 &&
|
||||
pServiceRecordGroup.StartDate.Value.Second == 0)
|
||||
if (Math.Abs(minutesNew - minutesOrg) < 0.1 && pServiceRecordGroup.StartDate.Value.Hour == 0 && pServiceRecordGroup.StartDate.Value.Minute == 0 && pServiceRecordGroup.StartDate.Value.Second == 0)
|
||||
{
|
||||
//prüfen ob korrigiert werden muss
|
||||
if (originalStart.Value.Hour != 0 ||
|
||||
originalStart.Value.Minute != 0)
|
||||
if (originalStart.Value.Hour != 0 || originalStart.Value.Minute != 0)
|
||||
{
|
||||
pServiceRecordGroup.StartDate = originalStart;
|
||||
pServiceRecordGroup.EndDate = originalEnde;
|
||||
@@ -2119,16 +2115,11 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!pServiceRecordGroup.StartDate.HasValue && pServiceRecordGroup.EndDate.HasValue)
|
||||
{
|
||||
pServiceRecordGroup.StartDate =
|
||||
pServiceRecordGroup.EndDate.Value.AddMinutes((double)pServiceRecordGroup.RoundedDuration * -1);
|
||||
|
||||
|
||||
pServiceRecordGroup.StartDate = pServiceRecordGroup.EndDate.Value.AddMinutes((double)pServiceRecordGroup.RoundedDuration * -1);
|
||||
}
|
||||
|
||||
pServiceRecordGroup.RoundedDuration = (decimal)pServiceRecordGroup.EndDate.Value.Subtract(pServiceRecordGroup.StartDate.Value).TotalMinutes;
|
||||
@@ -2137,6 +2128,10 @@ namespace BeWo.Service.ServiceImplementations
|
||||
srdc.GroupRoundedDuration = pServiceRecordGroup.RoundedDuration;
|
||||
}
|
||||
|
||||
// Bei geänderten Daten oder Uhrzeiten werden die Klientenunterschriften gelöscht
|
||||
var serviceRecords = pServiceRecordGroup.ServiceRecordList;
|
||||
var originalServiceRecords = lOriginal.ServiceRecordList;
|
||||
DeleteSignaturesFromServiceRecords(serviceRecords, originalServiceRecords);
|
||||
|
||||
MapperFactory.ServiceRecordGroupDC_ServiceRecordGroup.MergeWithEntity(pServiceRecordGroup, lOriginal);
|
||||
|
||||
@@ -2144,10 +2139,12 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
// update servicerecords
|
||||
MapperFactory.ServiceRecordDC_ServiceRecord.MergeWithEntitys(pServiceRecordGroup.ServiceRecordList, lOriginal.ServiceRecordList);
|
||||
foreach (ServiceRecord iServiceRecord in lOriginal.ServiceRecordList)
|
||||
foreach (var iServiceRecord in lOriginal.ServiceRecordList)
|
||||
{
|
||||
if (String.IsNullOrEmpty(iServiceRecord.IP))
|
||||
if (string.IsNullOrEmpty(iServiceRecord.IP))
|
||||
{
|
||||
iServiceRecord.IP = Utils.GetClientIP();
|
||||
}
|
||||
|
||||
iServiceRecord.GroupOid = lOriginal.Oid;
|
||||
lServiceRecords.Add(iServiceRecord);
|
||||
@@ -2155,15 +2152,14 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
RemoveServiceRecordsFromConfirmationReceiptSignatures(lServiceRecords);
|
||||
|
||||
var gdc = PluginLoader.FindClass<GroupDurationCalculator>();
|
||||
var groupDurationCalculator = PluginLoader.FindClass<GroupDurationCalculator>();
|
||||
|
||||
gdc?.CalculateGroupDuration(lOriginal);
|
||||
groupDurationCalculator?.CalculateGroupDuration(lOriginal);
|
||||
|
||||
DAOFactory.GenericDAO.Update(lOriginal);
|
||||
MakeServiceRecordHistoryEntry(lServiceRecords, null, StatementType.Update);
|
||||
|
||||
|
||||
ServiceRecordGroupDC newGroupDC = MapperFactory.ServiceRecordGroupDC_ServiceRecordGroup.MapToNewDC(lOriginal);
|
||||
var newGroupDC = MapperFactory.ServiceRecordGroupDC_ServiceRecordGroup.MapToNewDC(lOriginal);
|
||||
|
||||
newGroupDC.ServiceRecordList = MapperFactory.ServiceRecordDC_ServiceRecord.MapToNewDCs(lOriginal.ServiceRecordList);
|
||||
|
||||
@@ -2175,14 +2171,15 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: vorhandene Unterschriften löschen!
|
||||
public void UpdateServiceRecords(List<ServiceRecordDC> pServiceRecords)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<ServiceRecord> lOriginals =
|
||||
DAOFactory.GenericDAO.LoadByIDs<ServiceRecord>(
|
||||
pServiceRecords.Select(sr => sr.ServiceRecordOid.Value));
|
||||
var lOriginals = DAOFactory.GenericDAO.LoadByIDs<ServiceRecord>(pServiceRecords.Select(sr => sr.ServiceRecordOid.Value));
|
||||
|
||||
DeleteSignaturesFromServiceRecords(pServiceRecords, lOriginals);
|
||||
|
||||
if (lOriginals.Count == 1 && pServiceRecords.Count == 1)
|
||||
{
|
||||
var srDc = pServiceRecords[0];
|
||||
@@ -2200,14 +2197,13 @@ namespace BeWo.Service.ServiceImplementations
|
||||
//Start und Ende korrigieren
|
||||
if (Math.Abs(minutesNew - minutesOrg) < 0.1 && srDc.Start.Value.Hour == 0 && srDc.Start.Value.Minute == 0 && srDc.Start.Value.Second == 0)
|
||||
{
|
||||
//prüfen ob korrigiert werden muss
|
||||
//prüfen, ob korrigiert werden muss
|
||||
if (originalStart.Value.Hour != 0 ||
|
||||
originalStart.Value.Minute != 0)
|
||||
{
|
||||
srDc.Start = originalStart;
|
||||
srDc.End = originalEnde;
|
||||
//pServiceRecordGroup.RoundedDuration = (decimal)originalEnde.Value.Subtract(originalStart.Value).TotalMinutes;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2348,8 +2344,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
public Dictionary<ServiceRecordDC, List<ServiceRecordValidationResult>> ValidateGroupServiceRecordEntry(ServiceRecordDC pServiceRecord, List<ServiceRecordDC> groupServiceRecords, List<CompactEmployeeDC> employees, DateTime? date, int maxDaysEditServiceRecordsAllowed, decimal flsTotalRounded, out Dictionary<long, string> overlappingRecords, out Dictionary<long, string> overlappingEmployees)
|
||||
{
|
||||
var validator = PluginLoader.FindClass<ServiceRecordValidator>();
|
||||
return validator.ValidateGroupServiceRecordEntry(pServiceRecord, groupServiceRecords, employees, date,
|
||||
maxDaysEditServiceRecordsAllowed, flsTotalRounded, out overlappingRecords, out overlappingEmployees);
|
||||
return validator.ValidateGroupServiceRecordEntry(pServiceRecord, groupServiceRecords, employees, date, maxDaysEditServiceRecordsAllowed, flsTotalRounded, out overlappingRecords, out overlappingEmployees);
|
||||
|
||||
}
|
||||
|
||||
@@ -2371,6 +2366,12 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
}
|
||||
|
||||
public ServiceRecordValidationResultDC CheckForExistingSignature(ServiceRecordDC serviceRecord)
|
||||
{
|
||||
var validator = PluginLoader.FindClass<ServiceRecordValidator>();
|
||||
return validator.CheckForExistingSignature(serviceRecord);
|
||||
}
|
||||
|
||||
public List<ServiceRecordValidationResult> CheckExistingSettlementInvoices(ServiceRecordDC pServiceRecord)
|
||||
{
|
||||
var result = new List<ServiceRecordValidationResult>();
|
||||
@@ -7122,5 +7123,39 @@ namespace BeWo.Service.ServiceImplementations
|
||||
throw Utils.CreateBeWoFaultException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DeleteSignaturesFromServiceRecords(IEnumerable<ServiceRecordDC> serviceRecords, IEnumerable<ServiceRecord> originals)
|
||||
{
|
||||
var oldVsNew = new Dictionary<ServiceRecord, ServiceRecordDC>();
|
||||
var orderedOldOnes = originals.Where(x => x.Oid.HasValue).OrderBy(x => x.Oid.Value).ToList();
|
||||
var orderedNewOnes = serviceRecords.Where(x => x.ServiceRecordOid.HasValue).OrderBy(x => x.ServiceRecordOid.Value).ToList();
|
||||
|
||||
foreach (var oldSr in orderedOldOnes)
|
||||
{
|
||||
var newSr = orderedNewOnes.FirstOrDefault(f => f.ServiceRecordOid == oldSr.Oid);
|
||||
|
||||
if (newSr != null)
|
||||
{
|
||||
oldVsNew.Add(oldSr, newSr);
|
||||
}
|
||||
}
|
||||
|
||||
var signatureOids = new List<long>();
|
||||
foreach (var kvp in oldVsNew)
|
||||
{
|
||||
if ((kvp.Key.Start != kvp.Value.Start || kvp.Key.End != kvp.Value.End) && kvp.Key.SignatureOid.HasValue)
|
||||
{
|
||||
signatureOids.AddIfNotIn(kvp.Key.SignatureOid.Value);
|
||||
kvp.Value.SignatureOid = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(signatureOids.Any())
|
||||
{
|
||||
var signatures2Delete = DAOFactory.GenericDAO.LoadByIDs<Signature>(signatureOids);
|
||||
|
||||
DAOFactory.GenericDAO.Delete(signatures2Delete);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -818,7 +818,8 @@ namespace BS.Shared
|
||||
Error = 5,
|
||||
SettlementInvoiceAlreadyExisting = 6,
|
||||
FristAbgelaufen = 7,
|
||||
Custom = 8
|
||||
Custom = 8,
|
||||
SignatureExists = 9
|
||||
}
|
||||
|
||||
public enum ViewDestination
|
||||
|
||||
Reference in New Issue
Block a user