MH: Downloadservice + Haus Dülken

This commit is contained in:
2023-09-20 19:15:08 +02:00
parent 9f339eef9c
commit eb9b2c8aae
6 changed files with 134 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
using BeWo.Report.ReportObjects;
namespace HausDuelken
namespace HausDuelken.Alt
{
partial class Klientenstammblatt
{

View File

@@ -6,7 +6,7 @@ using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BeWo.Report;
namespace HausDuelken
namespace HausDuelken.Alt
{
public partial class Klientenstammblatt : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<CustomerDataRO>
{

View File

@@ -1,5 +1,5 @@
using BeWo.Report.ReportObjects;
namespace BeWo.HPHBersenbrueck
namespace HausDuelken
{
partial class Klientenstammblatt
{

View File

@@ -15,7 +15,7 @@ using BeWo.Service.DCEntityMapper;
using System.Collections.Generic;
using BS.Shared.DataContracts;
namespace BeWo.HPHBersenbrueck
namespace HausDuelken
{
public partial class Klientenstammblatt : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<CustomerDataRO>
{
@@ -76,7 +76,7 @@ namespace BeWo.HPHBersenbrueck
List<string> arztrollen = HoleListeMitSpeziellenArztrollen();
var angehoeriger1 = pRO.EnvironmentPersons.FirstOrDefault(p => !p.RelationRole.TypeDescription.ToLower().Contains("gesetzlicher vertreter")
&& !p.RelationRole.DisplayName.ToLower().Contains("allgemeinmediziner") && !p.RelationRole.DisplayName.ToLower().Contains("hausarzt") && !arztrollen.Contains(p.RelationRole.DisplayName.ToLower()));
&& !p.RelationRole.DisplayName.ToLower().Contains("allgemeinmediziner") && !p.RelationRole.DisplayName.ToLower().Contains("hausarzt") && p.RelationRole.DisplayName.ToLower() != "arzt" && !arztrollen.Contains(p.RelationRole.DisplayName.ToLower()));
if (angehoeriger1 != null)
{
lblAngehoeriger1Verhaeltnis.Text = angehoeriger1.RelationRole.DisplayName;
@@ -87,7 +87,8 @@ namespace BeWo.HPHBersenbrueck
lblAngehoeriger1Handy.Text = !angehoeriger1.Person.Communication2.IsNullOrEmpty() ? angehoeriger1.Person.Communication2 : "-";
var angehoeriger2 = pRO.EnvironmentPersons.FirstOrDefault(p => !p.RelationRole.TypeDescription.ToLower().Contains("gesetzlicher vertreter")
&& !p.RelationRole.DisplayName.ToLower().Contains("allgemeinmediziner") && !p.RelationRole.DisplayName.ToLower().Contains("hausarzt") && !arztrollen.Contains(p.RelationRole.DisplayName.ToLower()) && p.Customer2PersonOid != angehoeriger1.Customer2PersonOid);
&& !p.RelationRole.DisplayName.ToLower().Contains("allgemeinmediziner") && !p.RelationRole.DisplayName.ToLower().Contains("hausarzt") && p.RelationRole.DisplayName.ToLower() != "arzt"
&& !arztrollen.Contains(p.RelationRole.DisplayName.ToLower()) && p.Customer2PersonOid != angehoeriger1.Customer2PersonOid);
if (angehoeriger2 != null)
{
lblAngehoeriger2Verhaeltnis.Text = angehoeriger2.RelationRole.DisplayName;
@@ -99,8 +100,8 @@ namespace BeWo.HPHBersenbrueck
}
}
// Das erste Arztfeld ist IMMER Allgemeinmediziner oder Hausarzt. Wenn es den nicht gibt, bleibt es leer
var allgmemeinmediziner = pRO.EnvironmentPersons.FirstOrDefault(p => p.RelationRole.DisplayName.ToLower().Contains("allgemeinmediziner") || p.RelationRole.DisplayName.ToLower().Contains("hausarzt"));
// Das erste Arztfeld ist IMMER Allgemeinmediziner, Arzt oder Hausarzt. Wenn es den nicht gibt, bleibt es leer
var allgmemeinmediziner = pRO.EnvironmentPersons.FirstOrDefault(p => p.RelationRole.DisplayName.ToLower().Contains("allgemeinmediziner") || p.RelationRole.DisplayName.ToLower().Contains("hausarzt") || p.RelationRole.DisplayName.ToLower() == "arzt");
if (allgmemeinmediziner != null)
{
lblAerztlVersorgung1Verhaeltnis.Text = allgmemeinmediziner.RelationRole.DisplayName;
@@ -110,7 +111,7 @@ namespace BeWo.HPHBersenbrueck
lblAerztlVersorgung1Telefon.Text = allgmemeinmediziner.Person.Communication1 != null ? allgmemeinmediziner.Person.Communication1 : "-";
}
// Das zweite Arztfeld soll ein Arzt sein, dessen Rolle einen Begriff aus der Liste "arztrollen" enthält und nicht Hausarzt ist
var arzt = pRO.EnvironmentPersons.FirstOrDefault(p => !p.RelationRole.DisplayName.ToLower().Contains("hausarzt") && arztrollen.Contains(p.RelationRole.DisplayName.ToLower()));
var arzt = pRO.EnvironmentPersons.FirstOrDefault(p => !p.RelationRole.DisplayName.ToLower().Contains("hausarzt") && p.RelationRole.DisplayName.ToLower() != "arzt" && arztrollen.Contains(p.RelationRole.DisplayName.ToLower()));
if (arzt != null)
{
lblAerztlVersorgung2Verhaeltnis.Text = arzt.RelationRole.DisplayName;
@@ -130,7 +131,12 @@ namespace BeWo.HPHBersenbrueck
List<string> rollen = new List<string>();
// alle lowercase zur einfacheren Überprüfung
rollen.Add("arzt");
rollen.Add("ohrenarzt");
rollen.Add("hautarzt");
rollen.Add("frauenarzt");
rollen.Add("hno-arzt");
rollen.Add("zahnarzt");
rollen.Add("augenarzt");
rollen.Add("psychiater");
rollen.Add("drogen- und suchtberatung");
rollen.Add("internist");

View File

@@ -0,0 +1,71 @@
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.ServiceUtils;
using BS.Shared.Translation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.Reporting
{
public class ExportAndPrintHelper
{
// Hier ist der Code, der die StringArrays für den Excel-Export und die Print-Versionen des Exports erstellt
public virtual string[] PrepareHeaderArrayForUserExport()
{
return new string[]{ "Mitarbeiter", "Login", "zugeordnete Benutzergruppen" };
}
public virtual string[][] PrepareContentArrayForUserExport(long[] pSortedOids)
{
var lUser = DAOFactory.GenericDAO.LoadByIDs<ApplicationUser>(pSortedOids);
string[][] lContent = new string[lUser.Count][];
for (int iRowCount = 0; iRowCount < lUser.Count; iRowCount++)
{
lContent[iRowCount] = new string[3];
if (lUser[iRowCount].Employee != null)
{
lContent[iRowCount][0] = lUser[iRowCount].Employee.Person.ToString();
}
else
{
lContent[iRowCount][0] = "";
}
lContent[iRowCount][1] = lUser[iRowCount].LoginName;
lContent[iRowCount][2] = string.Join(", ", lUser[iRowCount].UserGroups.Select(ug => ug.Name).ToArray());
}
return lContent;
}
public virtual string[] PrepareHeaderArrayForUserGroupExport()
{
return new string[] { "Name", "Beschreibung", "zugeordnete Rechte" };
}
public virtual string[][] PrepareContentArrayForUserGroupExport(long[] pSortedOids)
{
Translator t = new Translator(new ServiceTranslator());
var lUserGroups = DAOFactory.GenericDAO.LoadByIDs<UserGroup>(pSortedOids);
string[][] lContent = new string[lUserGroups.Count][];
for (int iRowCount = 0; iRowCount < lUserGroups.Count; iRowCount++)
{
lContent[iRowCount] = new string[3];
lContent[iRowCount][0] = lUserGroups[iRowCount].Name;
lContent[iRowCount][1] = lUserGroups[iRowCount].Description;
lContent[iRowCount][2] = string.Join(", ", lUserGroups[iRowCount].Rights.Select(r => BS.Shared.Core.EnumTranslations.UserRightType2Translations[r.RightType]).OrderBy(s => s).ToArray());
}
return lContent;
}
}
}

View File

@@ -21,6 +21,7 @@ using BeWo.Data;
using Utils = BeWo.Service.Core.Utils;
using BeWo.Service.ServiceUtils;
using BS.Shared.Translation;
using BeWo.Service.Reporting;
namespace BeWo.Service.ServiceImplementations
{
@@ -764,28 +765,34 @@ namespace BeWo.Service.ServiceImplementations
{
string lPath = BS.Shared.Core.Utils.CreateSavePath(AppDomain.CurrentDomain.BaseDirectory, pFileID + ".tmp");
var lUser = DAOFactory.GenericDAO.LoadByIDs<ApplicationUser>(pSortedOids);
#region alt
//var lUser = DAOFactory.GenericDAO.LoadByIDs<ApplicationUser>(pSortedOids);
string[] lHeaderCaption = {
"Mitarbeiter", "Login", "zugeordnete Benutzergruppen"
};
string[][] lContent = new string[lUser.Count][];
//string[] lHeaderCaption = {
// "Mitarbeiter", "Login", "zugeordnete Benutzergruppen"
// };
//string[][] lContent = new string[lUser.Count][];
for (int iRowCount = 0; iRowCount < lUser.Count; iRowCount++)
{
lContent[iRowCount] = new string[3];
if (lUser[iRowCount].Employee != null)
{
lContent[iRowCount][0] = lUser[iRowCount].Employee.Person.ToString();
}
else
{
lContent[iRowCount][0] = "";
}
//for (int iRowCount = 0; iRowCount < lUser.Count; iRowCount++)
//{
// lContent[iRowCount] = new string[3];
// if (lUser[iRowCount].Employee != null)
// {
// lContent[iRowCount][0] = lUser[iRowCount].Employee.Person.ToString();
// }
// else
// {
// lContent[iRowCount][0] = "";
// }
lContent[iRowCount][1] = lUser[iRowCount].LoginName;
lContent[iRowCount][2] = string.Join(", ", lUser[iRowCount].UserGroups.Select(ug => ug.Name).ToArray());
}
// lContent[iRowCount][1] = lUser[iRowCount].LoginName;
// lContent[iRowCount][2] = string.Join(", ", lUser[iRowCount].UserGroups.Select(ug => ug.Name).ToArray());
//}
#endregion
var helper = new ExportAndPrintHelper();
var lHeaderCaption = helper.PrepareHeaderArrayForUserExport();
var lContent = helper.PrepareContentArrayForUserExport(pSortedOids);
return WriteHtmlFile(lHeaderCaption, lContent);
}
@@ -799,23 +806,31 @@ namespace BeWo.Service.ServiceImplementations
{
try
{
Translator t = new Translator(new ServiceTranslator());
var lUserGroups = DAOFactory.GenericDAO.LoadByIDs<UserGroup>(pSortedOids);
var helper = new ExportAndPrintHelper();
var lHeaderCaption = helper.PrepareHeaderArrayForUserGroupExport();
var lContent = helper.PrepareContentArrayForUserGroupExport(pSortedOids);
string[] lHeaderCaption = {
"Name", "Beschreibung", "zugeordnete Rechte"
};
string[][] lContent = new string[lUserGroups.Count][];
#region alt
//Translator t = new Translator(new ServiceTranslator());
for (int iRowCount = 0; iRowCount < lUserGroups.Count; iRowCount++)
{
lContent[iRowCount] = new string[3];
//var lUserGroups = DAOFactory.GenericDAO.LoadByIDs<UserGroup>(pSortedOids);
lContent[iRowCount][0] = lUserGroups[iRowCount].Name;
lContent[iRowCount][1] = lUserGroups[iRowCount].Description;
lContent[iRowCount][2] = string.Join(", ", lUserGroups[iRowCount].Rights.Select(r => BS.Shared.Core.EnumTranslations.UserRightType2Translations[r.RightType]).OrderBy(s => s).ToArray());
}
//string[] lHeaderCaption = {
// "Name", "Beschreibung", "zugeordnete Rechte"
// };
//string[][] lContent = new string[lUserGroups.Count][];
//for (int iRowCount = 0; iRowCount < lUserGroups.Count; iRowCount++)
//{
// lContent[iRowCount] = new string[3];
// lContent[iRowCount][0] = lUserGroups[iRowCount].Name;
// lContent[iRowCount][1] = lUserGroups[iRowCount].Description;
// lContent[iRowCount][2] = string.Join(", ", lUserGroups[iRowCount].Rights.Select(r => BS.Shared.Core.EnumTranslations.UserRightType2Translations[r.RightType]).OrderBy(s => s).ToArray());
//}
#endregion
return WriteHtmlFile(lHeaderCaption, lContent);
}