From 0025b03bcf22781a8fc7c58e12f40a9737ea28a2 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 5 Feb 2025 15:28:44 +0100 Subject: [PATCH 001/104] Format --- BeWo/BSLogoControl.xaml | 211 ++++++++++++++++++++++++---------------- 1 file changed, 126 insertions(+), 85 deletions(-) diff --git a/BeWo/BSLogoControl.xaml b/BeWo/BSLogoControl.xaml index f90fa44a3..ee16ce0a4 100644 --- a/BeWo/BSLogoControl.xaml +++ b/BeWo/BSLogoControl.xaml @@ -1,92 +1,133 @@ - - - + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + \ No newline at end of file From 004a5ecb38e8ab8de51ab5ad0e12b6c5fcf3175c Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 5 Feb 2025 15:29:44 +0100 Subject: [PATCH 002/104] =?UTF-8?q?Gkv=20Summen=20Abfrage=20fertig=20-=20S?= =?UTF-8?q?QL=20Statements=20als=20einzelne=20File=20f=C3=BCr=20bessere=20?= =?UTF-8?q?Lesbarkeit=20-=20Einfach=20als=20Embedded=20Ressource=20beim=20?= =?UTF-8?q?Build=20Vorgang=20w=C3=A4hlen=20und=20durch=20SearchDAO.LoadSQL?= =?UTF-8?q?Statement=20verwenden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Accounting/GkvAbrechnungOverview.xaml.cs | 7 + DakotaUnitTest/App.config | 2 + DakotaUnitTest/DakotaUnitTest.csproj | 2 + DakotaUnitTest/GkvSumServer.cs | 37 ++ Data/ASPHibernateSessionManager.cs | 505 +++++++++--------- Data/Access/SearchDAO.cs | 32 ++ Data/Access/Sqls/GetGkvSumByDateRange.sql | 12 + Data/Data.csproj | 1 + Host/GkvAbrechnungClient.aspx.cs | 31 +- Host/GkvAbrechnungServer.aspx.cs | 7 + Host/Web.config | 2 +- .../AccountingServiceImp.cs | 28 - Shared/AppSender/AppRequestSender.cs | 9 +- .../GkvAbrechnung/GkvClientSumResponseJson.cs | 4 +- 14 files changed, 379 insertions(+), 300 deletions(-) create mode 100644 DakotaUnitTest/GkvSumServer.cs create mode 100644 Data/Access/Sqls/GetGkvSumByDateRange.sql diff --git a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs index b2791d849..1e0f02275 100644 --- a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs +++ b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs @@ -17,6 +17,7 @@ using BeWo.ViewModel; using BeWo.ViewModel.ListViewModel; using BS.Shared; +using BS.Shared.AppSender; using BS.Shared.Core; using BS.Shared.DataContracts; using BS.Shared.DataContracts.GkvAbrechnung; @@ -56,6 +57,12 @@ namespace BeWo.View.Detail.Accounting _NewGkvAbrechnungPopUpView.CreateButtonClicked += NewGkvAbrechnungPopUpViewCreateButtonClicked; _Viewmodel.DateTimeSpanFilter = yearMonthFilter.FilterSpan; + + var req = new GkvClientSumRequestJson(); + req.GkvSecretKey = "DfDGNGn72PKfSYxSUsmRdzuBtpR9novewlmYU3gsjiFgSkaZZeylUXlbO42cWNqiKgLdMUFtWUNZT962F1raQDR7HGUzCNYsFeC"; + req.Tenant = "demo"; + + var res = AppRequestSender.Send(req, "http://localhost:3777/Host/GkvAbrechnungClient.aspx"); } public DownloadLinkEngine DownloadLinkEngine { get; set; } diff --git a/DakotaUnitTest/App.config b/DakotaUnitTest/App.config index 118cb9c3c..f2d389de2 100644 --- a/DakotaUnitTest/App.config +++ b/DakotaUnitTest/App.config @@ -12,5 +12,7 @@ + + \ No newline at end of file diff --git a/DakotaUnitTest/DakotaUnitTest.csproj b/DakotaUnitTest/DakotaUnitTest.csproj index ce493a03e..7b8cf05e7 100644 --- a/DakotaUnitTest/DakotaUnitTest.csproj +++ b/DakotaUnitTest/DakotaUnitTest.csproj @@ -46,11 +46,13 @@ ..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + diff --git a/DakotaUnitTest/GkvSumServer.cs b/DakotaUnitTest/GkvSumServer.cs new file mode 100644 index 000000000..5545a38b6 --- /dev/null +++ b/DakotaUnitTest/GkvSumServer.cs @@ -0,0 +1,37 @@ +using BS.Shared.AppSender; +using BS.Shared.DataContracts.GkvAbrechnung; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; + +namespace DakotaUnitTest +{ + [TestClass] + public class GkvSumServer + { + [TestInitialize] + public void Initialize() + { + + } + + [TestMethod] + public void Test() + { + + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + + + var req = new GkvClientSumRequestJson(); + req.GkvSecretKey = ConfigurationManager.AppSettings.Get("GkvSecretKey"); + req.Tenant = "5000000000"; + + var res = AppRequestSender.Send(req, "https://app5.bewoplaner.de/service/GkvAbrechnungClient.aspx"); + } + } +} diff --git a/Data/ASPHibernateSessionManager.cs b/Data/ASPHibernateSessionManager.cs index 187551ded..bb8ab492b 100644 --- a/Data/ASPHibernateSessionManager.cs +++ b/Data/ASPHibernateSessionManager.cs @@ -19,108 +19,108 @@ using NHibernate.Cfg; namespace BeWo.Data { - public class ASPHibernateSessionManager : IHttpModule - { - public void Dispose() - { - } + public class ASPHibernateSessionManager : IHttpModule + { + public void Dispose() + { + } - public void Init(HttpApplication context) - { - context.AcquireRequestState += (s, e) => - { - Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE"); + public void Init(HttpApplication context) + { + context.AcquireRequestState += (s, e) => + { + Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE"); - if(ShouldConfigureHibernateSession(context)) - { - // TEST FOR DEVEXPRESS. PROBLEMS WITH THIS MODULE WHEN USING AJAX! - if(HttpContext.Current.Session == null) - { - return; - } + if (ShouldConfigureHibernateSession(context)) + { + // TEST FOR DEVEXPRESS. PROBLEMS WITH THIS MODULE WHEN USING AJAX! + if (HttpContext.Current.Session == null) + { + return; + } - // --------------------------------------------------------------- - if(!ConfigureHibernateSession(context)) - { - return; - } + // --------------------------------------------------------------- + if (!ConfigureHibernateSession(context)) + { + return; + } - // throw new Exception("Could not configure database. No tenant parameter found"); - var userLoaded = TryAuthenticateWithRequestParams(context); + // throw new Exception("Could not configure database. No tenant parameter found"); + var userLoaded = TryAuthenticateWithRequestParams(context); - if(!userLoaded) - { - userLoaded = TryAuthenticateWithLoginForm(context); - } - - if(!userLoaded) - { - userLoaded = TryAuthenticateWithGkv(context); - } + if (!userLoaded) + { + userLoaded = TryAuthenticateWithLoginForm(context); + } - if(!userLoaded && !(SessionFacade.LoggedInUser?.Oid is null)) - { - SessionFacade.LoggedInUser = DAOFactory.GenericDAO.LoadByID(SessionFacade.LoggedInUser.Oid.Value); - } - } - }; + if (!userLoaded) + { + userLoaded = TryAuthenticateWithGkv(context); + } - context.EndRequest += (s, e) => - { - if(HttpContext.Current.Items["hibernateSession"] != null) - { - ((ISession) HttpContext.Current.Items["hibernateSession"]).Close(); - } - }; - } + if (!userLoaded && !(SessionFacade.LoggedInUser?.Oid is null)) + { + SessionFacade.LoggedInUser = DAOFactory.GenericDAO.LoadByID(SessionFacade.LoggedInUser.Oid.Value); + } + } + }; - private static bool ShouldConfigureHibernateSession(HttpApplication context) - { - if (string.IsNullOrEmpty(context.Request.FilePath)) - return false; + context.EndRequest += (s, e) => + { + if (HttpContext.Current.Items["hibernateSession"] != null) + { + ((ISession)HttpContext.Current.Items["hibernateSession"]).Close(); + } + }; + } - if (context.Request.FilePath.IndexOf("GkvAbrechnungServer.aspx") >= 0) - return false; + private static bool ShouldConfigureHibernateSession(HttpApplication context) + { + if (string.IsNullOrEmpty(context.Request.FilePath)) + return false; - if (context.Request.FilePath.IndexOf("Admin.aspx") >= 0) - return false; + if (context.Request.FilePath.IndexOf("GkvAbrechnungServer.aspx") >= 0) + return false; - return true; - } + if (context.Request.FilePath.IndexOf("Admin.aspx") >= 0) + return false; - private static bool ConfigureHibernateSession(HttpApplication context) - { - var lTenant = GetTenant(context); - - if(!string.IsNullOrEmpty(lTenant)) - { - SessionFacade.Tenant = lTenant; - } - else - { - lTenant = SessionFacade.Tenant; - } + return true; + } - if(string.IsNullOrEmpty(lTenant)) - { - return false; - } - - var sessionFactory = new Configuration().Configure(context.Server.MapPath(@"Multitenancy\" + lTenant + ".config")).BuildSessionFactory(); - - XmlConfigurator.Configure(); - if(HttpContext.Current.Items.Contains("hibernateSession")) - { - HttpContext.Current.Items.Remove("hibernateSession"); - } + private static bool ConfigureHibernateSession(HttpApplication context) + { + var lTenant = GetTenant(context); - HttpContext.Current.Items.Add("hibernateSession", sessionFactory.OpenSession()); + if (!string.IsNullOrEmpty(lTenant)) + { + SessionFacade.Tenant = lTenant; + } + else + { + lTenant = SessionFacade.Tenant; + } - return true; - } + if (string.IsNullOrEmpty(lTenant)) + { + return false; + } + + var sessionFactory = new Configuration().Configure(context.Server.MapPath(@"Multitenancy\" + lTenant + ".config")).BuildSessionFactory(); + + XmlConfigurator.Configure(); + if (HttpContext.Current.Items.Contains("hibernateSession")) + { + HttpContext.Current.Items.Remove("hibernateSession"); + } + + HttpContext.Current.Items.Add("hibernateSession", sessionFactory.OpenSession()); + + return true; + } private static String GetTenant(HttpApplication context) - { + { var lTenant = String.Empty; String token = context.Request.Params["token"]; @@ -140,201 +140,198 @@ namespace BeWo.Data lTenant = context.Request.Params["k"]; return lTenant; - } + } - private static bool TryAuthenticateWithRequestParams(HttpApplication context) - { - string lUserName = null; - string lPassword = null; + private static bool TryAuthenticateWithRequestParams(HttpApplication context) + { + string lUserName = null; + string lPassword = null; - //if (!context.Request.Params.AllKeys.Contains("tenant")) - // return false; - var lTenant = GetTenant(context); + //if (!context.Request.Params.AllKeys.Contains("tenant")) + // return false; + var lTenant = GetTenant(context); - if (!string.IsNullOrEmpty(lTenant)) - { - if (context.Request.Params.AllKeys.Contains("token")) - { - lUserName = GetLoginInfoFromToken(context.Request.Params["token"])["user"]; - lPassword = GetLoginInfoFromToken(context.Request.Params["token"])["password"]; - } - } - else - { - lUserName = context.Request.Params["username"]; - lPassword = context.Request.Params["token"]; - } - - if (!BS.Shared.Core.Utils.IsAnyNullOrEmpty(lUserName, lPassword)) - { - var ip = context.Request.UserHostAddress; - - var lUser = DAOFactory.UserDAO.FindUserByLoginName(lUserName, ip); - - if (lUser != null && lUser.CheckRC2Password(lPassword)) - { - SessionFacade.LoggedInUser = lUser; - return true; - } - } - - return false; - } - - private static bool TryAuthenticateWithLoginForm(HttpApplication context) - { - var name = context.Request.Params["ctl00$tb_login"]; - var password = context.Request.Params["ctl00$tb_password"]; - - if (!BS.Shared.Core.Utils.IsAnyNullOrEmpty(name, password)) - { - ApplicationUser user = DAOFactory.UserDAO.FindUserByLoginName(name); - - if (user != null && DAOFactory.UserDAO.CheckPassword(user, password)) - { - SessionFacade.LoggedInUser = user; - return true; - } - } - - return false; - } - - private static bool TryAuthenticateWithGkv(HttpApplication context) - { - if (context.Request.FilePath.IndexOf("GkvAbrechnungClient.aspx") == -1) - return false; - - // Eigene IP - var clientip = GetIP(true); - - // App 8 IP - var appsettingip = System.Configuration.ConfigurationManager.AppSettings["App8IpAddress"]; - - // Summen Server - var appsettingip2 = System.Configuration.ConfigurationManager.AppSettings["ServerSumIpAddress"]; - - if (appsettingip != clientip && appsettingip2 != clientip) - return false; - - if(appsettingip == clientip) + if (!string.IsNullOrEmpty(lTenant)) { - var useroidstr = context.Request.Params["useroid"]; - - if (!long.TryParse(useroidstr, out long useroid)) - return false; - - SessionFacade.LoggedInUser = DAOFactory.GenericDAO.LoadByID(useroid); - } + if (context.Request.Params.AllKeys.Contains("token")) + { + lUserName = GetLoginInfoFromToken(context.Request.Params["token"])["user"]; + lPassword = GetLoginInfoFromToken(context.Request.Params["token"])["password"]; + } + } else { - SessionFacade.LoggedInUser = DAOFactory.UserDAO.GetBSUser("BSAdmin", "xyz"); - } - - return true; - } + lUserName = context.Request.Params["username"]; + lPassword = context.Request.Params["token"]; + } - private static string GetIP(bool CheckForward = false) - { - // https://stackoverflow.com/a/13249280 + if (!BS.Shared.Core.Utils.IsAnyNullOrEmpty(lUserName, lPassword)) + { + var ip = context.Request.UserHostAddress; - string ip = null; - if (CheckForward) - { - ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; - } + var lUser = DAOFactory.UserDAO.FindUserByLoginName(lUserName, ip); - if (string.IsNullOrEmpty(ip)) - { - ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; - } - else - { // Using X-Forwarded-For last address - ip = ip.Split(',') - .Last() - .Trim(); - } + if (lUser != null && lUser.CheckRC2Password(lPassword)) + { + SessionFacade.LoggedInUser = lUser; + return true; + } + } - return ip; - } + return false; + } - private static Dictionary GetLoginInfoFromToken(string token) - { - if(string.IsNullOrWhiteSpace(token)) - { - return new Dictionary(); - } + private static bool TryAuthenticateWithLoginForm(HttpApplication context) + { + var name = context.Request.Params["ctl00$tb_login"]; + var password = context.Request.Params["ctl00$tb_password"]; - string decodedToken; + if (!BS.Shared.Core.Utils.IsAnyNullOrEmpty(name, password)) + { + ApplicationUser user = DAOFactory.UserDAO.FindUserByLoginName(name); - token = token.Replace(' ', '+'); - token = token.Trim(','); + if (user != null && DAOFactory.UserDAO.CheckPassword(user, password)) + { + SessionFacade.LoggedInUser = user; + return true; + } + } - try - { - decodedToken = DecryptString(HttpUtility.UrlDecode(token)); - } - catch (Exception) - { - decodedToken = DecryptString(token); - } + return false; + } - if (decodedToken.Split(';')[2].Split('=')[0].Equals("myToken")) - { - var b = decodedToken.Split(';'); + private static bool TryAuthenticateWithGkv(HttpApplication context) + { + if (context.Request.FilePath.IndexOf("GkvAbrechnungClient.aspx") == -1) + return false; - var a = DecryptString(new Regex(@"[\=]{1}").Split(b[2], 2)[1]); - decodedToken += ";" + a; - } + if (!IsRequestIPValid("App8IpAddress")) + return false; - var Params = decodedToken.Split(';'); + var useroidstr = context.Request.Params["useroid"]; - return Params.Select(item => item.Split('=')).Where(a => a[0].Equals("tenant") || a[0].Equals("password") || a[0].Equals("user")).ToDictionary(a => a[0], a => a[1]); - } + if (!long.TryParse(useroidstr, out long useroid)) + return false; - private static string DecryptString(string strToDecrypt) - { - if(string.IsNullOrWhiteSpace(strToDecrypt)) - { - return "Beim Decodieren ist leider ein Fehler aufgetreten."; - } + SessionFacade.LoggedInUser = DAOFactory.GenericDAO.LoadByID(useroid); - strToDecrypt = strToDecrypt.Replace(' ', '+'); + return true; + } - if(strToDecrypt.Contains(",")) - { - strToDecrypt = strToDecrypt.Split(',')[0]; - } + public static bool IsRequestIPValid(string appsetting) + { + var clientip = GetRequestIP(true); + var appsettingip = System.Configuration.ConfigurationManager.AppSettings[appsetting]; - byte[] _Rc2IV = { 35, 138, 177, 253, 227, 63, 2, 27 }; - byte[] _Rc2Key = { 174, 130, 219, 185, 185, 221, 96, 50, 37, 212, 81, 121, 71, 206, 130, 153 }; - var lRc2CSP = new RC2CryptoServiceProvider(); - var lDecryptor = lRc2CSP.CreateDecryptor(_Rc2Key, _Rc2IV); +#if DEBUG + if (clientip == "::1") + return true; +#endif - strToDecrypt = strToDecrypt.Replace(' ', '+'); - strToDecrypt = strToDecrypt.Trim(','); + return clientip == appsettingip; + } - using (var msDecrypt = new MemoryStream(Convert.FromBase64String(strToDecrypt))) - { - using (var csDecrypt = new CryptoStream(msDecrypt, lDecryptor, CryptoStreamMode.Read)) - { - var bytes = new List(); - int b; + private static string GetRequestIP(bool CheckForward = false) + { + // https://stackoverflow.com/a/13249280 - do - { - b = csDecrypt.ReadByte(); + string ip = null; + if (CheckForward) + { + ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; + } - if(b != -1) - { - bytes.Add(Convert.ToByte(b)); - } + if (string.IsNullOrEmpty(ip)) + { + ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; + } + else + { // Using X-Forwarded-For last address + ip = ip.Split(',') + .Last() + .Trim(); + } - } while (b != -1); + return ip; + } - return Encoding.UTF8.GetString(bytes.ToArray()); - } - } - } - } + private static Dictionary GetLoginInfoFromToken(string token) + { + if (string.IsNullOrWhiteSpace(token)) + { + return new Dictionary(); + } + + string decodedToken; + + token = token.Replace(' ', '+'); + token = token.Trim(','); + + try + { + decodedToken = DecryptString(HttpUtility.UrlDecode(token)); + } + catch (Exception) + { + decodedToken = DecryptString(token); + } + + if (decodedToken.Split(';')[2].Split('=')[0].Equals("myToken")) + { + var b = decodedToken.Split(';'); + + var a = DecryptString(new Regex(@"[\=]{1}").Split(b[2], 2)[1]); + decodedToken += ";" + a; + } + + var Params = decodedToken.Split(';'); + + return Params.Select(item => item.Split('=')).Where(a => a[0].Equals("tenant") || a[0].Equals("password") || a[0].Equals("user")).ToDictionary(a => a[0], a => a[1]); + } + + private static string DecryptString(string strToDecrypt) + { + if (string.IsNullOrWhiteSpace(strToDecrypt)) + { + return "Beim Decodieren ist leider ein Fehler aufgetreten."; + } + + strToDecrypt = strToDecrypt.Replace(' ', '+'); + + if (strToDecrypt.Contains(",")) + { + strToDecrypt = strToDecrypt.Split(',')[0]; + } + + byte[] _Rc2IV = { 35, 138, 177, 253, 227, 63, 2, 27 }; + byte[] _Rc2Key = { 174, 130, 219, 185, 185, 221, 96, 50, 37, 212, 81, 121, 71, 206, 130, 153 }; + var lRc2CSP = new RC2CryptoServiceProvider(); + var lDecryptor = lRc2CSP.CreateDecryptor(_Rc2Key, _Rc2IV); + + strToDecrypt = strToDecrypt.Replace(' ', '+'); + strToDecrypt = strToDecrypt.Trim(','); + + using (var msDecrypt = new MemoryStream(Convert.FromBase64String(strToDecrypt))) + { + using (var csDecrypt = new CryptoStream(msDecrypt, lDecryptor, CryptoStreamMode.Read)) + { + var bytes = new List(); + int b; + + do + { + b = csDecrypt.ReadByte(); + + if (b != -1) + { + bytes.Add(Convert.ToByte(b)); + } + + } while (b != -1); + + return Encoding.UTF8.GetString(bytes.ToArray()); + } + } + } + } } \ No newline at end of file diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs index 22698f6ae..c0b708683 100644 --- a/Data/Access/SearchDAO.cs +++ b/Data/Access/SearchDAO.cs @@ -27,6 +27,8 @@ using static System.String; using Appointment = BeWo.Data.Entities.Appointment; using Login = BeWo.Data.Entities.Login; using Resource = BeWo.Data.Entities.Resource; +using System.Reflection; +using System.IO; namespace BeWo.Data.Access { @@ -34,6 +36,24 @@ namespace BeWo.Data.Access { private static readonly Regex RecurrenceIdRegex = new Regex("(Id=\\\"[a-z0-9-]+\\\")"); + private string LoadSQLStatement(string statementName) + { + string sqlStatement = string.Empty; + + string namespacePart = "BeWo.Data.Access.Sqls"; + string resourceName = namespacePart + "." + statementName; + + using (Stream stm = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) + { + if (stm != null) + { + sqlStatement = new StreamReader(stm).ReadToEnd(); + } + } + + return sqlStatement; + } + public IEnumerable FindValueListEntry(ValueListEntryType pType) { return CreateCriteria().Add(Restrictions.Eq(ValueListEntry.PropertyName_Type, pType)).AddOrder(Order.Asc(ValueListEntry.PropertyName_Value)).List(); @@ -1792,6 +1812,18 @@ WHERE sc.Billable = 1 and sr.StartDate >= '{0:yyyy-MM-dd}' and sr.StartDate < '{ return lCriteria.List(); } + public decimal? GetGkvSumByDateRange(DateTime? start, DateTime? end) + { + var sql = LoadSQLStatement("GetGkvSumByDateRange.sql"); + + var rtn = Session.CreateSQLQuery(sql) + .SetParameter(0, start ?? DateTime.MinValue) + .SetParameter(1, end ?? DateTime.MaxValue) + .UniqueResult(); + + return rtn; + } + public IEnumerable GetInvoiceBases(DateTime? startDate, DateTime? endDate, long costBearerOid, String invoiceId) { var lCriteria = CreateCriteriaIsActive(); diff --git a/Data/Access/Sqls/GetGkvSumByDateRange.sql b/Data/Access/Sqls/GetGkvSumByDateRange.sql new file mode 100644 index 000000000..95fce2a4a --- /dev/null +++ b/Data/Access/Sqls/GetGkvSumByDateRange.sql @@ -0,0 +1,12 @@ +SELECT SUM(a1.Betrag) +FROM gkvtransferprotokoll AS t1 +JOIN gkvabrechnung a1 +ON a1.Oid = t1.GkvAbrechnungOid +WHERE t1.ErstelltAm > ? +AND t1.ErstelltAm < ? +AND t1.Oid = ( +SELECT MIN(Oid) +FROM gkvtransferprotokoll AS t2 +WHERE t1.GkvAbrechnungOid = t2.GkvAbrechnungOid +GROUP BY t2.GkvAbrechnungOid +) \ No newline at end of file diff --git a/Data/Data.csproj b/Data/Data.csproj index 5465251e0..9cff0676d 100644 --- a/Data/Data.csproj +++ b/Data/Data.csproj @@ -699,6 +699,7 @@ + PreserveNewest diff --git a/Host/GkvAbrechnungClient.aspx.cs b/Host/GkvAbrechnungClient.aspx.cs index 2e97628ae..485876c5d 100644 --- a/Host/GkvAbrechnungClient.aspx.cs +++ b/Host/GkvAbrechnungClient.aspx.cs @@ -1,4 +1,5 @@ -using BeWo.Data.Access; +using BeWo.Data; +using BeWo.Data.Access; using BeWo.Data.Entities; using BeWo.Service.ServiceImplementations; using BS.Shared; @@ -19,6 +20,13 @@ using System.Web.UI.WebControls; namespace Host { + /// + /// + /// Stellt einen Entpunkt für Clients dar. + /// z.B. app2,app3,app4,... + /// + /// + /// public partial class GkvAbrechnungClient : Page { private readonly string INVALID_INPUT = "Bad Request"; @@ -74,8 +82,11 @@ namespace Host private void ClientResult(GkvClientResultRequestDC req) { + if (!SessionFacade.IsUserLoggedIn()) + SendErrorResponse(INVALID_INPUT + " 4"); + if (req.ResultDCs is null || !req.ResultDCs.Any()) - SendInvalidInputResponse(); + SendErrorResponse(INVALID_INPUT + " 5"); // Response var response = new GkvResponseDC(false); @@ -102,24 +113,22 @@ namespace Host private void ClientSum(GkvClientSumRequestJson req) { - if (req.Tenant is null) - SendInvalidInputResponse(); - if (req.Start > req.End) - SendInvalidInputResponse(); + SendErrorResponse(INVALID_INPUT + " 4"); + + if (!ASPHibernateSessionManager.IsRequestIPValid("GkvSumServerIPAdress")) + SendErrorResponse(INVALID_INPUT + " 5"); // Response var response = new GkvClientSumResponseJson(); try { - var service = new AccountingServiceImp(); + var sum = DAOFactory.SearchDAO.GetGkvSumByDateRange(req.Start, req.End); - var invoices = service.GetCompactGkvAbrechnungByTransferDateRange(req.Start, req.End); - - if(invoices is object && invoices.Count > 0) + if(sum is decimal s) { - response.CompactGkvAbrechnungen = invoices.ToArray(); + response.Sum = s; response.Success = true; } else diff --git a/Host/GkvAbrechnungServer.aspx.cs b/Host/GkvAbrechnungServer.aspx.cs index c6413a3d1..90dfab7db 100644 --- a/Host/GkvAbrechnungServer.aspx.cs +++ b/Host/GkvAbrechnungServer.aspx.cs @@ -18,6 +18,13 @@ using Page = System.Web.UI.Page; namespace Host { + /// + /// + /// Stellt einen Entpunkt für Server dar. + /// Hier: app8 + /// + /// + /// public partial class GkvAbrechnungServer : Page { public const int PROCESS_WAITFOREXIT_MS = 10 * 1000; diff --git a/Host/Web.config b/Host/Web.config index 189683d98..d69ef62c6 100644 --- a/Host/Web.config +++ b/Host/Web.config @@ -245,7 +245,7 @@ - + diff --git a/Service/ServiceImplementations/AccountingServiceImp.cs b/Service/ServiceImplementations/AccountingServiceImp.cs index ad8d0250a..dcb25cc5e 100644 --- a/Service/ServiceImplementations/AccountingServiceImp.cs +++ b/Service/ServiceImplementations/AccountingServiceImp.cs @@ -813,34 +813,6 @@ namespace BeWo.Service.ServiceImplementations return dcs; } - public List GetCompactGkvAbrechnungByTransferDateRange(DateTime? start, DateTime? end) - { - try - { - var entities = DAOFactory.SearchDAO.GetGkvTransferProtokollByDateRange(start, end); - - var filter = entities.Where(x => x.SentDakotaSuccess); - - var oids = filter.Select(x => x.GkvAbrechnungOid).Distinct(); - - if (!oids.Any()) - return null; - - var list = new List(); - - foreach (var oid in oids) - { - var abrechnung = DAOFactory.GenericDAO.LoadByID(oid); - list.Add(abrechnung); - } - - return MapperFactory.CompactGkvAbrechnungDC_GkvAbrechnung.MapToNewDCs(list); - } - catch (Exception e) - { - throw Utils.CreateBeWoFaultException(e); - } - } public GkvAbrechnungCreateResponseDC CreateNewGkvAbrechnung(GkvAbrechnungCreateRequestDC request) { diff --git a/Shared/AppSender/AppRequestSender.cs b/Shared/AppSender/AppRequestSender.cs index c89969c39..97f68cba0 100644 --- a/Shared/AppSender/AppRequestSender.cs +++ b/Shared/AppSender/AppRequestSender.cs @@ -38,13 +38,14 @@ namespace BS.Shared.AppSender } } - public static Res Send(Req request, string url, string tenant) where Req : AppRequestDC where Res : AppResponseDC + public static Res Send(Req request, string url, string tenant = null) where Req : AppRequestDC where Res : AppResponseDC { - request.Tenant = tenant; + if (tenant != null) + request.Tenant = tenant; var data = JsonConvert.SerializeObject(request); - var response_app8_str = Send(url, data, tenant); + var response_app8_str = Send(url, data, request.Tenant); if (string.IsNullOrEmpty(response_app8_str)) return null; @@ -101,7 +102,7 @@ namespace BS.Shared.AppSender response = await client.UploadStringTaskAsync(url, "POST", dataString); } - + return response; } } diff --git a/Shared/DataContracts/GkvAbrechnung/GkvClientSumResponseJson.cs b/Shared/DataContracts/GkvAbrechnung/GkvClientSumResponseJson.cs index 84b69f2c5..57c9164a7 100644 --- a/Shared/DataContracts/GkvAbrechnung/GkvClientSumResponseJson.cs +++ b/Shared/DataContracts/GkvAbrechnung/GkvClientSumResponseJson.cs @@ -16,7 +16,7 @@ namespace BS.Shared.DataContracts.GkvAbrechnung } - [JsonProperty("gkvinvoices")] - [DataMember] public CompactGkvAbrechnungDC[] CompactGkvAbrechnungen { get; set; } + [JsonProperty("sum")] + [DataMember] public decimal Sum { get; set; } } } From d5d366236bab91ac9bad67d34de5321a0ec700c6 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 5 Feb 2025 15:55:02 +0100 Subject: [PATCH 003/104] =?UTF-8?q?Test=20=C3=BCber=20UnitTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail/Accounting/GkvAbrechnungOverview.xaml.cs | 6 ------ DakotaUnitTest/App.config | 2 -- DakotaUnitTest/GkvSumServer.cs | 11 ++++++++--- Host/GkvAbrechnungClient.aspx.cs | 5 +++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs index 1e0f02275..75bd05354 100644 --- a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs +++ b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs @@ -57,12 +57,6 @@ namespace BeWo.View.Detail.Accounting _NewGkvAbrechnungPopUpView.CreateButtonClicked += NewGkvAbrechnungPopUpViewCreateButtonClicked; _Viewmodel.DateTimeSpanFilter = yearMonthFilter.FilterSpan; - - var req = new GkvClientSumRequestJson(); - req.GkvSecretKey = "DfDGNGn72PKfSYxSUsmRdzuBtpR9novewlmYU3gsjiFgSkaZZeylUXlbO42cWNqiKgLdMUFtWUNZT962F1raQDR7HGUzCNYsFeC"; - req.Tenant = "demo"; - - var res = AppRequestSender.Send(req, "http://localhost:3777/Host/GkvAbrechnungClient.aspx"); } public DownloadLinkEngine DownloadLinkEngine { get; set; } diff --git a/DakotaUnitTest/App.config b/DakotaUnitTest/App.config index f2d389de2..118cb9c3c 100644 --- a/DakotaUnitTest/App.config +++ b/DakotaUnitTest/App.config @@ -12,7 +12,5 @@ - - \ No newline at end of file diff --git a/DakotaUnitTest/GkvSumServer.cs b/DakotaUnitTest/GkvSumServer.cs index 5545a38b6..ce3346788 100644 --- a/DakotaUnitTest/GkvSumServer.cs +++ b/DakotaUnitTest/GkvSumServer.cs @@ -26,12 +26,17 @@ namespace DakotaUnitTest ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; - var req = new GkvClientSumRequestJson(); - req.GkvSecretKey = ConfigurationManager.AppSettings.Get("GkvSecretKey"); - req.Tenant = "5000000000"; + req.GkvSecretKey = "DfDGNGn72PKfSYxSUsmRdzuBtpR9novewlmYU3gsjiFgSkaZZeylUXlbO42cWNqiKgLdMUFtWUNZT962F1raQDR7HGUzCNYsFeC"; + req.Tenant = "9005111114"; + req.Start = new DateTime(2025, 1, 30); + req.End = new DateTime(2025, 1, 30, 10, 0, 0); var res = AppRequestSender.Send(req, "https://app5.bewoplaner.de/service/GkvAbrechnungClient.aspx"); + + var test = res.Sum; + + Assert.IsTrue(res.Success); } } } diff --git a/Host/GkvAbrechnungClient.aspx.cs b/Host/GkvAbrechnungClient.aspx.cs index 485876c5d..c6493e368 100644 --- a/Host/GkvAbrechnungClient.aspx.cs +++ b/Host/GkvAbrechnungClient.aspx.cs @@ -129,12 +129,13 @@ namespace Host if(sum is decimal s) { response.Sum = s; - response.Success = true; } else { - response.Message = "no records"; + response.Message = "sum is null"; } + + response.Success = true; } catch (GkvException e) { From 0580d0117f91c8760c0b853ddc60343d6d5e9876 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Thu, 6 Feb 2025 15:10:47 +0100 Subject: [PATCH 004/104] Rename Script Folder --- Data/Access/{Sqls => Scripts}/GetGkvSumByDateRange.sql | 0 Data/Data.csproj | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) rename Data/Access/{Sqls => Scripts}/GetGkvSumByDateRange.sql (100%) diff --git a/Data/Access/Sqls/GetGkvSumByDateRange.sql b/Data/Access/Scripts/GetGkvSumByDateRange.sql similarity index 100% rename from Data/Access/Sqls/GetGkvSumByDateRange.sql rename to Data/Access/Scripts/GetGkvSumByDateRange.sql diff --git a/Data/Data.csproj b/Data/Data.csproj index 9cff0676d..22397f16a 100644 --- a/Data/Data.csproj +++ b/Data/Data.csproj @@ -46,6 +46,8 @@ 4 AllRules.ruleset false + + pdbonly @@ -699,7 +701,7 @@ - + PreserveNewest From a4049e488a35bf851941087d05e85c81c6a0739d Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Thu, 6 Feb 2025 15:16:00 +0100 Subject: [PATCH 005/104] KTDReaderGUI Init + BeWo.Styles seperates Projekt -> Eigene Testanwendungen --- .gitignore | 4 + BeWo.Styles/BeWo.Styles.csproj | 134 +++++++++++++++ BeWo.Styles/Colors/Colors.xaml | 10 ++ BeWo.Styles/ControlStyles/ButtonStyles.xaml | 153 +++++++++++++++++ BeWo.Styles/ControlStyles/CheckBoxStyles.xaml | 7 + BeWo.Styles/ControlStyles/ComboBoxStyles.xaml | 161 ++++++++++++++++++ .../ControlStyles/CustomControlsStyles.xaml | 1 + BeWo.Styles/ControlStyles/DateEditStyles.xaml | 74 ++++++++ BeWo.Styles/ControlStyles/GroupBoxStyles.xaml | 52 ++++++ BeWo.Styles/ControlStyles/LabelStyles.xaml | 19 +++ BeWo.Styles/ControlStyles/ListBoxStyles.xaml | 27 +++ .../ControlStyles/NullItemComboBoxStyles.xaml | 148 ++++++++++++++++ .../ControlStyles/RadioButtonStyles.xaml | 7 + BeWo.Styles/ControlStyles/TextBoxStyles.xaml | 71 ++++++++ BeWo.Styles/ControlStyles/TextEditStyles.xaml | 76 +++++++++ .../ControlStyles/ToggleButtonStyles.xaml | 149 ++++++++++++++++ .../Converters/EnumTranslationConverter.cs | 37 ++++ .../DataTemplates/ControlTemplates.xaml | 92 ++++++++++ BeWo.Styles/DataTemplates/DataTemplates.xaml | 4 + BeWo.Styles/ModernOrangeBlack.xaml | 41 +++++ BeWo.Styles/Properties/AssemblyInfo.cs | 36 ++++ BeWoDakota.sln | 17 ++ Dakota/Dakota.csproj | 24 ++- Tools/KTDReaderGUI/KTDReaderGUI.sln | 31 ++++ Tools/KTDReaderGUI/KTDReaderGUI/App.config | 6 + Tools/KTDReaderGUI/KTDReaderGUI/App.xaml | 8 + Tools/KTDReaderGUI/KTDReaderGUI/App.xaml.cs | 17 ++ .../KTDReaderGUI/KTDReaderGUI.csproj | 98 +++++++++++ .../KTDReaderGUI/KTDReaderGUI/MainWindow.xaml | 27 +++ .../KTDReaderGUI/MainWindow.xaml.cs | 28 +++ .../KTDReaderGUI/Properties/AssemblyInfo.cs | 55 ++++++ .../Properties/Resources.Designer.cs | 70 ++++++++ .../KTDReaderGUI/Properties/Resources.resx | 117 +++++++++++++ .../Properties/Settings.Designer.cs | 29 ++++ .../KTDReaderGUI/Properties/Settings.settings | 7 + 35 files changed, 1831 insertions(+), 6 deletions(-) create mode 100644 BeWo.Styles/BeWo.Styles.csproj create mode 100644 BeWo.Styles/Colors/Colors.xaml create mode 100644 BeWo.Styles/ControlStyles/ButtonStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/CheckBoxStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/ComboBoxStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/CustomControlsStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/DateEditStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/GroupBoxStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/LabelStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/ListBoxStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/NullItemComboBoxStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/RadioButtonStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/TextBoxStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/TextEditStyles.xaml create mode 100644 BeWo.Styles/ControlStyles/ToggleButtonStyles.xaml create mode 100644 BeWo.Styles/Converters/EnumTranslationConverter.cs create mode 100644 BeWo.Styles/DataTemplates/ControlTemplates.xaml create mode 100644 BeWo.Styles/DataTemplates/DataTemplates.xaml create mode 100644 BeWo.Styles/ModernOrangeBlack.xaml create mode 100644 BeWo.Styles/Properties/AssemblyInfo.cs create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI.sln create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/App.config create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/App.xaml create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/App.xaml.cs create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/KTDReaderGUI.csproj create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/MainWindow.xaml create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/MainWindow.xaml.cs create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/Properties/AssemblyInfo.cs create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/Properties/Resources.Designer.cs create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/Properties/Resources.resx create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/Properties/Settings.Designer.cs create mode 100644 Tools/KTDReaderGUI/KTDReaderGUI/Properties/Settings.settings diff --git a/.gitignore b/.gitignore index 5a83c9164..0978652d6 100644 --- a/.gitignore +++ b/.gitignore @@ -645,5 +645,9 @@ obj /ReportImp/demo_Sozio/SoziotherapieRechnung.cs /ReportImp/demo_Sozio/SoziotherapieRechnung.resx /ReportImp/demo_Sozio/demo_Sozio.csproj + /BeWo/DebugConfig.txt /logs/mobilelog.txt +/BeWo.Styles/bin +/BeWo.Styles/obj +/Tools/KTDReaderGUI/.vs* \ No newline at end of file diff --git a/BeWo.Styles/BeWo.Styles.csproj b/BeWo.Styles/BeWo.Styles.csproj new file mode 100644 index 000000000..4872bf966 --- /dev/null +++ b/BeWo.Styles/BeWo.Styles.csproj @@ -0,0 +1,134 @@ + + + + + Debug + AnyCPU + {9BAB16DE-E284-4B57-BD09-763FC5CE521A} + Library + Properties + BeWo.Styles + BeWo.Styles + v4.5.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + {d5e53b0f-bf5a-41e8-93e2-0f32845fc729} + Controls + + + {2f50b83d-a3f0-4ec4-979a-3f9b7e3d8ed4} + Shared + + + + \ No newline at end of file diff --git a/BeWo.Styles/Colors/Colors.xaml b/BeWo.Styles/Colors/Colors.xaml new file mode 100644 index 000000000..af79deddd --- /dev/null +++ b/BeWo.Styles/Colors/Colors.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/ButtonStyles.xaml b/BeWo.Styles/ControlStyles/ButtonStyles.xaml new file mode 100644 index 000000000..5e01c9139 --- /dev/null +++ b/BeWo.Styles/ControlStyles/ButtonStyles.xaml @@ -0,0 +1,153 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/CheckBoxStyles.xaml b/BeWo.Styles/ControlStyles/CheckBoxStyles.xaml new file mode 100644 index 000000000..9a8a06781 --- /dev/null +++ b/BeWo.Styles/ControlStyles/CheckBoxStyles.xaml @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/ComboBoxStyles.xaml b/BeWo.Styles/ControlStyles/ComboBoxStyles.xaml new file mode 100644 index 000000000..f935b3b8f --- /dev/null +++ b/BeWo.Styles/ControlStyles/ComboBoxStyles.xaml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/CustomControlsStyles.xaml b/BeWo.Styles/ControlStyles/CustomControlsStyles.xaml new file mode 100644 index 000000000..b43065eec --- /dev/null +++ b/BeWo.Styles/ControlStyles/CustomControlsStyles.xaml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/DateEditStyles.xaml b/BeWo.Styles/ControlStyles/DateEditStyles.xaml new file mode 100644 index 000000000..9a7c7a5c7 --- /dev/null +++ b/BeWo.Styles/ControlStyles/DateEditStyles.xaml @@ -0,0 +1,74 @@ + + + + + + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/GroupBoxStyles.xaml b/BeWo.Styles/ControlStyles/GroupBoxStyles.xaml new file mode 100644 index 000000000..fa4852bd1 --- /dev/null +++ b/BeWo.Styles/ControlStyles/GroupBoxStyles.xaml @@ -0,0 +1,52 @@ + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/LabelStyles.xaml b/BeWo.Styles/ControlStyles/LabelStyles.xaml new file mode 100644 index 000000000..5e6432acc --- /dev/null +++ b/BeWo.Styles/ControlStyles/LabelStyles.xaml @@ -0,0 +1,19 @@ + + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/ListBoxStyles.xaml b/BeWo.Styles/ControlStyles/ListBoxStyles.xaml new file mode 100644 index 000000000..db8eee48f --- /dev/null +++ b/BeWo.Styles/ControlStyles/ListBoxStyles.xaml @@ -0,0 +1,27 @@ + + + + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/NullItemComboBoxStyles.xaml b/BeWo.Styles/ControlStyles/NullItemComboBoxStyles.xaml new file mode 100644 index 000000000..603a56e11 --- /dev/null +++ b/BeWo.Styles/ControlStyles/NullItemComboBoxStyles.xaml @@ -0,0 +1,148 @@ + + + + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/RadioButtonStyles.xaml b/BeWo.Styles/ControlStyles/RadioButtonStyles.xaml new file mode 100644 index 000000000..70e0a0711 --- /dev/null +++ b/BeWo.Styles/ControlStyles/RadioButtonStyles.xaml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/TextBoxStyles.xaml b/BeWo.Styles/ControlStyles/TextBoxStyles.xaml new file mode 100644 index 000000000..65b641174 --- /dev/null +++ b/BeWo.Styles/ControlStyles/TextBoxStyles.xaml @@ -0,0 +1,71 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/TextEditStyles.xaml b/BeWo.Styles/ControlStyles/TextEditStyles.xaml new file mode 100644 index 000000000..f6c7d656b --- /dev/null +++ b/BeWo.Styles/ControlStyles/TextEditStyles.xaml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BeWo.Styles/ControlStyles/ToggleButtonStyles.xaml b/BeWo.Styles/ControlStyles/ToggleButtonStyles.xaml new file mode 100644 index 000000000..1829f1fff --- /dev/null +++ b/BeWo.Styles/ControlStyles/ToggleButtonStyles.xaml @@ -0,0 +1,149 @@ + + + \ No newline at end of file diff --git a/BeWo.Styles/Converters/EnumTranslationConverter.cs b/BeWo.Styles/Converters/EnumTranslationConverter.cs new file mode 100644 index 000000000..f8293c6fc --- /dev/null +++ b/BeWo.Styles/Converters/EnumTranslationConverter.cs @@ -0,0 +1,37 @@ +using BS.Shared.Core; +using System; +using System.Globalization; +using System.Windows.Data; + +namespace BeWo.Styles.Converters +{ + public class EnumTranslationConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is Enum e) + { + if (EnumTranslations.Wohnhilfe2Translation.TryGetValue(e, out string v)) + { + return v; + } + // RE: + // EnumTranslationConverter, aber betrachtet nicht alle? + // Brauche hier eig nur EnumTranslations.Gkv2Translation + if (EnumTranslations.AllTranslations.TryGetValue(e, out string vv)) + { + return vv; + } + + return e; + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BeWo.Styles/DataTemplates/ControlTemplates.xaml b/BeWo.Styles/DataTemplates/ControlTemplates.xaml new file mode 100644 index 000000000..c80f0ce16 --- /dev/null +++ b/BeWo.Styles/DataTemplates/ControlTemplates.xaml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BeWo.Styles/DataTemplates/DataTemplates.xaml b/BeWo.Styles/DataTemplates/DataTemplates.xaml new file mode 100644 index 000000000..e1a69a1f9 --- /dev/null +++ b/BeWo.Styles/DataTemplates/DataTemplates.xaml @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/BeWo.Styles/ModernOrangeBlack.xaml b/BeWo.Styles/ModernOrangeBlack.xaml new file mode 100644 index 000000000..20f5b9e85 --- /dev/null +++ b/BeWo.Styles/ModernOrangeBlack.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +