diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs index 2f8dff693..b1f1b5e46 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs @@ -2031,6 +2031,8 @@ namespace BeWo.Scheduler.View w.EmployeeList.Count > 0 && w.EmployeeList.Any(a => a.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)) || BeWoUtils.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)) && (!w.EmployeeList.TrueForAll(e2a => e2a.ParticipationAnswer == ParticipationAnswer.Absage) || w.EmployeeList == null || w.EmployeeList.Count == 0)).ToList(); + var editableAppointments = appointments.Where(w => w.CanBeEdited).ToList(); + if(!IsTasksVisible) { prefilteredAppointments = prefilteredAppointments.Where(app => !app.IsTask).ToList(); diff --git a/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs b/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs index d2a4a4e7a..c1abfae12 100644 --- a/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs +++ b/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs @@ -651,6 +651,8 @@ namespace BeWo.Scheduler.ViewModel pDataContract.DueDate = _DueDate; } + pDataContract.CanBeEdited = CanBeEdited; + return pDataContract; } diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 5c14eaafe..384a51bee 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -1576,7 +1576,7 @@ namespace BeWoPlanerMobil.Controllers var serviceRecordDC = Model.ServiceRecords.FirstOrDefault(f => f.ServiceRecordOid != null && f.ServiceRecordOid.Value.Equals(Model.ServiceRecordOidToDelete)); var version = serviceRecordDC?.ServiceRecordVersion; - if (version != null) + if (version != null && MainModel.IsAllowedToDeleteServiceRecord(serviceRecordDC)) { OperationsService.DeleteServiceRecord(Model.ServiceRecordOidToDelete.Value, version.Value); diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index 14fe62512..d27e0bc53 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -461,12 +461,10 @@ -@if(AbstractModel.IsDeleteBtnVisible) + +@using(Html.BeginForm("DeleteServiceRecord", "Main", FormMethod.Post, new { id = "deletion-form" })) { - using(Html.BeginForm("DeleteServiceRecord", "Main", FormMethod.Post, new { id = "deletion-form" })) - { - - } + } diff --git a/Data/ASPHibernateSessionManager.cs b/Data/ASPHibernateSessionManager.cs index 00ea2b555..14572f115 100644 --- a/Data/ASPHibernateSessionManager.cs +++ b/Data/ASPHibernateSessionManager.cs @@ -12,8 +12,6 @@ using System.Web; using BeWo.Data.Access; using BeWo.Data.Entities; -using BS.Shared.Core; - using log4net.Config; using NHibernate; diff --git a/Service/ServiceImplementations/ResourceServiceImp.cs b/Service/ServiceImplementations/ResourceServiceImp.cs index 502d20f46..616327010 100644 --- a/Service/ServiceImplementations/ResourceServiceImp.cs +++ b/Service/ServiceImplementations/ResourceServiceImp.cs @@ -1129,21 +1129,21 @@ namespace BeWo.Service.ServiceImplementations long? ownerOid = null; //Keine Auswahl getroffen: Nur meine Termine anzeigen - if((pSelectedEmployees == null || pSelectedEmployees.Count == 0) && (pSelectedCustomer == null || pSelectedCustomer.Count == 0) && (pSelectedResources == null || pSelectedResources.Count == 0)) + if((pSelectedEmployees?.Count == 0) && (pSelectedCustomer?.Count == 0) && (pSelectedResources?.Count == 0)) { ownerOid = pEmployeeOid; } //Benutzer hat sich selber selektiert - if(pSelectedEmployees != null && pSelectedEmployees.Exists(e => e == pEmployeeOid)) + if(pSelectedEmployees?.Exists(e => e == pEmployeeOid) ?? false) { ownerOid = pEmployeeOid; } //Man hat nur Customer und/oder Ressourcen ausgewählt, dann dürfen die eigenen nicht angezeigt werden - if((pSelectedEmployees == null || pSelectedEmployees.Count == 0) && - (pSelectedCustomer != null && pSelectedCustomer.Count > 0 || - pSelectedResources != null && pSelectedResources.Count > 0)) + if((pSelectedEmployees?.Count == 0) && + (pSelectedCustomer?.Count > 0 || + pSelectedResources?.Count > 0)) { ownerOid = null; } @@ -1162,9 +1162,8 @@ namespace BeWo.Service.ServiceImplementations pSelectedEmployees?.Remove(pEmployeeOid); } - if(pPrivateAppointmentsOnly && (pSelectedEmployees == null || pSelectedEmployees.Count == 0) && (pSelectedCustomer == null || pSelectedCustomer.Count == 0) && (pSelectedResources == null || pSelectedResources.Count == 0) && !(pSelectedEmployees == null || pSelectedEmployees.Count == 0) && - (pSelectedCustomer != null && pSelectedCustomer.Count > 0 || - pSelectedResources != null && pSelectedResources.Count > 0)) + if(pPrivateAppointmentsOnly && (pSelectedEmployees?.Count == 0) && (pSelectedCustomer?.Count == 0) && (pSelectedResources?.Count == 0) && !(pSelectedEmployees?.Count == 0) && + (pSelectedCustomer?.Count > 0 || pSelectedResources?.Count > 0)) { ownerOid = pEmployeeOid; } @@ -1499,11 +1498,6 @@ namespace BeWo.Service.ServiceImplementations add = false; } - if(app.SchedulerAppointmentOid == 21852) - { - - } - if(add) { result.Add(app);