Наводим красоту

This commit is contained in:
AnnZhimol 2023-05-19 16:59:42 +04:00
parent b42564d7f7
commit f26446748b
4 changed files with 26 additions and 6 deletions

View File

@ -92,8 +92,6 @@ namespace HotelBusinessLogic.BusinessLogics
OrganiserId = model.OrganiserId, OrganiserId = model.OrganiserId,
}); });
double sum = 0;
foreach (var mealPlan in listMealPlans) foreach (var mealPlan in listMealPlans)
{ {
foreach (var mp in mealPlan.MealPlanMembers.Values) foreach (var mp in mealPlan.MealPlanMembers.Values)

View File

@ -29,9 +29,19 @@ namespace HotelBusinessLogic.OfficePackage
}); });
foreach (var member in info.Members) foreach (var member in info.Members)
{ {
bool IsDate = true;
if (member.StartDate.ToShortDateString() == "01.01.0001")
{
IsDate = false;
}
bool IsCost = true;
if (member.MealPlanPrice.ToString() == "0")
{
IsCost = false;
}
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { member.MemberFIO, member.ConferenceName, member.StartDate.ToShortDateString(), member.MealPlanName, member.MealPlanPrice.ToString() }, Texts = new List<string> { member.MemberFIO, member.ConferenceName, IsDate is true ? member.StartDate.ToShortDateString() : string.Empty, member.MealPlanName, IsCost is true ? member.MealPlanPrice.ToString() : string.Empty },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });

View File

@ -9,7 +9,7 @@ namespace HotelDataBaseImplement
{ {
if (optionsBuilder.IsConfigured == false) if (optionsBuilder.IsConfigured == false)
{ {
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-V0ON61E\SQLEXPRESS;Initial Catalog=HotelDataBaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-VG5USAH\SQLEXPRESS;Initial Catalog=HotelDataBaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
} }
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
} }

View File

@ -11,6 +11,7 @@ using HotelBusinessLogic.BusinessLogics;
using HotelContracts.BusinessLogicsContracts; using HotelContracts.BusinessLogicsContracts;
using System.Linq; using System.Linq;
using DocumentFormat.OpenXml.Wordprocessing; using DocumentFormat.OpenXml.Wordprocessing;
using DocumentFormat.OpenXml.Bibliography;
namespace HotelOrganiserApp.Controllers namespace HotelOrganiserApp.Controllers
{ {
@ -154,6 +155,7 @@ namespace HotelOrganiserApp.Controllers
_logger.LogError(ex, "Ошибка создания отчета"); _logger.LogError(ex, "Ошибка создания отчета");
throw; throw;
} }
double sum = 0; double sum = 0;
string table = ""; string table = "";
table += $"<h2 class=\"u-text u-text-custom-color-1 u-text-default u-text-1\">Предварительный отчет</h2>"; table += $"<h2 class=\"u-text u-text-custom-color-1 u-text-default u-text-1\">Предварительный отчет</h2>";
@ -176,13 +178,23 @@ namespace HotelOrganiserApp.Controllers
table += "</thead>"; table += "</thead>";
foreach (var report in result) foreach (var report in result)
{ {
bool IsDate = true;
if (report.StartDate.ToShortDateString() == "01.01.0001")
{
IsDate = false;
}
bool IsCost = true;
if (report.MealPlanPrice.ToString() == "0")
{
IsCost = false;
}
table += "<tbody class=\"u-table-body\">"; table += "<tbody class=\"u-table-body\">";
table += "<tr style=\"height: 75px\">"; table += "<tr style=\"height: 75px\">";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.MemberFIO}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.MemberFIO}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.ConferenceName}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.ConferenceName}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.StartDate}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{(IsDate is true ? report.StartDate.ToShortDateString() : string.Empty)}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.MealPlanName}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.MealPlanName}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.MealPlanPrice}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{(IsCost is true ? report.MealPlanPrice.ToString(): string.Empty)}</td>";
table += "</tr>"; table += "</tr>";
table += "</tbody>"; table += "</tbody>";
sum+= report.MealPlanPrice; sum+= report.MealPlanPrice;