- Mok Bugfix Bearbeiten von Klienten kann in seltenen Fällen den falschen Klienten überschreiben

- Neuen SystemController erstellt als Endpunkt um System Infos abzufragen (z.B. genutzte Lizenzanzahl)
This commit is contained in:
2026-06-18 10:55:06 +02:00
parent 050276d6b8
commit 8b497888dc
9 changed files with 164 additions and 53 deletions

View File

@@ -305,6 +305,7 @@
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\AbstractBaseController.cs" />
<Compile Include="Controllers\SystemController.cs" />
<Compile Include="Controllers\ChatController.cs" />
<Compile Include="Controllers\CustomerController.cs" />
<Compile Include="Controllers\DevToolsController.cs" />

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseIISExpress>false</UseIISExpress>

View File

@@ -73,70 +73,70 @@ namespace BeWoPlanerMobil.Controllers
private static bool convertInProgress = false;
public ActionResult UpdateFiles(String list, String pwd)
{
try
{
if (convertInProgress)
{
return this.Content("Schon gestartet");
}
convertInProgress = true;
//list = "7000000000";
//pwd = "34vteWVTwegvn9wz4vn9";
if (pwd == "34vteWVTwegvn9wz4vn9")
{
String[] nummern = list.Split(',');
//public ActionResult UpdateFiles(String list, String pwd)
//{
// try
// {
// if (convertInProgress)
// {
// return this.Content("Schon gestartet");
// }
// convertInProgress = true;
// //list = "7000000000";
// //pwd = "34vteWVTwegvn9wz4vn9";
// if (pwd == "34vteWVTwegvn9wz4vn9")
// {
// String[] nummern = list.Split(',');
foreach (var knr in nummern)
{
// foreach (var knr in nummern)
// {
System.Web.HttpContext.Current.Items.Remove("hibernateSession");
// System.Web.HttpContext.Current.Items.Remove("hibernateSession");
MobileSessionFacade.Tenant = knr;
// MobileSessionFacade.Tenant = knr;
var isKundennummerVorhanden = ASPHibernateSessionManager.ConfigureHibernateSessionForWebService();
// var isKundennummerVorhanden = ASPHibernateSessionManager.ConfigureHibernateSessionForWebService();
if (isKundennummerVorhanden)
{
Log.Debug($"Start UpdateFiles for {knr} -----------------------------------------------------------------------------------------------------------------------");
// if (isKundennummerVorhanden)
// {
// Log.Debug($"Start UpdateFiles for {knr} -----------------------------------------------------------------------------------------------------------------------");
//var filePath = GetFilePath(12345678);
// //var filePath = GetFilePath(12345678);
//Log.Debug($"File Path = {filePath}");
// //Log.Debug($"File Path = {filePath}");
SaveAllFilesToDisk(knr);
// SaveAllFilesToDisk(knr);
Log.Debug($"Finished UpdateFiles for {knr} -----------------------------------------------------------------------------------------------------------------------");
//var os = new OperationsServiceImp();
//os.SaveAllFilesToDisk();
}
else
{
Log.Debug($"Kundennummer {knr} nicht vorhanden");
// Log.Debug($"Finished UpdateFiles for {knr} -----------------------------------------------------------------------------------------------------------------------");
// //var os = new OperationsServiceImp();
// //os.SaveAllFilesToDisk();
// }
// else
// {
// Log.Debug($"Kundennummer {knr} nicht vorhanden");
}
// }
}
// }
convertInProgress = false;
return this.Content("Erfolgreich 4");
}
// convertInProgress = false;
// return this.Content("Erfolgreich 4");
// }
convertInProgress = false;
return this.Content("Nicht authorisiert");
}
catch (Exception ex)
{
convertInProgress = false;
return this.Content("ERROR " + ex.Message);
// throw(BeWo.Service.Core.Utils.ThrowBeWoFaultException(e));
return null;
}
}
// convertInProgress = false;
// return this.Content("Nicht authorisiert");
// }
// catch (Exception ex)
// {
// convertInProgress = false;
// return this.Content("ERROR " + ex.Message);
// // throw(BeWo.Service.Core.Utils.ThrowBeWoFaultException(e));
// return null;
// }
//}
private void SaveAllFilesToDisk(String knr)
{

View File

@@ -454,6 +454,17 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
long personOid = 0;
long customerOid = 0;
if (formCollection["PersonOid"] != null)
{
Int64.TryParse(formCollection["PersonOid"], out personOid);
}
if (formCollection["CustomerOid"] != null)
{
Int64.TryParse(formCollection["CustomerOid"], out customerOid);
}
var firstname = formCollection["vorname"]?.RemoveUppercaseEsszett();
var lastname = formCollection["nachname"]?.RemoveUppercaseEsszett();
var alias = formCollection["alias"]?.RemoveUppercaseEsszett();
@@ -483,6 +494,11 @@ namespace BeWoPlanerMobil.Controllers
var customer = Model.SelectedCustomer;
if (customer.CustomerOid != customerOid)
{
Log.Info(String.Format("Fehler in UpdateCustomer: Die Oid vom SelectedCustomer stimmt nicht mit der CustomerOid aus der FormCollection überein: {0} != {1}", customer.CustomerOid, customerOid));
throw new System.Exception("Es ist leider ein Fehler aufgetreten! Die IDs der Klienten stimmen nicht überein!");
}
if(customer is null)
{
return RedirectToActionPermanent("Customer");

View File

@@ -13,6 +13,7 @@ using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using BS.Shared.Services;
using DevExpress.Utils.Extensions;
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Compatibility;
using Newtonsoft.Json;
@@ -184,6 +185,7 @@ namespace BeWoPlanerMobil.Controllers
}
}
//Einfachbuchung
var allCostBearerRelationsSingleBooking = new List<MokSupportConceptListObject> {
new MokSupportConceptListObject(-1, -1, false, false, false, false)
{
@@ -193,7 +195,10 @@ namespace BeWoPlanerMobil.Controllers
{
NameAndDateOfBirth = "Ohne Hilfeplan"
}};
if (Model.IsInEditingMode)
{
allCostBearerRelationsSingleBooking.RemoveAt(allCostBearerRelationsSingleBooking.Count - 1);
}
var allCostBearerRelationsMultiBooking = new List<MokSupportConceptListObject>();

View File

@@ -0,0 +1,81 @@
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.AI;
using BeWo.Service.ServiceImplementations;
using BeWoPlanerMobil.Service;
using BS.Shared;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.ServiceModel.Syndication;
using System.Web.Mvc;
using System.Xml;
namespace BeWoPlanerMobil.Controllers
{
public class SystemController : Controller
{
protected static readonly log4net.ILog Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public string Index()
{
return "Das ist die <b>Default</b> Aktion... Sie haben hier nix verloren;-)";
}
[System.Web.Http.HttpPost]
public JsonResult GetLicenseCount(string k)
{
try
{
var apikey = Request["API-KEY"];
#if DEBUG
k = "demo"; // Test mit Autismus Köln Bonn
apikey = "SfTexuvxVGhNNyASiy43AnWa97VDcDsULyRTfxuWNC3YbNyLhzk48O7Hfzs7PNiy";
#endif
if (k == null)
{
return Json("99", JsonRequestBehavior.AllowGet);
}
MobileSessionFacade.Tenant = k;
var isKundennummerVorhanden = ASPHibernateSessionManager.ConfigureHibernateSessionForWebService();
if (isKundennummerVorhanden)
{
//var operationsServiceImp = new OperationsServiceImp();
//var mandator = operationsServiceImp.GetMandator2(false);
//if (mandator.Apikey == apikey)
//{
Response.AddHeader("Content-Type", "application/json"); //; charset=utf8
var employees = DAOFactory.GenericDAO.GetAllActive<Employee>();
var appUser = DAOFactory.GenericDAO.GetAllActive<ApplicationUser>();
return Json(new { success = true, employee_count = employees.Count, user_count = appUser.Count }, JsonRequestBehavior.AllowGet);
//}
}
return Json(new { success = false }, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
return Json(new { success = false, message = "Error: " + ex.Message }, JsonRequestBehavior.AllowGet);
}
}
}
}

View File

@@ -144,7 +144,7 @@ namespace BeWoPlanerMobil.Service
private static bool ShouldConfigureHibernateSession(HttpApplication context)
{
if(context.Request.FilePath.IndexOf("/Chat/", StringComparison.InvariantCulture) >= 0)
if(context.Request.FilePath.IndexOf("/Chat/", StringComparison.InvariantCulture) >= 0 || context.Request.FilePath.IndexOf("/System/", StringComparison.InvariantCulture) >= 0)
{
return false;
}

View File

@@ -9,6 +9,8 @@ namespace BeWoPlanerMobil.Util
{
public class JsonCustomer
{
public long PersonOid { get; set; }
public long CustomerOid { get; set; }
public string Vorname { get; set; }
public string Nachname { get; set; }
@@ -116,6 +118,8 @@ namespace BeWoPlanerMobil.Util
!string.IsNullOrWhiteSpace(SchwebiAusstAmt);
ICD10Diagnosen = icd10Diagnosen;
PersonOid = customer.PersonOid ?? 0;
CustomerOid = customer.CustomerOid ?? 0;
Vorname = customer.FirstName;
Nachname = customer.LastName;
Alias = customer.CustomerAlias;

View File

@@ -185,10 +185,13 @@
</div>
<div class="collapse @Html.GetCollapsibleClass(Model.Collapsibles2IsShown, "customer-details-collapsible")" id="customer-details-collapsible">
<div class="card-body py-0">
@using(Html.BeginForm("UpdateCustomer", "Customer", FormMethod.Post, new { id = "stammdaten-form", @class = "needs-validation", novalidate = "novalidate" }))
@using (Html.BeginForm("UpdateCustomer", "Customer", FormMethod.Post, new { id = "stammdaten-form", @class = "needs-validation", novalidate = "novalidate" }))
{
var inputDisabled = !Model.HasRightToEditCustomers ? "disabled" : string.Empty;
<input type="hidden" id="PersonOid" name="PersonOid" value="@Model.SelectedJsonCustomer.PersonOid" />
<input type="hidden" id="CustomerOid" name="CustomerOid" value="@Model.SelectedJsonCustomer.CustomerOid" />
<div class="row" id="stammdaten-container">
<div class="col-sm-12 col-md-12 col-lg-6 col-xl-6 mt-2 px-1">
<div class="card">
@@ -196,6 +199,7 @@
<div class="card-title text-bewo-customer-card-header">
Eigenschaften
</div>
<div class="row">
<div class="form-group w-100 mt-1 my-0">
<div class="input-group">
@@ -518,7 +522,7 @@
</div>
</div>
@if(Model.HasRightToEditCustomers)
@if (Model.HasRightToEditCustomers)
{
<div class="col-12 mb-2 px-1 mt-2">
<button type="submit" class="btn btn-primary float-right w-100 m-0" onclick="showSpinner()">Speichern</button>