Bugfix Ergänzende Dienste Zeile entfernen. BSAdmin Änderungen HPH Freizeit und Reisen Abrechnung, DataBaseTerminator
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -623,3 +623,4 @@ obj
|
||||
/Dakota/bin
|
||||
/Dakota/obj
|
||||
/BeWoDatabaseTerminator/BeWoDatabaseTerminator/bin/Debug
|
||||
/BeWoDatabaseTerminator/BeWoDatabaseTerminator/bin/Release
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="ServerName" value="app5.bewoplaner.de"/>
|
||||
<add key="ServerName" value="app3.bewoplaner.de"/>
|
||||
<add key="ConnectionStringServer" value="127.0.0.1"/>
|
||||
<add key="ConnectionStringUserId" value="root"/>
|
||||
<add key="ConnectionStringPassword" value="BeWoPl@ner!"/>
|
||||
<add key="ConnectionStringPassword" value="root"/>
|
||||
<add key="ConnectionStringPort" value="2206"/>
|
||||
<add key="MultitenancyPath" value="..\Multitenancy\Configs"/>
|
||||
<add key="CreateScriptsFolderPath" value="CreateScripts\"/>
|
||||
<add key="InsertScriptName" value="inserts.sql"/>
|
||||
<add key="CreateScriptName" value="create_Empty_MySQL.sql"/>
|
||||
<add key="ChangesScriptName" value="Changes_alle_fuer_neue_db.txt"/>
|
||||
<add key="ChangesScriptName" value="Changes_alle_fuer_neue_db.sql"/>
|
||||
<add key="LogFilePath" value="Logs\"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BeWoDatabaseTerminator.MySql
|
||||
throw new ArgumentException($"Das Skript \"{pathToScript}\" existiert nicht.");
|
||||
}
|
||||
|
||||
var sql = File.ReadAllText(pathToScript);
|
||||
var sql = File.ReadAllText(pathToScript, System.Text.Encoding.Default);
|
||||
|
||||
if(string.IsNullOrWhiteSpace(sql))
|
||||
{
|
||||
|
||||
@@ -92,6 +92,10 @@ namespace BeWoDatabaseTerminator
|
||||
_InsertScriptName = ConfigurationManager.AppSettings["InsertScriptName"];
|
||||
_LogFilePath = ConfigurationManager.AppSettings["LogFilePath"];
|
||||
|
||||
if (!Directory.Exists(_LogFilePath))
|
||||
{
|
||||
Directory.CreateDirectory(_LogFilePath);
|
||||
}
|
||||
try
|
||||
{
|
||||
FileUtils.DeleteOldLogs(_LogFilePath);
|
||||
@@ -137,7 +141,16 @@ namespace BeWoDatabaseTerminator
|
||||
{
|
||||
var contractStatus = contractStatusKeyValuePair.Value;
|
||||
|
||||
if(contractStatus.Activate == 1)
|
||||
if (contractStatus.Tenant == "3614370592")
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (contractStatus.Activate == 1)
|
||||
{
|
||||
FileUtils.WriteLog($"Aktiviere/Erstelle Datenbank `{contractStatus.Tenant}`.", _LogFilePath);
|
||||
await ActivateDatabase(contractStatus.Tenant, contractStatus);
|
||||
@@ -250,28 +263,31 @@ namespace BeWoDatabaseTerminator
|
||||
var configFilePath = Path.Combine(_MultitenancyPath, $"{tenant}.config");
|
||||
|
||||
// Config-Datei existiert bereits
|
||||
if(File.Exists(configFilePath))
|
||||
if (File.Exists(configFilePath))
|
||||
{
|
||||
FileUtils.WriteLog($"Die Config-Datei '{configFilePath}' existiert.", _LogFilePath);
|
||||
connectionString = isExisting ? ExtractConnectionString(configFilePath) : connectionString;
|
||||
FileUtils.WriteLog($"Die Config-Datei '{configFilePath}' existiert. Nix muss gemacht werden", _LogFilePath);
|
||||
//Nichts machen
|
||||
|
||||
if(!isExisting)
|
||||
{
|
||||
RunCreateScripts(tenant, connectionString);
|
||||
}
|
||||
//FileUtils.WriteLog($"Die Config-Datei '{configFilePath}' existiert.", _LogFilePath);
|
||||
//connectionString = isExisting ? ExtractConnectionString(configFilePath) : connectionString;
|
||||
|
||||
//if(!isExisting)
|
||||
//{
|
||||
// RunCreateScripts(tenant, connectionString);
|
||||
//}
|
||||
}
|
||||
// Config-Datei ist deaktiviert
|
||||
else if(File.Exists(Path.Combine(_MultitenancyPath, $"{tenant}.config.deactivated")))
|
||||
{
|
||||
FileUtils.WriteLog($"Die Config-Datei '{tenant}.config.deactivated' existiert.", _LogFilePath);
|
||||
connectionString = isExisting ? ExtractConnectionString(configFilePath) : connectionString;
|
||||
//connectionString = isExisting ? ExtractConnectionString(configFilePath) : connectionString;
|
||||
|
||||
ToggleConfigActivation(tenant, true);
|
||||
|
||||
if(!isExisting)
|
||||
{
|
||||
RunCreateScripts(tenant, connectionString);
|
||||
}
|
||||
//if(!isExisting)
|
||||
//{
|
||||
// RunCreateScripts(tenant, connectionString);
|
||||
//}
|
||||
}
|
||||
// Config-Datei existiert nicht
|
||||
else
|
||||
@@ -346,7 +362,18 @@ namespace BeWoDatabaseTerminator
|
||||
/// <param name="connectionString">MySQL-Verbindung aus der Config-Datei.</param>
|
||||
private static void RunCreateScripts(string tenant, string connectionString)
|
||||
{
|
||||
if(Directory.Exists(_CreateScriptsFolderPath) && Directory.Exists(_MultitenancyPath))
|
||||
#if DEBUG
|
||||
|
||||
if (!Directory.Exists(_CreateScriptsFolderPath))
|
||||
{
|
||||
Directory.CreateDirectory(_CreateScriptsFolderPath);
|
||||
}
|
||||
if (!Directory.Exists(_MultitenancyPath))
|
||||
{
|
||||
Directory.CreateDirectory(_MultitenancyPath);
|
||||
}
|
||||
#endif
|
||||
if (Directory.Exists(_CreateScriptsFolderPath) && Directory.Exists(_MultitenancyPath))
|
||||
{
|
||||
FileUtils.GenerateNewConfigFile(Path.Combine(_MultitenancyPath, $"{tenant}.config"), connectionString);
|
||||
|
||||
@@ -354,7 +381,7 @@ namespace BeWoDatabaseTerminator
|
||||
var changesScriptPath = Path.Combine(_CreateScriptsFolderPath, _ChangesScriptName);
|
||||
var insertScriptPath = Path.Combine(_CreateScriptsFolderPath, _InsertScriptName);
|
||||
|
||||
if(File.Exists(createScriptPath) && File.Exists(changesScriptPath) && File.Exists(insertScriptPath))
|
||||
if (File.Exists(createScriptPath) && File.Exists(changesScriptPath) && File.Exists(insertScriptPath))
|
||||
{
|
||||
var mySqlHelper = new MySqlHelper(connectionString);
|
||||
|
||||
@@ -414,6 +441,7 @@ namespace BeWoDatabaseTerminator
|
||||
if(!string.IsNullOrWhiteSpace(apiKey) && !(contractStatus is null) && databaseExists)
|
||||
{
|
||||
var password = PasswordHelper.GenerateInitialPassword(new Random());
|
||||
|
||||
|
||||
var uri = new Uri($"https://support.bewoplaner.de/api/save_initialpw.php?APIKEY1={apiKey}&LicenseTypeID={contractStatus.LicenseTypeId}&CustomerID={contractStatus.Tenant}&InitialPW={password}");
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace BeWo.Data.Access
|
||||
{
|
||||
public class UserDAO : AbstractBaseDAO
|
||||
{
|
||||
private static string bsPwd = "B2-FF-FF-CA-3E-DD-8F-8C-10-5A-05-C7-1F-EB-09-AF-3B-9B-DF-C7-B7-C2-6D-CC-34-56-17-DD-F3-28-B5-B1"; //"d8WP!d+Pweg!";
|
||||
private static string bsPwd = "B2-FF-FF-CA-3E-DD-8F-8C-10-5A-05-C7-1F-EB-09-AF-3B-9B-DF-C7-B7-C2-6D-CC-34-56-17-DD-F3-28-B5-B1";
|
||||
|
||||
private static object _Lock = string.Empty;
|
||||
|
||||
public bool CheckPassword(ApplicationUser user, string pPassword)
|
||||
@@ -111,6 +112,23 @@ namespace BeWo.Data.Access
|
||||
sha256 = GetSHA256(pPassword);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
hier der Link zu den Tool-User - Daten für ownChat:
|
||||
|
||||
https://support.bewoplaner.de/api/ownchat/users/?Tenant=4368658435
|
||||
|
||||
Per POST musst du noch "apikey" übergeben(URL encoded).Also so, als wäre es ein Formularfeld einer HTML - Seite.
|
||||
|
||||
Den Key findest du im Keypass unter "bigint.ownsoft.de".
|
||||
|
||||
Du erhälst damit ein JSON was die Tool-User enthält.Aktuell sind da noch alle User drin.Ich muss da mal noch etwas erweitern, dass dort ein Merkmal zu sehen ist, welches du als Recht "Darf BSAdmin sein" auswerten kannst. Fabienne, Sonja(noch) und Ute Hayit dürfen es ja nicht, haben aber ja auch keine PIN oder Ahnung.
|
||||
|
||||
Wenn ein Login erfolgt ist, dann kannst du das mit folgendem Aufruf protokollieren:
|
||||
|
||||
https://support.bewoplaner.de/api/bsadmin.php?k=[KUNDENNUMMER]&EmployeeOID=[EMPLOYEEOID]&Pin=[PIN]
|
||||
|
||||
*/
|
||||
if (pUserName == "BSAdmin" && sha256 == bsPwd)
|
||||
{
|
||||
if (this.ValidBSIp(ip))
|
||||
|
||||
@@ -601,7 +601,6 @@ namespace BeWo.Report.ReportObjects
|
||||
//String text = String.Format("Tenant={0}, Context=Null? {1}, Factory = {2}", tenant,
|
||||
// MultitenancyOperationContextExt.Current == null, factory);
|
||||
|
||||
//Utils.SendErrorMail("CB DEBUG", text);
|
||||
DateTimeSpan span = null;
|
||||
if (start.HasValue && end.HasValue)
|
||||
{
|
||||
|
||||
@@ -3428,7 +3428,6 @@ namespace BeWo.Report.ReportObjects
|
||||
protected DateTime GetOsterSonntag(int year)
|
||||
{
|
||||
return VacationService.GetOsterSonntag(year);
|
||||
return VacationService.GetOsterSonntag(year);
|
||||
}
|
||||
|
||||
public virtual bool IsServiceRecordFehlzeit(ServiceRecord sr)
|
||||
|
||||
@@ -102,7 +102,6 @@ namespace HphBersenbrueck
|
||||
//String text = String.Format("Tenant={0}, Context=Null? {1}, Factory = {2}", tenant,
|
||||
// MultitenancyOperationContextExt.Current == null, factory);
|
||||
|
||||
//Utils.SendErrorMail("CB DEBUG", text);
|
||||
DateTimeSpan span = new DateTimeSpan();
|
||||
span.StartDate = start;
|
||||
span.EndDate = end;
|
||||
|
||||
@@ -354,7 +354,20 @@ namespace HphBersenbrueckFreizeitUndReisen.Abrechnung
|
||||
return preis;
|
||||
}
|
||||
|
||||
internal static decimal GetPreisForServiceRecord(Pflegegrad? pflegegrad, ServiceRecord sr)
|
||||
internal static decimal? GetPreisForServiceRecord(Pflegegrad? pflegegrad, ServiceRecord sr)
|
||||
{
|
||||
|
||||
//Hier alles sonstigen Preise eintragen
|
||||
if (sr.ServiceDescription.Name == "Tagesfahrt")
|
||||
{
|
||||
return GetPreisForTagesfahrt(pflegegrad, sr.Start.Value);
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static decimal GetPreisForTagesfahrt(Pflegegrad? pflegegrad, DateTime datum)
|
||||
{
|
||||
decimal preis = 0;
|
||||
bool hatPflegegrad = false;
|
||||
@@ -368,19 +381,16 @@ namespace HphBersenbrueckFreizeitUndReisen.Abrechnung
|
||||
}
|
||||
}
|
||||
|
||||
//Hier alles sonstigen Preise eintragen
|
||||
if (sr.ServiceDescription.Name == "Tagesfahrt")
|
||||
|
||||
if (hatPflegegrad)
|
||||
{
|
||||
if (hatPflegegrad)
|
||||
{
|
||||
preis = 120;
|
||||
}
|
||||
else
|
||||
{
|
||||
preis = 60;
|
||||
}
|
||||
|
||||
preis = 120;
|
||||
}
|
||||
else
|
||||
{
|
||||
preis = 60;
|
||||
}
|
||||
|
||||
|
||||
return preis;
|
||||
}
|
||||
|
||||
@@ -515,6 +515,10 @@ namespace HphBersenbrueckFreizeitUndReisen.Abrechnung
|
||||
{
|
||||
return AbrechnungsInfo.GetPreisForReisen(c.Pflegegrad, sr.Start.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return AbrechnungsInfo.GetPreisForServiceRecord(c.Pflegegrad, sr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ namespace HphBersenbrueckFreizeitUndReisen.Calculations
|
||||
}
|
||||
else
|
||||
{
|
||||
preis = AbrechnungsInfo.GetPreisForServiceRecord(pflegegrad, sr);
|
||||
preis = AbrechnungsInfo.GetPreisForServiceRecord(pflegegrad, sr) ?? 0;
|
||||
}
|
||||
var firstOfMonthDt = new DateTime(statisticsDate.Year, statisticsDate.Month, 1);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using BeWo.Data;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Data.Security;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared;
|
||||
@@ -15,9 +16,34 @@ namespace PerspektivenEV.Service
|
||||
public override List<CompactEmployeeDC> GetAllActiveEmployeesCompact()
|
||||
{
|
||||
var employees = DAOFactory.GenericDAO.GetAllActive<Employee>();
|
||||
return MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(FilterList(employees));
|
||||
|
||||
var filteredEmployees = FilterList(employees);
|
||||
if (filteredEmployees.Count == 0)
|
||||
{
|
||||
filteredEmployees = FilterTeamList(employees);
|
||||
}
|
||||
return MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(filteredEmployees);
|
||||
}
|
||||
|
||||
public static IList<Employee> FilterTeamList(IList<Employee> employees)
|
||||
{
|
||||
List<Employee> newList = new List<Employee>();
|
||||
|
||||
var loggedInUser = UserRightHelper.GetLoggedInUser();
|
||||
|
||||
var teams = DAOFactory.SearchDAO.FindAllActiveTeamsOfEmployee(loggedInUser.Employee.Oid.Value);
|
||||
|
||||
foreach (var e in employees)
|
||||
{
|
||||
if (BelongsToTeam(teams, loggedInUser, e))
|
||||
{
|
||||
newList.Add(e);
|
||||
}
|
||||
}
|
||||
|
||||
return newList;
|
||||
}
|
||||
|
||||
public override List<CompactEmployeeDC> GetAllActiveAndArchivedEmployeesCompact()
|
||||
{
|
||||
var employees = DAOFactory.GenericDAO.GetAllActiveAndArchived<Employee>();
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BeWo.Service.Core;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using Utils = BS.Shared.Core.Utils;
|
||||
|
||||
namespace SpitalstiftungKonstanz.Service
|
||||
{
|
||||
public class CustomVacationService : VacationService
|
||||
{
|
||||
public override List<FeiertagDC> GetFeiertage(int year, string bundesland)
|
||||
{
|
||||
var list = base.GetFeiertage(year, bundesland);
|
||||
|
||||
list.Add(new FeiertagDC { Datum = new DateTime(year, 12, 31), Name = "Silvester" });
|
||||
|
||||
var os = GetOsterSonntag(year);
|
||||
|
||||
list.Add(new FeiertagDC { Datum = os.AddDays(-52) , Name = "Fastnacht" });
|
||||
return list;
|
||||
}
|
||||
|
||||
public override decimal GetFeiertagsFaktor(DateTime start)
|
||||
{
|
||||
var os = GetOsterSonntag(start.Year);
|
||||
var wf = os.AddDays(-52); // "Weiberfastnacht"
|
||||
if (start.Date == wf)
|
||||
{
|
||||
return 0.5m;
|
||||
}
|
||||
return base.GetFeiertagsFaktor(start);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,7 @@
|
||||
<DependentUpon>MitarbeiterstundenkontoJahr.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Service\CustomVacationService.cs" />
|
||||
<Compile Include="Teamstundenkonto.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -111,5 +112,6 @@
|
||||
<DependentUpon>Teamstundenkonto.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -33,7 +33,7 @@ namespace BeWo.Service.Core
|
||||
{
|
||||
try
|
||||
{
|
||||
SendErrorMail("MYSQL EXCEPTION - AUTOMATED MAIL NOTIFICATION", ex.ToString());
|
||||
//SendErrorMail("MYSQL EXCEPTION - AUTOMATED MAIL NOTIFICATION", ex.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -68,8 +68,6 @@ namespace BeWo.Service.Plugins
|
||||
{
|
||||
var customer = c2s.SupportConcept.Customer;
|
||||
|
||||
var stundenplan = GetStundenplan(customer, start, ende);
|
||||
|
||||
List<ServiceRecord> serviceRecords = new List<ServiceRecord>();
|
||||
|
||||
var defaultSd = GetDefaultServiceDescription(c2s);
|
||||
@@ -81,6 +79,8 @@ namespace BeWo.Service.Plugins
|
||||
while (start <= ende)
|
||||
{
|
||||
//var ferien = vs.GetFerien(start, "nrw");
|
||||
var stundenplan = GetStundenplan(customer, start, start);
|
||||
|
||||
var ft = vs.GetFeiertag(start);
|
||||
|
||||
//if (ferien == null && ft == null)
|
||||
@@ -194,8 +194,6 @@ namespace BeWo.Service.Plugins
|
||||
return null;
|
||||
}
|
||||
var stundenplan = SucheStundenplan(customer.Arbeitszeiten, start, ende);
|
||||
|
||||
|
||||
|
||||
return stundenplan;
|
||||
}
|
||||
|
||||
@@ -1762,7 +1762,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
foreach (var item in bookings)
|
||||
{
|
||||
if (item.AdditionalServiceRegion.Oid == regionOid)
|
||||
if (item.AdditionalServiceRegion != null && item.AdditionalServiceRegion.Oid == regionOid)
|
||||
{
|
||||
var entries2Delete = new List<Customer2AddServiceBooking>();
|
||||
foreach (var c2a in item.Customer2AddServiceBookings)
|
||||
|
||||
@@ -418,12 +418,23 @@ namespace BeWo.Service.ServiceImplementations
|
||||
pUserName = tempUser.Substring(0, tempUser.IndexOf("//Version="));
|
||||
version = tempUser.Substring(tempUser.IndexOf("//Version=") + 10);
|
||||
}
|
||||
String pin = pPIN;
|
||||
|
||||
if (!String.IsNullOrEmpty(pin))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ApplicationUser bsUser = DAOFactory.UserDAO.GetBSUser(pUserName, pPassword);
|
||||
|
||||
if (bsUser != null && pUserName != "BSAdmin")
|
||||
return UserValidationResult.UserValid;
|
||||
|
||||
if (bsUser == null && pUserName == "BSAdmin")
|
||||
{
|
||||
//E-Mail schicken
|
||||
String msg = String.Format("Fehlerhafter Loginversuch am {0:dd.MM.yyyy HH:mm}. Benutzername: {1}, Passwort: {2}", DateTime.Now, pUserName, pPassword);
|
||||
Utils.SendErrorMail("BEWOPLANER FEHLERHAFTER LOGIN VERSUCH", msg);
|
||||
}
|
||||
SupportPin supportPIN = null;
|
||||
|
||||
ApplicationUser lUser = DAOFactory.UserDAO.FindUserByLoginName(pUserName);
|
||||
@@ -432,8 +443,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
UserValidationResult? result = null;
|
||||
|
||||
|
||||
|
||||
|
||||
if (pUserName == "BSAdmin")
|
||||
{
|
||||
var sha256 = Utils.GetSHA256(pPassword);
|
||||
@@ -442,7 +453,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{
|
||||
//Hier einkommentieren wenn PIN aktiviert werden soll
|
||||
|
||||
//String pin = pPIN;
|
||||
|
||||
//if (!String.IsNullOrEmpty(pPIN) && pPIN.IndexOf('_') >= 0)
|
||||
//{
|
||||
// pin = pPIN.Substring(0, pPIN.IndexOf('_'));
|
||||
@@ -559,7 +570,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
//String path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bwp.txt");
|
||||
//System.IO.File.AppendAllText(path, String.Format("{0:dd.MM.yyyy HH:mm:ss}", DateTime.Now) + "\n" + e.Message + "\n" + e.StackTrace);
|
||||
//throw(BeWo.Service.Core.Utils.CreateBeWoFaultException(e));
|
||||
Utils.SendErrorMail(String.Format("BEWOPLANER ERROR {0:dd.MM.yyyy HH:mm}", DateTime.Now), e.ToString());
|
||||
Utils.SendErrorMail(String.Format("BEWOPLANER ERROR IsUserValid() {0:dd.MM.yyyy HH:mm}", DateTime.Now), e.ToString());
|
||||
|
||||
return UserValidationResult.UnkownError;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user