From 31eee429c3fbc8d35cf8d122d67a776300b5e811 Mon Sep 17 00:00:00 2001 From: Lyndon Jetten Date: Thu, 9 Feb 2023 20:47:52 +0100 Subject: [PATCH] =?UTF-8?q?Bugfixes=20im=20Intervallfinder=20und=20Rechtep?= =?UTF-8?q?r=C3=BCfung=20verbessert=20im=20MoK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AbstractBaseController.cs | 9 +- .../Controllers/CustomerController.cs | 4 +- BeWoPlanerMobil/Controllers/MainController.cs | 62 +-- .../Controllers/ReportController.cs | 48 +- .../Controllers/SchedulerController.cs | 46 +- .../AppointmentIntervalFinderPartial.cshtml | 527 +++++++++--------- .../Views/Scheduler/Scheduler.cshtml | 21 +- Host/Web.config | 2 +- 8 files changed, 367 insertions(+), 352 deletions(-) diff --git a/BeWoPlanerMobil/Controllers/AbstractBaseController.cs b/BeWoPlanerMobil/Controllers/AbstractBaseController.cs index 005f4096e..57cc8f524 100644 --- a/BeWoPlanerMobil/Controllers/AbstractBaseController.cs +++ b/BeWoPlanerMobil/Controllers/AbstractBaseController.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Web.Mvc; using System.Web.Security; using BeWo.Service.ServiceContracts; @@ -22,7 +23,7 @@ namespace BeWoPlanerMobil.Controllers protected readonly IDownloadService DownloadService = new MobileSessionFacade().DownloadService; protected readonly IReportService ReportService = new MobileSessionFacade().ReportService; - protected const string _LeerzeichenFuerGetMethoden = " "; + protected const string LeerzeichenFuerGetMethoden = " "; protected static readonly log4net.ILog Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -31,7 +32,11 @@ namespace BeWoPlanerMobil.Controllers protected ActionResult Logout() { - MobileSessionFacade.LogUserOut(); +#if DEBUG + Debug.WriteLine($"+++>Logout aufrufende Methode: {(new StackTrace()).GetFrame(1).GetMethod().Name}"); +#endif + + MobileSessionFacade.LogUserOut(); FormsAuthentication.SignOut(); AbstractModel.TimeOfLastAction = null; diff --git a/BeWoPlanerMobil/Controllers/CustomerController.cs b/BeWoPlanerMobil/Controllers/CustomerController.cs index 47e1d09c0..d893c7fc6 100644 --- a/BeWoPlanerMobil/Controllers/CustomerController.cs +++ b/BeWoPlanerMobil/Controllers/CustomerController.cs @@ -187,7 +187,7 @@ namespace BeWoPlanerMobil.Controllers if(Model == null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer")) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var isAllowedToEdit = MobileSessionFacade.LoggedInUser.CheckForAtLeastOneRight(new List { UserRightType.CustomerView_Edit, UserRightType.EditAll }); @@ -200,7 +200,7 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedCustomer = CustomerService.LoadCustomer(customerOid); } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 3bc804563..7e0fb29e4 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -289,7 +289,7 @@ namespace BeWoPlanerMobil.Controllers { if(Model is null || ratingTypeOid is null || goalOid is null || !AbstractModel.HasRightToRateGoals) { - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } if(!Model.IsInGroupBookingMode) @@ -369,7 +369,7 @@ namespace BeWoPlanerMobil.Controllers [HttpPost] public new ActionResult Logout() - { + { return base.Logout(); } @@ -515,7 +515,7 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var isLoaded = false; @@ -661,7 +661,7 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } using (var signatureBitmap = SignatureUtils.Base64StringToBitmap(blob.Split(',')[1])) @@ -683,7 +683,7 @@ namespace BeWoPlanerMobil.Controllers }); } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } catch (Exception e) { @@ -740,7 +740,7 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } try @@ -767,7 +767,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var textModule = Model.AllTextModules.FirstOrDefault(f => f.Oid == pTextbausteinOid); @@ -1610,20 +1610,20 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var sc = Model.SelectedSupportConcept; if (sc is null) { - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } if(string.IsNullOrEmpty(pGoalOids)) { Model.SelectedGoals.Clear(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var splitOids = pGoalOids.Trim(';').Split(';'); @@ -1646,7 +1646,7 @@ namespace BeWoPlanerMobil.Controllers //Model.SelectedGoals = goals; - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -1655,11 +1655,11 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.SelectedServiceDescriptionOid = pServiceDescriptionOid; - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [HttpPost] @@ -1888,10 +1888,10 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } - var result = _LeerzeichenFuerGetMethoden; + var result = LeerzeichenFuerGetMethoden; if (Model.SelectedServiceRecordOid.HasValue) { @@ -1907,7 +1907,7 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } LoadRecordsToModel(); @@ -1921,7 +1921,7 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Log.Info($"CheckRights: von:{von};bis:{bis};inEditMode:{inEditMode};dateString:{dateString};startString:{startString};endString:{endString}"); @@ -2263,7 +2263,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var isSuccessful = long.TryParse(serviceRecordOidString, out var serviceRecordOid); @@ -2279,7 +2279,7 @@ namespace BeWoPlanerMobil.Controllers if(serviceRecord is null) { - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var allowDeleteAfterEmployeeSignature = MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowDeleteAfterEmployeeSignature); @@ -2317,11 +2317,11 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.SelectedEmployee = Model.AllEmployees.First(f => f.EmployeeOid.Equals(employeeOid)); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } catch (Exception e) { @@ -2362,7 +2362,7 @@ namespace BeWoPlanerMobil.Controllers return SerializeObject("localhost;demo"); } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } // Menünavigation @@ -2580,7 +2580,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var rawRelOids = string.IsNullOrEmpty(pRelOids) ? new string[0] : pRelOids.Split(','); @@ -2650,7 +2650,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } long.TryParse(pRelOid, out var supportConceptCostBearerRelationOid); @@ -2677,7 +2677,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } if(string.IsNullOrEmpty(pEmployeeOids)) @@ -2705,7 +2705,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var signatureServiceRecord = Model.GetServiceRecord(serviceRecordOid); @@ -2992,14 +2992,14 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.IsShowingDurationInHours = isInHoursMode; UpdateUserSettingsWithoutReload(SettingsKeys.LetzteZeiterfassungsDauer, Model.IsShowingDurationInHours ? "1" : "0"); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } @@ -3196,7 +3196,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var rawRelOids = string.IsNullOrEmpty(pRelOids) ? Array.Empty() : pRelOids.Split(','); @@ -3266,7 +3266,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } long.TryParse(pRelOid, out var supportConceptCostBearerRelationOid); @@ -3293,7 +3293,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } if(string.IsNullOrEmpty(pEmployeeOids)) diff --git a/BeWoPlanerMobil/Controllers/ReportController.cs b/BeWoPlanerMobil/Controllers/ReportController.cs index 291fbe3cc..3f90e7d9c 100644 --- a/BeWoPlanerMobil/Controllers/ReportController.cs +++ b/BeWoPlanerMobil/Controllers/ReportController.cs @@ -462,12 +462,12 @@ namespace BeWoPlanerMobil.Controllers { if(Model == null) { - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.SelectedCustomer = Model.Customers.FirstOrDefault(customer => customer.CustomerOid == customerOid); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -476,7 +476,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var isParsingSuccessful1 = int.TryParse(startDayString, out var startDay); @@ -495,7 +495,7 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedYear = year; } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -504,7 +504,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var isParsingSuccessful2 = long.TryParse(organisationOidStr, out var organisationOid); @@ -514,7 +514,7 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedServiceCategory = isParsingSuccessful3 ? OperationsService.LoadServiceCategory(categoryOid) : null; - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -523,13 +523,13 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.IsForSelectedEmployeesOnly = isForSelectedEmployeeOnly ?? false; Model.SelectedEmployee = employeeOid.HasValue ? Model.Employees.FirstOrDefault(employee => employee.EmployeeOid.Equals(employeeOid.Value)) : null; - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -538,12 +538,12 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.SelectedEmployee = employeeOid.HasValue ? Model.Employees.FirstOrDefault(employee => employee.EmployeeOid.Equals(employeeOid)) : null; - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -552,13 +552,13 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.IsForSelectedCostbearersOnly = isForSelectedOrganisationOnly ?? false; Model.SelectedOrganisation = organisationOid.HasValue ? Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(organisationOid)) : null; - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -567,12 +567,12 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.SelectedOrganisation = organisationOid.HasValue ? Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(organisationOid)) : null; - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -581,7 +581,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.IsForSelectedCategoryOnly = isForSelectedServiceCategoryOnly ?? false; @@ -590,7 +590,7 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedServiceCategory = Model.ServiceCategories.FirstOrDefault(serviceCategory => serviceCategory.ServiceCategoryOid == serviceCategoryOid); } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -599,7 +599,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } if(serviceCategoryOid.HasValue) @@ -607,7 +607,7 @@ namespace BeWoPlanerMobil.Controllers Model.SelectedServiceCategory = Model.ServiceCategories.FirstOrDefault(serviceCategory => serviceCategory.ServiceCategoryOid == serviceCategoryOid); } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } /// @@ -621,7 +621,7 @@ namespace BeWoPlanerMobil.Controllers if(Model == null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var isParsingSuccessful = int.TryParse(filterEnumString, out var filterEnumValue); @@ -643,7 +643,7 @@ namespace BeWoPlanerMobil.Controllers } } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -653,7 +653,7 @@ namespace BeWoPlanerMobil.Controllers if(Model == null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var shouldOverwrite = overwrite.HasValue && overwrite.Value; @@ -735,7 +735,7 @@ namespace BeWoPlanerMobil.Controllers OperationsService.InsertConfirmationReceiptSignature(confirmationReceiptSignature); } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -746,7 +746,7 @@ namespace BeWoPlanerMobil.Controllers if(Model == null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } if(!string.IsNullOrWhiteSpace(oidsAsString)) @@ -775,7 +775,7 @@ namespace BeWoPlanerMobil.Controllers return MobileUtils.SerializeObject(imageStrings); } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } catch(Exception exception) { diff --git a/BeWoPlanerMobil/Controllers/SchedulerController.cs b/BeWoPlanerMobil/Controllers/SchedulerController.cs index 4a793ddee..6fabecf9b 100644 --- a/BeWoPlanerMobil/Controllers/SchedulerController.cs +++ b/BeWoPlanerMobil/Controllers/SchedulerController.cs @@ -524,7 +524,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var oidList = ConvertOidStringToList(resourceOids); @@ -544,7 +544,7 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var oidList = ConvertOidStringToList(oidString); @@ -560,7 +560,7 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var oidList = ConvertOidStringToList(oidString); @@ -575,7 +575,7 @@ namespace BeWoPlanerMobil.Controllers { if(!AbstractModel.HasRightToInsertRessourceAppointments) { - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } if(!string.IsNullOrWhiteSpace(start) && !string.IsNullOrWhiteSpace(end) && !string.IsNullOrWhiteSpace(resourceOids) && Model != null) @@ -597,7 +597,7 @@ namespace BeWoPlanerMobil.Controllers return JsonConvert.SerializeObject(unavailableResources); } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -659,7 +659,7 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var employeeOids = ConvertOidStringToList(oidString); @@ -675,7 +675,7 @@ namespace BeWoPlanerMobil.Controllers if (Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var customerOids = ConvertOidStringToList(oidString); @@ -691,7 +691,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var resourceOidList = ConvertOidStringToList(resourceOids); @@ -784,14 +784,14 @@ namespace BeWoPlanerMobil.Controllers { if(Model is null) { - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.SelectedCustomersForIntervalFinder.Clear(); Model.SelectedEmployeesForIntervalFinder.Clear(); Model.SelectedResourcesForIntervalFinder.Clear(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -808,7 +808,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var oidList = ConvertOidStringToList(resourceOids); @@ -828,7 +828,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var oidList = ConvertOidStringToList(oidString); @@ -844,7 +844,7 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var oidList = ConvertOidStringToList(oidString); @@ -872,7 +872,7 @@ namespace BeWoPlanerMobil.Controllers if(Model?.Employee?.EmployeeOid is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } if(long.TryParse(teamOidString, out var teamOid)) @@ -885,7 +885,7 @@ namespace BeWoPlanerMobil.Controllers } } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -894,7 +894,7 @@ namespace BeWoPlanerMobil.Controllers if(Model?.Employee?.EmployeeOid is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var teamMemberOids = new List(); @@ -932,19 +932,19 @@ namespace BeWoPlanerMobil.Controllers if(Model is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } Model.ShouldLoadTasks = isChecked; - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } catch(Exception exception) { Log.Error(exception.Message, exception); } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -953,7 +953,7 @@ namespace BeWoPlanerMobil.Controllers if(Model?.Employee?.EmployeeOid is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } var appointment = Model.Appointments.FirstOrDefault(app => app.SchedulerAppointmentOid?.Equals(appointmentOid) ?? false); @@ -980,7 +980,7 @@ namespace BeWoPlanerMobil.Controllers } } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } [Authorize] @@ -989,7 +989,7 @@ namespace BeWoPlanerMobil.Controllers if(Model?.Employee?.EmployeeOid is null) { Logout(); - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } if(long.TryParse(teamOidString, out var teamOid)) @@ -1004,7 +1004,7 @@ namespace BeWoPlanerMobil.Controllers } } - return _LeerzeichenFuerGetMethoden; + return LeerzeichenFuerGetMethoden; } } } diff --git a/BeWoPlanerMobil/Views/Scheduler/AppointmentIntervalFinderPartial.cshtml b/BeWoPlanerMobil/Views/Scheduler/AppointmentIntervalFinderPartial.cshtml index f298688b8..2bffb5350 100644 --- a/BeWoPlanerMobil/Views/Scheduler/AppointmentIntervalFinderPartial.cshtml +++ b/BeWoPlanerMobil/Views/Scheduler/AppointmentIntervalFinderPartial.cshtml @@ -42,11 +42,13 @@ try { showSpinner(); + $("#interval-finder-validation-alert").html(""); + $("#interval-finder-validation-alert").collapse("hide"); + var isValid = validateIntervalFinderForm(); if(isValid === false) { hideSpinner(); - // ToDo: Fehlermeldung anzeigen! } else { $("#hidden-submit-btn").click(); } @@ -55,17 +57,54 @@ } } - // ToDo: Mit Alert arbeiten? Oder Bootstrap-Validierung anpassen/manuell aufrufen und prüfen, ob das Startdatum vor dem Enddatum liegt. function validateIntervalFinderForm() { var isValid = false; try { + var validationAlert = $("#interval-finder-validation-alert"); + + validationAlert.html(""); + var duration = parseInt($("#interval-duration").val()); var start = getDateTimeFromPicker("scheduler-interval-start", "scheduler-interval-start-time"); var end = getDateTimeFromPicker("scheduler-interval-end", "scheduler-interval-end-time"); - isValid = isValidDate(new Date(start)) && isValidDate(new Date(end)) && duration > 0 && start.isBefore(end); + var isStartValid = start !== null && isValidDate(new Date(start)); + var isEndValid = end !== null && isValidDate(new Date(end)); + + isValid = isStartValid && isEndValid && duration > 0 && (start !== null && start !== undefined && start.isBefore(end)); + + if(isValid === false) { + var validationMessage = ""; + + if(isStartValid === false && isEndValid === false) { + validationMessage = "Das Start- und Endwerte sind ungültig!"; + } else if(isStartValid === true && isEndValid === false) { + validationMessage = "Das Enddatum ist ungültig!"; + } else if(isStartValid === false && isEndValid === true) { + validationMessage = "Das Startdatum ist ungültig!"; + } + + if(start !== null && start !== undefined && start.isBefore(end) === false) { + if(validationMessage.length === 0) { + validationMessage += "Das Enddatum darf nicht vor dem Startdatum liegen!"; + } else { + validationMessage += "
Das Enddatum darf nicht vor dem Startdatum liegen!"; + } + } + + if($.isNumeric(duration) === false || duration <= 0) { + if(validationMessage.length === 0) { + validationMessage += "Die Dauer ist ungültig!"; + } else { + validationMessage += "
Die Dauer ist ungültig!"; + } + } + + validationAlert.html(validationMessage); + validationAlert.collapse("show"); + } } catch(error) { logError(error.message); } finally { @@ -97,24 +136,6 @@ } } - (function() { - 'use strict'; - window.addEventListener('load', function() { - var forms = document.getElementsByClassName('needs-validation'); - - var validation = Array.prototype.filter.call(forms, function(form) { - form.addEventListener('submit', function(event) { - if(form.checkValidity() === false) { - event.preventDefault(); - event.stopPropagation(); - hideSpinner(); - } - form.classList.add('was-validated'); - }, false); - }); - }, false); - })(); - $("#interval-form-container").ready(function() { var width = getMaxWidth("prepend-text"); $(".prepend-text").width(width); @@ -149,255 +170,241 @@
- @using (Html.BeginForm("FindFreeIntervals", "Scheduler", FormMethod.Post, new { id = "find-appointment-intervals-form", @class = "needs-validation", novalidate = true })) - { -
-
-
-
-
-
- - Von - -
- -
-
- -
-
- Bitte wählen Sie ein Datum, das vor dem Enddatum liegt -
-
-
-
+ +@using(Html.BeginForm("FindFreeIntervals", "Scheduler", FormMethod.Post, new { id = "find-appointment-intervals-form", @class = "needs-validation", novalidate = true })) +{ +
+
+
+
+
+
+ + Von +
-
-
-
- -
-
- -
-
-
- Bitte wählen Sie eine Startuhrzeit -
-
+ +
+
+
-
-
-
-
-
-
- Bis -
-
- -
-
- -
-
-
- Bitte wählen Sie ein Datum, das nach dem Startdatum liegt -
-
-
-
-
-
-
- -
-
- -
-
-
- Bitte wählen Sie eine Enduhrzeit -
-
+
+
+
+
+
+ +
+
+
-
-
-
-
-
-
- Dauer -
-
- -
-
- Bitte wählen Sie eine Dauer von mindestens 10 Minuten -
-
-
-
- - @if(Model.HasResourcesEmployeesOrCustomers) - { - -
- @if(AbstractModel.HasRightToViewEmployeeAppointments) - { -
-
- -
-
- } - @if(AbstractModel.HasRightToViewCustomerAppointments) - { -
-
- -
-
- } - @if(AbstractModel.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any()) - { -
-
- -
-
- } -
- -
- @if(AbstractModel.HasRightToViewEmployeeAppointments) - { -
-
-
- @foreach(var selectedEmployee in Model.SelectedEmployeesForIntervalFinder) - { - - } -
-
-
- } - @if(AbstractModel.HasRightToViewCustomerAppointments) - { -
-
-
- @foreach(var selectedCustomer in Model.SelectedCustomersForIntervalFinder) - { - - } -
-
-
- } - @if(AbstractModel.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any()) - { -
-
-
- @foreach(var selectedResource in Model.SelectedResourcesForIntervalFinder) - { - - } -
-
-
- } -
- } -
- - } -
-
- @using(Html.BeginForm("SetIsInIntervalFinderMode", "Scheduler", FormMethod.Post)) - { - - } -
-
- -
-
-
+
+
+
+
+
+
+ Bis +
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+ Dauer +
+
+ +
+
+
+
+ + @if(Model.HasResourcesEmployeesOrCustomers) + { + +
+ @if(AbstractModel.HasRightToViewEmployeeAppointments) + { +
+
+ +
+
+ } + @if(AbstractModel.HasRightToViewCustomerAppointments) + { +
+
+ +
+
+ } + @if(AbstractModel.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any()) + { +
+
+ +
+
+ } +
+ +
+ @if(AbstractModel.HasRightToViewEmployeeAppointments) + { +
+
+
+ @foreach(var selectedEmployee in Model.SelectedEmployeesForIntervalFinder) + { + + } +
+
+
+ } + @if(AbstractModel.HasRightToViewCustomerAppointments) + { +
+
+
+ @foreach(var selectedCustomer in Model.SelectedCustomersForIntervalFinder) + { + + } +
+
+
+ } + @if(AbstractModel.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any()) + { +
+
+
+ @foreach(var selectedResource in Model.SelectedResourcesForIntervalFinder) + { + + } +
+
+
+ } +
+ } +
+ +} +
+
+ @using(Html.BeginForm("SetIsInIntervalFinderMode", "Scheduler", FormMethod.Post)) + { + + } +
+
+ +
+
+ +
+
+
@if(AbstractModel.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any()) { diff --git a/BeWoPlanerMobil/Views/Scheduler/Scheduler.cshtml b/BeWoPlanerMobil/Views/Scheduler/Scheduler.cshtml index cc2570480..cd872742a 100644 --- a/BeWoPlanerMobil/Views/Scheduler/Scheduler.cshtml +++ b/BeWoPlanerMobil/Views/Scheduler/Scheduler.cshtml @@ -208,17 +208,19 @@
- -
-
-
- - + + @if(!Model.IsInIntervalFinderMode) + { +
+
+
+ + +
-
- @if(Model.HasResourcesEmployeesOrCustomers) + if(Model.HasResourcesEmployeesOrCustomers) {
@if(AbstractModel.HasRightToViewEmployeeAppointments) @@ -247,7 +249,8 @@ }
} -
+ } +

diff --git a/Host/Web.config b/Host/Web.config index 9a1dda193..a2181a484 100644 --- a/Host/Web.config +++ b/Host/Web.config @@ -210,7 +210,7 @@ - +