Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e948cc0ce1 | ||
|
|
fc6b5e45e0 |
@@ -33,22 +33,26 @@ public class KasAddressList //Address-Set
|
|||||||
this.owner_id = owner_id;
|
this.owner_id = owner_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> GenerateCSV()
|
public async Task<string> GenerateCSV(bool expAsAdpac)
|
||||||
{
|
{
|
||||||
var customer = Customer.GetCustomerByID(owner_id);
|
var customer = Customer.GetCustomerByID(owner_id);
|
||||||
// using adpac
|
// using adpac
|
||||||
string result = "";
|
string result = "";
|
||||||
string sep = customer.separator + " ";
|
string sep = customer.separator + " ";
|
||||||
if(customer.patch == null)
|
if(customer.patch != null && expAsAdpac)
|
||||||
|
{
|
||||||
|
string header = customer.patch.GetCSVHeader(sep);
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
result = $"refsid{sep} anrede{sep} titel{sep} vorname{sep} adel{sep} name{sep} namezus{sep} anredzus{sep} strasse{sep} strasse2{sep} plz{sep} ort{sep} land{sep} pplz{sep} postfach{sep} name1{sep} name2{sep} name3{sep} name4{sep} name5{sep} funktion{sep} funktion2{sep} abteilung{sep} funktionad{sep} lastupdate\n";
|
result = $"refsid{sep} anrede{sep} titel{sep} vorname{sep} adel{sep} name{sep} namezus{sep} anredzus{sep} strasse{sep} strasse2{sep} plz{sep} ort{sep} land{sep} pplz{sep} postfach{sep} name1{sep} name2{sep} name3{sep} name4{sep} name5{sep} funktion{sep} funktion2{sep} abteilung{sep} funktionad{sep} lastupdate\n";
|
||||||
}
|
}
|
||||||
foreach(var item in KasPersons)
|
foreach(var item in KasPersons)
|
||||||
{
|
{
|
||||||
|
if(customer.patch != null && expAsAdpac) // Fall 1: adpac
|
||||||
if(customer.patch != null) // Fall 1: adpac
|
|
||||||
{
|
{
|
||||||
// Fall 1: adpac
|
// Fall 1: adpac
|
||||||
|
result += item.getAdpacValues(sep,customer.patch) + "\n";
|
||||||
|
|
||||||
} else // Fall 2: kein adpac:
|
} else // Fall 2: kein adpac:
|
||||||
{
|
{
|
||||||
// refsid anrede titel vorname adel name namezus anredzus strasse strasse2 plz ort land pplz postfach name1 name2 name3 name4 name5 funktion funktion2 abteilung funktionad lastupdate
|
// refsid anrede titel vorname adel name namezus anredzus strasse strasse2 plz ort land pplz postfach name1 name2 name3 name4 name5 funktion funktion2 abteilung funktionad lastupdate
|
||||||
@@ -257,6 +261,84 @@ public class KasPerson
|
|||||||
|
|
||||||
return id + " - " + name;
|
return id + " - " + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string getAdpacValues(string sep,AddressPatch ap)
|
||||||
|
{
|
||||||
|
string output = "";
|
||||||
|
if(ap.has_refsid){
|
||||||
|
output += ap.refsid_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_anrede){
|
||||||
|
output += ap.anrede_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_titel){
|
||||||
|
output += ap.titel_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_vorname){
|
||||||
|
output += ap.vorname_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_adel){
|
||||||
|
output += ap.adel_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name){
|
||||||
|
output += ap.name_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_namezus){
|
||||||
|
output += ap.namezus_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_anredzus){
|
||||||
|
output += ap.anredzus_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_strasse){
|
||||||
|
output += ap.strasse_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_strasse2){
|
||||||
|
output += ap.strasse2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_plz){
|
||||||
|
output += ap.plz_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_ort){
|
||||||
|
output += ap.ort_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_land){
|
||||||
|
output += ap.land_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_pplz){
|
||||||
|
output += ap.pplz_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_postfach){
|
||||||
|
output += ap.postfach_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name1){
|
||||||
|
output += ap.name1_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name2){
|
||||||
|
output += ap.name2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name3){
|
||||||
|
output += ap.name3_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name4){
|
||||||
|
output += ap.name4_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name5){
|
||||||
|
output += ap.name5_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_funktion){
|
||||||
|
output += ap.funktion_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_funktion2){
|
||||||
|
output += ap.funktion2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_abteilung){
|
||||||
|
output += ap.abteilung_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_funktionad){
|
||||||
|
output += ap.funktionad_is + sep + " ";
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class KasPersonError
|
public class KasPersonError
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Avalonia.Controls;
|
||||||
using Logof_Client;
|
using Logof_Client;
|
||||||
|
|
||||||
public class AddressPatch
|
public class AddressPatch
|
||||||
@@ -134,4 +135,84 @@ public class AddressPatch
|
|||||||
|
|
||||||
return "Error while parsing";
|
return "Error while parsing";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetCSVHeader(string sep)
|
||||||
|
{
|
||||||
|
string output = "";
|
||||||
|
|
||||||
|
if(has_refsid){
|
||||||
|
output += refsid_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_anrede){
|
||||||
|
output += anrede_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_titel){
|
||||||
|
output += titel_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_vorname){
|
||||||
|
output += vorname_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_adel){
|
||||||
|
output += adel_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name){
|
||||||
|
output += name_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_namezus){
|
||||||
|
output += namezus_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_anredzus){
|
||||||
|
output += anredzus_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_strasse){
|
||||||
|
output += strasse_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_strasse2){
|
||||||
|
output += strasse2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_plz){
|
||||||
|
output += plz_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_ort){
|
||||||
|
output += ort_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_land){
|
||||||
|
output += land_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_pplz){
|
||||||
|
output += pplz_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_postfach){
|
||||||
|
output += postfach_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name1){
|
||||||
|
output += name1_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name2){
|
||||||
|
output += name2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name3){
|
||||||
|
output += name3_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name4){
|
||||||
|
output += name4_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name5){
|
||||||
|
output += name5_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_funktion){
|
||||||
|
output += funktion_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_funktion2){
|
||||||
|
output += funktion2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_abteilung){
|
||||||
|
output += abteilung_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_funktionad){
|
||||||
|
output += funktionad_is + sep + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user