using BeWo.Data; using BeWo.Data.Access; using BeWo.Data.Entities; using BeWo.Service.Core; using BeWo.Service.DCEntityMapper; using BeWo.Service.Plugins; using BeWo.Service.ServiceUtils; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.Extensions; using BS.Shared.Services; 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[] PrepareHeaderArrayForCustomerExport() { string[] lHeaderCaption = { "Nachname", // 0 "Vorname", // 1 "Geburtsdatum", // 3 "Beruf", // 4 "Geschlecht", // 5 "Familienstand", // 6 "Telefon", // 7 "Mobil", // 8 "Mail", // 9 "Fax", // 10 "Strasse", // 11 "PLZ", // 12 "Ort", // 13 "Bemerkung", // 14 "Erstbetreuung", // 15 "Betreuung begonnen", // 16 "Betreuung beendet", // 17 "Grund für Beendigung" // 18 }; return lHeaderCaption; } public virtual string[][] PrepareContentArrayForCustomerExport(long[] pSortedOids) { var lCustomers = DAOFactory.GenericDAO.LoadByIDs(pSortedOids); var lHeaderCaption = PrepareHeaderArrayForCustomerExport(); var lContent = new string[lCustomers.Count][]; for (int iRowCount = 0; iRowCount < lCustomers.Count; iRowCount++) { lContent[iRowCount] = new string[lHeaderCaption.Count()]; lContent[iRowCount][0] = lCustomers[iRowCount].Person.LastName; lContent[iRowCount][1] = lCustomers[iRowCount].Person.FirstName; //lContent[iRowCount][2] = lCustomers[iRowCount].ReferenceNumber; if (lCustomers[iRowCount].Person.DateOfBirth.HasValue) { lContent[iRowCount][2] = lCustomers[iRowCount].Person.DateOfBirth.Value.ToShortDateString(); } lContent[iRowCount][3] = lCustomers[iRowCount].Person.Profession; lContent[iRowCount][4] = lCustomers[iRowCount].Person.Sex == Sex.Male ? "männlich" : "weiblich"; if (lCustomers[iRowCount].Person.FamilyStatus != null) { switch (lCustomers[iRowCount].Person.FamilyStatus.Value) { case FamilyStatus.Divorced: lContent[iRowCount][5] = "geschieden"; break; case FamilyStatus.Married: lContent[iRowCount][5] = "verheiratet"; break; case FamilyStatus.Single: lContent[iRowCount][5] = "ledig"; break; case FamilyStatus.Widowed: lContent[iRowCount][5] = "verwitwet"; break; case FamilyStatus.Partner: lContent[iRowCount][5] = "in Partnerschaft"; break; case FamilyStatus.PartnerDivorced: lContent[iRowCount][5] = "getrennt lebend"; break; case FamilyStatus.PartnerDead: lContent[iRowCount][5] = "partnerhinterblieben"; break; case FamilyStatus.PartnerMarried: lContent[iRowCount][5] = "verpartnert"; break; case FamilyStatus.Entpartnert: lContent[iRowCount][5] = "entpartnert"; break; } } foreach (var iContact in lCustomers[iRowCount].Person.Contacts) { switch (iContact.Type) { case ContactType.business_Phone: lContent[iRowCount][6] = iContact.Value; break; case ContactType.business_MobilePhone: lContent[iRowCount][7] = iContact.Value; break; case ContactType.business_Mail: lContent[iRowCount][8] = iContact.Value; break; case ContactType.business_Fax: lContent[iRowCount][9] = iContact.Value; break; } } if (lCustomers[iRowCount].Person.Address != null) { lContent[iRowCount][10] = lCustomers[iRowCount].Person.Address.Street; lContent[iRowCount][11] = lCustomers[iRowCount].Person.Address.PostalCode; lContent[iRowCount][12] = lCustomers[iRowCount].Person.Address.Town; } lContent[iRowCount][13] = lCustomers[iRowCount].Notice; if (lCustomers[iRowCount].Employee2CustomerList == null) continue; foreach (var e2c in lCustomers[iRowCount].Employee2CustomerList) { foreach (var vle in e2c.ValueList.Select(vle2o => vle2o.Entry).Where(vle => vle.SystemEntryID != null && vle.SystemEntryID.Value == SystemEntryID.EmployeeRoleMainAttendant)) { lHeaderCaption[14] = vle.Value; lContent[iRowCount][14] = e2c.Employee.Person.FirstName + " " + e2c.Employee.Person.LastName; } } lContent[iRowCount][15] = String.Format("{0:dd.MM.yyyy}", lCustomers[iRowCount].AssistanceBegin); lContent[iRowCount][16] = String.Format("{0:dd.MM.yyyy}", lCustomers[iRowCount].TerminationDate); if (lCustomers[iRowCount].TerminationReason != null) { lContent[iRowCount][17] = lCustomers[iRowCount].TerminationReason.Value; } else { lContent[iRowCount][17] = ""; } } return lContent; } public virtual string[] PrepareHeaderArrayForSupportConceptExport() { return new string[] { "Nachname", // 0 "Vorname", // 1 "Aktenzeichen", // 5 = 2 Translator.Translate("Kostenträger"), // 4 = 3 Translator.Translate("Hilfeplan beantragt am"), // = 4 Translator.Translate("Hilfeplan eingereicht am"), // = 5 Translator.Translate("Hilfeplankonferenz"), // 3 = 6 Translator.Translate("Bewilligung eingetroffen am"), // = 7 "Verlängerung beantragt am", // 10 = 8 "beantragt von", // 6 = 9 "beantragt bis", // 7 = 10 "bewilligt von", // 8 = 11 "bewilligt bis", // 9 = 12 Translator.Translate("gen. FLS/Woche"), // 11 = 13 Translator.Translate("gen. FLS Gesamt"), // 12 = 14 "Stundensatz", // 13 = 15 Translator.Translate("Kostenträger Notiz"), // 14 = 16 "BetreuerIn", // 15 = 17 "Betreuung beendet am", // 16 = 18 "Kommentar", // 2 = 19 }; } public virtual string[][] PrepareContentArrayForSupportConceptExport(long[] pSortedOids) { var lHeaderCaption = PrepareHeaderArrayForSupportConceptExport(); List lContent = new List(); var lSupportConcepts = DAOFactory.GenericDAO.LoadByIDs(pSortedOids); int lContentIndex = 0; for (int iRowCount = 0; iRowCount < lSupportConcepts.Count; iRowCount++) { lContent.Add(new string[lHeaderCaption.Count()]); AddSupportConceptData(lContent[lContentIndex], lSupportConcepts[iRowCount]); int cbCount = 0; foreach (var iCostBearer in lSupportConcepts[iRowCount].CostBearer2SupportConceptList) { if (cbCount++ > 0) { lContent.Add(new string[lHeaderCaption.Count()]); lContentIndex++; } AddSupportConceptData(lContent[lContentIndex], lSupportConcepts[iRowCount]); lContent[lContentIndex][2] = iCostBearer.CustomerReferenceNumber; if (iCostBearer.CostBearer != null && iCostBearer.CostBearer.Organisation != null) { lContent[lContentIndex][3] = iCostBearer.CostBearer.Organisation.Name; var calc = PluginLoader.FindClass(iCostBearer.CostBearer.ID) ?? Calculations.GetInstance(iCostBearer.CostBearer.ID); SupportConceptCostBearerRelDC relDC = MapperFactory.SupportConceptCostBearerRelDC_CostBearer2SupportConcept.MapToNewDC(iCostBearer); DateTime dt = DateTime.Now; DateTime end = DateTime.MaxValue; if (iCostBearer.ApprovedEndDate.HasValue) end = iCostBearer.ApprovedEndDate.Value; else if (iCostBearer.RequestedEndDate.HasValue) end = iCostBearer.RequestedEndDate.Value; if (dt > end) dt = end; if (relDC.ApprovalPeriodList.Count == 1) { var ap = relDC.ApprovalPeriodList[0]; if (ap.ApprovedBEPerInterval.HasValue && ap.ApprovedBEInterval.HasValue && ap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Weekly) { var serviceUnit = relDC.CostBearer.CostRatePeriods.GetCostRatePeriodForDate(CostRatePeriodType.MinutesPerServiceUnit, DateTime.Now); if (serviceUnit != null) lContent[lContentIndex][13] = String.Format("{0:0.##}", serviceUnit.GetBEInHours(ap.ApprovedBEPerInterval)); } } else { lContent[lContentIndex][13] = String.Format("{0:0.##}", calc.GetApprovedHoursPerWeek(relDC, dt, false)); // iCostBearer.ApprovedFLS.ToStringNullCheck(); } lContent[lContentIndex][14] = String.Format("{0:0.##}", calc.GetApprovedHoursTotal(relDC, false)); //iCostBearer.ApprovedFLSTotal.ToStringNullCheck(); } else { lContent[lContentIndex][3] = string.Empty; } lContent[lContentIndex][9] = iCostBearer.RequestedStartDate.DoIfNotNull(d => d.ToShortDateString()); lContent[lContentIndex][10] = iCostBearer.RequestedEndDate.DoIfNotNull(d => d.ToShortDateString()); lContent[lContentIndex][11] = iCostBearer.ApprovedStartDate.DoIfNotNull(d => d.ToShortDateString()); lContent[lContentIndex][12] = iCostBearer.ApprovedEndDate.DoIfNotNull(d => d.ToShortDateString()); if (iCostBearer.CostBearer != null) { lContent[lContentIndex][15] = iCostBearer.CostBearer.CostRatePeriods.MapToNewDCs() .GetCurrentlyValidRateValue(CostRatePeriodType.HourlyRate).ToStringNullCheck(); } lContent[lContentIndex][16] = iCostBearer.Notice; String mainAttendant = ""; foreach (Employee2Customer e2c in lSupportConcepts[iRowCount].Customer.Employee2CustomerList) { foreach (ValueListEntry2Object vle2o in e2c.ValueList) { ValueListEntry vle = vle2o.Entry; if (vle.SystemEntryID != null && vle.SystemEntryID.Value == SystemEntryID.EmployeeRoleMainAttendant) { string empName = e2c.Employee.Person.FirstName + " " + e2c.Employee.Person.LastName; if (String.IsNullOrEmpty(mainAttendant)) mainAttendant = empName; else { if (!mainAttendant.Contains(empName)) { mainAttendant += ", " + empName; } } } } } lContent[lContentIndex][17] = mainAttendant; } // if (iRowCount < lSupportConcepts.Count - 1) // { // //next Row // lContentIndex++; lContent.Add(new string[lHeaderCaption.Count()]); // } lContentIndex++; } return lContent.ToArray(); } private void AddSupportConceptData(string[] content, SupportConcept sc) { content[0] = sc.Customer.Person.LastName; content[1] = sc.Customer.Person.FirstName; content[4] = sc.RequisitionSendDate != null ? sc.RequisitionSendDate.Value.ToShortDateString() : string.Empty; content[5] = sc.SupportConceptSendDate != null ? sc.SupportConceptSendDate.Value.ToShortDateString() : string.Empty; content[6] = sc.ConferenceDate != null ? sc.ConferenceDate.Value.ToShortDateString() : string.Empty; content[7] = sc.ApprovalDate != null ? sc.ApprovalDate.Value.ToShortDateString() : string.Empty; content[8] = sc.RenewalSendDate != null ? sc.RenewalSendDate.Value.ToShortDateString() : string.Empty; if (sc.Customer.TerminationDate.HasValue) { content[18] = String.Format("{0:dd.MM.yyyy}", sc.Customer.TerminationDate); } else { content[18] = ""; } content[19] = sc.Notice; } public virtual string[] PrepareHeaderArrayForPersonExport() { return new string[] { "Titel", // 0 "Nachname", // 1 "Vorname", // 2 "Funktion", // 3 "Geburtsdatum", // 4 "Strasse", // 5 "PLZ", // 6 "Ort", // 7 "Telefon", // 8 "Mobil", // 9 "Mail", // 10 "Fax", // 11 "Organisationen", // 12 "Bemerkung" // 13 }; } public virtual string[][] PrepareContentArrayForPersonExport(long[] pSortedOids) { var lPersons = DAOFactory.GenericDAO.LoadByIDs(pSortedOids); string[][] lContent = new string[lPersons.Count][]; for (int iRowCount = 0; iRowCount < lPersons.Count; iRowCount++) { lContent[iRowCount] = new string[PrepareHeaderArrayForPersonExport().Count()]; if (lPersons[iRowCount].Title != null) { lContent[iRowCount][0] = lPersons[iRowCount].Title.Value; } else { lContent[iRowCount][0] = string.Empty; } lContent[iRowCount][1] = lPersons[iRowCount].LastName; lContent[iRowCount][2] = lPersons[iRowCount].FirstName; if (lPersons[iRowCount].Function != null) { lContent[iRowCount][3] = lPersons[iRowCount].Function.Value; } else { lContent[iRowCount][3] = string.Empty; } lContent[iRowCount][4] = lPersons[iRowCount].DateOfBirth.DoIfNotNull(d => d.ToShortDateString()); // lContent[iRowCount][4] = lPersons[iRowCount].Sex == Sex.Male ? "männlich" : "weiblich"; if (lPersons[iRowCount].Address != null) { lContent[iRowCount][5] = lPersons[iRowCount].Address.Street; lContent[iRowCount][6] = lPersons[iRowCount].Address.PostalCode; lContent[iRowCount][7] = lPersons[iRowCount].Address.Town; } foreach (var iContact in lPersons[iRowCount].Contacts) { switch (iContact.Type) { case ContactType.private_Phone: lContent[iRowCount][8] = iContact.Value; break; case ContactType.private_MobilePhone: lContent[iRowCount][9] = iContact.Value; break; case ContactType.private_Mail: lContent[iRowCount][10] = iContact.Value; break; case ContactType.private_Fax: lContent[iRowCount][11] = iContact.Value; break; } } string orgas = ""; if (lPersons[iRowCount].Organisation2Persons != null) { foreach (var orga in lPersons[iRowCount].Organisation2Persons) { if (orga.Organisation != null && !orga.Organisation.Name.IsNullOrEmpty()) { if (lPersons[iRowCount].Organisation2Persons.Last() == orga) orgas += orga.Organisation.Name; else orgas += orga.Organisation.Name + ", "; } } } lContent[iRowCount][12] = orgas; lContent[iRowCount][13] = lPersons[iRowCount].Notice; } return lContent; } public virtual string[] PrepareHeaderArrayForUserExport() { return new string[]{ "Mitarbeiter", "Login", "zugeordnete Benutzergruppen" }; } public virtual string[][] PrepareContentArrayForUserExport(long[] pSortedOids) { var lUser = DAOFactory.GenericDAO.LoadByIDs(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(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; } public virtual string[] PrepareHeaderArrayForEmployeeExport() { bool darfVertragSehen = true; int arrayCount = 37; string[] lHeaderCaption; if (!Utils.UserHasRight(GetLoggedInUser(), UserRightType.Employee_AllowEditContracts)) { arrayCount = 26; darfVertragSehen = false; } if (darfVertragSehen) { lHeaderCaption = new string[37] { "Nachname", // 0 "Vorname", // 1 "Personalnummer", // 2 "Geburtsdatum", // 3 "Beruf", // 4 "Geschlecht", // 5 "Familienstand", // 6 "Krankenkasse", // 7 "Steuernummer", // 8 "beschäftigt als", // 9 "Probezeit (Tage)", // 10 "Kündigungsfrist (Tage)", // 11 "Urlaubstage", // 12 "FLS/Woche", // 13 "Gesamtstunden/Woche", // 14 "Arbeitstage pro Woche", // 15 "Eintrittsdatum", // 16 "Enddatum", // 17 "Versicherungsnummer", "Stundensatz", "Telefon", "Mobil", // 21 "Mail", "private Mail", "Fax", "Strasse", "PLZ", // 26 "Ort", // 27 "Kontonummer", "Bankleitzahl", "Bank", "BIC", // 31 "IBAN", "Bemerkung", // 33 "Fachkraft", "Qualifikation", "Arbeitsschwerpunkte", }; } else { lHeaderCaption = new string[25] { "Nachname", // 0 "Vorname", // 1 "Personalnummer", // 2 "Geburtsdatum", // 3 "Beruf", // 4 "Geschlecht", // 5 "Familienstand", // 6 "Krankenkasse", // 7 "Steuernummer", // 8 "Telefon", "Mobil", // 20 "Mail", "private Mail", "Fax", "Strasse", "PLZ", // 25 "Ort", // 26 "Kontonummer", "Bankleitzahl", "Bank", "BIC", // 30 "IBAN", "Fachkraft", "Qualifikation", "Arbeitsschwerpunkte", }; } return lHeaderCaption; } public virtual string[][] PrepareContentArrayForEmployeeExport(long[] pSortedOids) { bool darfVertragSehen = true; string[] lHeaderCaption; if (!Utils.UserHasRight(GetLoggedInUser(), UserRightType.Employee_AllowEditContracts)) { darfVertragSehen = false; } var lEmployees = DAOFactory.GenericDAO.LoadByIDs(pSortedOids); string[][] lContent = new string[lEmployees.Count][]; for (int iRowCount = 0; iRowCount < lEmployees.Count; iRowCount++) { lContent[iRowCount] = new string[PrepareHeaderArrayForEmployeeExport().Count()]; lContent[iRowCount][0] = lEmployees[iRowCount].Person.LastName; lContent[iRowCount][1] = lEmployees[iRowCount].Person.FirstName; lContent[iRowCount][2] = lEmployees[iRowCount].PersonnelNumber; lContent[iRowCount][3] = lEmployees[iRowCount].Person.DateOfBirth.DoIfNotNull(d => d.ToShortDateString()); lContent[iRowCount][4] = lEmployees[iRowCount].Person.Profession; lContent[iRowCount][5] = lEmployees[iRowCount].Person.Sex == Sex.Male ? "männlich" : "weiblich"; if (lEmployees[iRowCount].Person.FamilyStatus != null) { switch (lEmployees[iRowCount].Person.FamilyStatus.Value) { case FamilyStatus.Divorced: lContent[iRowCount][6] = "geschieden"; break; case FamilyStatus.Married: lContent[iRowCount][6] = "verheiratet"; break; case FamilyStatus.Single: lContent[iRowCount][6] = "ledig"; break; case FamilyStatus.Widowed: lContent[iRowCount][6] = "verwitwet"; break; case FamilyStatus.Partner: lContent[iRowCount][6] = "in Partnerschaft"; break; case FamilyStatus.PartnerDivorced: lContent[iRowCount][6] = "getrennt lebend"; break; case FamilyStatus.PartnerDead: lContent[iRowCount][5] = "partnerhinterblieben"; break; case FamilyStatus.PartnerMarried: lContent[iRowCount][5] = "verpartnert"; break; case FamilyStatus.Entpartnert: lContent[iRowCount][5] = "entpartnert"; break; } } lContent[iRowCount][7] = lEmployees[iRowCount].HealthInsurance; lContent[iRowCount][8] = lEmployees[iRowCount].TaxNumber; if (darfVertragSehen) { if (lEmployees[iRowCount].Person.LastName.StartsWith("Ber")) { int test = 0; } Contract lastContract = lEmployees[iRowCount].LastContract; if (lastContract != null) { if (lastContract.EmploymentType != null) { lContent[iRowCount][9] = lastContract.EmploymentType.Name; } lContent[iRowCount][10] = lastContract.ProbationPeriod.ToString(); lContent[iRowCount][11] = lastContract.CancellationPeriod.ToString(); decimal? urlaubstage = null; if (lastContract.EmploymentType != null && lastContract.EmploymentType.LeaveDays.HasValue) { urlaubstage = lastContract.EmploymentType.LeaveDays; } else { urlaubstage = lastContract.LeaveDays; } if (urlaubstage.HasValue) { lContent[iRowCount][12] = urlaubstage.Value.ToStringNullCheck(); } if (lastContract.WeeklyFLS.HasValue) { lContent[iRowCount][13] = lastContract.WeeklyFLS.Value.ToStringNullCheck(); } if (lastContract.WeeklyTotalHours.HasValue) { lContent[iRowCount][14] = lastContract.WeeklyTotalHours.Value.ToStringNullCheck(); } var wd = lastContract.WeeklyDays ?? 5; if (wd == 0) wd = 5; lContent[iRowCount][15] = String.Format("{0}", wd); if (!lastContract.ContractEndDate.HasValue) { lContent[iRowCount][17] = "unbefristet"; } else { lContent[iRowCount][17] = lastContract.ContractEndDate.DoIfNotNull(d => d.ToShortDateString()); } } var firstContract = lEmployees[iRowCount].FirstContract; if (firstContract != null) { lContent[iRowCount][16] = firstContract.EntryDate.DoIfNotNull(d => d.ToShortDateString()); } lContent[iRowCount][18] = lEmployees[iRowCount].InsuranceNumber; if (lastContract != null) { if (lastContract.HourlyRate.HasValue) { lContent[iRowCount][19] = lastContract.HourlyRate.Value.ToStringNullCheck(); } lContent[iRowCount][33] = lastContract.Notice; } } int index = 9; if (darfVertragSehen) { index = 20; } foreach (var iContact in lEmployees[iRowCount].Person.Contacts) { switch (iContact.Type) { case ContactType.business_Phone: lContent[iRowCount][index] = iContact.Value; break; case ContactType.business_MobilePhone: lContent[iRowCount][index + 1] = iContact.Value; break; case ContactType.business_Mail: lContent[iRowCount][index + 2] = iContact.Value; break; case ContactType.private_Mail: lContent[iRowCount][index + 3] = iContact.Value; break; case ContactType.business_Fax: lContent[iRowCount][index + 4] = iContact.Value; break; } } if (lEmployees[iRowCount].Person.Address != null) { lContent[iRowCount][index + 5] = lEmployees[iRowCount].Person.Address.Street; lContent[iRowCount][index + 6] = lEmployees[iRowCount].Person.Address.PostalCode; lContent[iRowCount][index + 7] = lEmployees[iRowCount].Person.Address.Town; } if (lEmployees[iRowCount].Person.BankAccount != null) { lContent[iRowCount][index + 8] = lEmployees[iRowCount].Person.BankAccount.AccountNumber; lContent[iRowCount][index + 9] = lEmployees[iRowCount].Person.BankAccount.BankCode; lContent[iRowCount][index + 10] = lEmployees[iRowCount].Person.BankAccount.BankName; lContent[iRowCount][index + 11] = lEmployees[iRowCount].Person.BankAccount.Bic; lContent[iRowCount][index + 12] = lEmployees[iRowCount].Person.BankAccount.IBAN; } if (darfVertragSehen) { index += 1; } if (lEmployees[iRowCount].IsQualified.HasValue) { lContent[iRowCount][index + 13] = lEmployees[iRowCount].IsQualified.Value ? "Ja" : "Nein"; } var qualis = lEmployees[iRowCount].ValueList.FindByType(ValueListEntryType.StaffQualificationsType) .Select(e2o => e2o.Entry); if (qualis != null && qualis.Count() > 0) { StringBuilder sb = new StringBuilder(); foreach (var entry in qualis) { if (sb.Length > 0) { sb.Append(", "); } sb.Append(entry.Value); } lContent[iRowCount][index + 14] = sb.ToString(); } var focuses = lEmployees[iRowCount].ValueList.FindByType(ValueListEntryType.StaffActivityFocusType) .Select(e2o => e2o.Entry); if (focuses != null && focuses.Count() > 0) { StringBuilder sb = new StringBuilder(); foreach (var entry in focuses) { if (sb.Length > 0) { sb.Append(", "); } sb.Append(entry.Value); } lContent[iRowCount][index + 15] = sb.ToString(); } } return lContent; } public static ApplicationUser GetLoggedInUser() { ApplicationUser loggedInUser; if (LoggedInUserOperationContextExt.Current != null && LoggedInUserOperationContextExt.Current.User != null) { loggedInUser = LoggedInUserOperationContextExt.Current.User; } else { loggedInUser = SessionFacade.LoggedInUser; } return loggedInUser; } } }