Codebasis als Dateien ins Arbeitsrepo statt als Gitlink

QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142)
getrackt, ohne .gitmodules und ohne erreichbares Remote. Der
Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar
gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege
der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen.

Umstellung:
- Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert
  (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6)
- Gitlink aus dem Index entfernt
- Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB

Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte
bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
This commit is contained in:
Christoph Schwörer
2026-08-26 07:43:51 +02:00
parent 18edae75b6
commit f045b99a25
24664 changed files with 5846716 additions and 1 deletions
@@ -0,0 +1,240 @@
using Centron.BusinessLogic;
using Centron.BusinessLogic.EmployeeArea;
using Centron.BusinessLogic.WebServices.Accounts;
using Centron.BusinessLogic.WebServices.Accounts.Activities;
using Centron.BusinessLogic.WebServices.Mail.Templates;
using Centron.Data.Entities.Administration.Logins;
using Centron.Data.WebServices.Mail;
using Centron.Data.WebServices.Mail.Templates;
using Centron.Interfaces;
using Centron.Interfaces.Accounts;
using Centron.Interfaces.Accounts.Activities;
using Centron.Interfaces.BL;
using Centron.Interfaces.Mail.Enums;
using Centron.Tests.EndToEnd.Infrastructure;
using CentronSoftware.Centron.WebServices.Entities.Accounts.Activities;
using CentronSoftware.Centron.WebServices.Entities.Mail.Templates;
using DevExpress.XtraRichEdit;
using System;
using System.Linq;
using Xunit.Abstractions;
namespace Centron.Tests.EndToEnd.Tests.CRMActivity
{
public class CRMActivityTest : EndToEndTest
{
private LoggedInUser GetUser(BLSession session) => new LoggedInUser(session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11));
public CRMActivityTest(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
var accountActivity = this.GetAccountActivity();
this.GetCrmActivityMailTemplate(accountActivity.I3D, "NoPartners");
this.AddPartner();
this.UpdatePartnerInfo();
this.GetCrmActivityMailTemplate(accountActivity.I3D, "PartnerWith_NotifyAtCrmActivitiesTo_Flag");
this.UpdatePartnerInfoWithEmail();
this.GetCrmActivityMailTemplate(accountActivity.I3D, "PartnerWith_NotifyAtCrmActivities_Flag");
this.AddAdditionalToPartner();
this.GetCrmActivityMailTemplate(accountActivity.I3D, "PartnersWith_NotifyAtCrmActivitiesTo_Flag");
this.AddCrmActivityMailTemplate();
this.UpdateActivityRtfText();
this.GetCrmActivityMailTemplate(2, "PartnerWith_NotifyAtCrmActivities_Flag_WithMailTemplate");
}
private AccountActivitySearchItemDTO GetAccountActivity()
{
using (var session = new BLSession())
{
var result = session.GetBL<AccountActivitiesWebServiceBL>().SearchActivitiesThroughPaging(new AccountActivitySearchFilter(), 1, 100, this.GetUser(session)).ThrowIfError();
var activity = result.Result.First();
// Change the activity to a CRM-Activity.
this.Sql($"UPDATE AccountActivities SET ActivityKind = {(int)AccountActivityKind.CRM} WHERE I3D = {activity.I3D}");
this.Sql($"UPDATE AccountActivities SET ActivityKind = {(int)AccountActivityKind.CRM} WHERE I3D = 2");
return activity;
}
}
private void GetCrmActivityMailTemplate(int activityI3D, string testName)
{
using (var session = new BLSession())
{
var result = session.GetBL<AccountActivitiesWebServiceBL>().GetCrmMailTemplate(activityI3D, "test123@c-entron.de", this.GetUser(session));
var mailTemplateResult = result.Data.FirstOrDefault();
var mail = new MailDTO
{
From = mailTemplateResult.From,
To = mailTemplateResult.To,
CC = mailTemplateResult.CC,
BCC = mailTemplateResult.BCC,
Subject = mailTemplateResult.Subject,
Body = new MailBodyDTO { Text = this.GetPlainText(mailTemplateResult.Body.Text), Type = CentronMailBodyType.Plain },
MailAttachments = mailTemplateResult.MailAttachments,
MailSignature = mailTemplateResult.MailSignature,
};
this.Verifier.Verify(testName, mail);
}
}
private void AddPartner()
{
using(var session = new BLSession())
{
session.GetBL<AccountWebServiceBL>().AddPartnerTooAccount(1, 10, 25).ThrowIfError();
session.GetBL<AccountWebServiceBL>().AddPartnerTooAccount(1, 5, 16).ThrowIfError(); // without email
}
}
private void UpdatePartnerInfo()
{
using (var session = new BLSession())
{
var filter = new AccountRelationshipFilter
{
AccountI3D = 1,
FilterKind = AccountRelationshipFilterKind.GetRelationshipsForAccount
};
var result = session.GetBL<AccountWebServiceBL>().GetAccountRelationships(filter).ThrowIfError();
result[0].NotifyAtCrmActivitiesTo = true;
result[1].NotifyAtCrmActivities = true;
foreach (var partner in result)
{
session.GetBL<AccountWebServiceBL>().UpdatePartnerInfo(partner).ThrowIfError();
}
}
}
private void UpdatePartnerInfoWithEmail()
{
using (var session = new BLSession())
{
var filter = new AccountRelationshipFilter
{
AccountI3D = 1,
FilterKind = AccountRelationshipFilterKind.GetRelationshipsForAccount
};
var result = session.GetBL<AccountWebServiceBL>().GetAccountRelationships(filter).ThrowIfError();
this.Sql("UPDATE AccountAddressContacts SET Email1 = 'test@c-entron.de' WHERE I3D = 16");
result[0].NotifyAtCrmActivitiesTo = false;
result[0].NotifyAtCrmActivities = true;
result[1].NotifyAtCrmActivitiesTo = false;
result[1].NotifyAtCrmActivities = true;
foreach (var partner in result)
{
session.GetBL<AccountWebServiceBL>().UpdatePartnerInfo(partner).ThrowIfError();
}
}
}
private void AddAdditionalToPartner()
{
using (var session = new BLSession())
{
session.GetBL<AccountWebServiceBL>().AddPartnerTooAccount(1, 5, 17).ThrowIfError();
var filter = new AccountRelationshipFilter
{
AccountI3D = 1,
FilterKind = AccountRelationshipFilterKind.GetRelationshipsForAccount
};
var result = session.GetBL<AccountWebServiceBL>().GetAccountRelationships(filter).ThrowIfError();
result[0].NotifyAtCrmActivitiesTo = false;
result[0].NotifyAtCrmActivities = true;
result[1].NotifyAtCrmActivitiesTo = true;
result[2].NotifyAtCrmActivitiesTo = true;
result[2].NotifyAtCrmActivities = false;
foreach (var partner in result)
{
session.GetBL<AccountWebServiceBL>().UpdatePartnerInfo(partner).ThrowIfError();
}
}
}
private void AddCrmActivityMailTemplate()
{
using(var session = new BLSession())
{
var mailTemplate = new MailTemplateDTO
{
Subject = "Test CRM Mail Template",
Body = this.GetRichText($"This is some random text! {Environment.NewLine}{Environment.NewLine}@@BodyBis€€Trennzeichen@@ {Environment.NewLine}{Environment.NewLine}@@ErsteBodyZeile@@"),
ObjectKind = (int)CentronObjectKindNumeric.AccountActivity,
SubObjectKind = (int)AccountActivityKind.CRM,
IsActive = true
};
session.GetBL<MailTemplateWebServiceBL>().SaveOrUpdateMailTemplate(this.GetUser(session), mailTemplate);
}
}
private void UpdateActivityRtfText()
{
var activityText = $"This is some random text to see if variables work. {Environment.NewLine} Not sure, but this is supposed to work with delimiter €€ {Environment.NewLine} This is some additional text.";
var activityRichText = this.GetRichText(activityText).Replace("'", "''");
this.Sql($"UPDATE AccountActivities SET TextRtf = '{ activityRichText }' WHERE I3D = 2");
}
private string GetRichText(string text)
{
if (string.IsNullOrWhiteSpace(text))
return string.Empty;
if (text.TrimStart().StartsWith(@"{\rtf1", StringComparison.Ordinal) == false)
{
using (var richEditServer = new RichEditDocumentServer())
{
richEditServer.Text = text;
return richEditServer.RtfText;
}
}
return text;
}
public string GetPlainText(string richtext)
{
if (string.IsNullOrWhiteSpace(richtext))
return string.Empty;
if (richtext.TrimStart().StartsWith(@"{\rtf1", StringComparison.Ordinal))
{
using (var richEditServer = new RichEditDocumentServer())
{
richEditServer.RtfText = richtext;
return richEditServer.Text;
}
}
return richtext;
}
}
}