готовые пдф отчёты

This commit is contained in:
DyCTaTOR 2024-05-29 21:06:39 +04:00
parent 7927b8e1ba
commit 478fbf8b8a
4 changed files with 39 additions and 31 deletions

View File

@ -32,7 +32,7 @@ namespace UniversityBusinessLogic.MailWorker
objMailMessage.Body = info.Text;
objMailMessage.SubjectEncoding = Encoding.UTF8;
objMailMessage.BodyEncoding = Encoding.UTF8;
Attachment attachment = new Attachment($"C:\\Users\\{Environment.UserName}\\Desktop\\Сведения по планам обучения.pdf", new ContentType(MediaTypeNames.Application.Pdf));
Attachment attachment = new Attachment("C:\\ВременныеОтчёты\\Сведения по планам обучения.pdf", new ContentType(MediaTypeNames.Application.Pdf));
objMailMessage.Attachments.Add(attachment);
objSmtpClient.UseDefaultCredentials = false;

View File

@ -19,29 +19,37 @@ namespace UniversityBusinessLogic.OfficePackage
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
/*foreach (var item in info.PlanOfStudyAndStudent)
foreach (var item in info.PlanOfStudyAndStudent)
{
foreach (var studentName in item.StudentName)
{
var rowTexts = new List<string> { item.Id.ToString(), item.PlanOfStudyName, studentName };
if (item.DisciplineName.Any())
{
foreach (var disciplineName in item.DisciplineName)
{
rowTexts.Add(disciplineName);
CreateRow(new PdfRowParameters
{
Texts = new List<string> { item.Id.ToString(), item.PlanOfStudyName, studentName, disciplineName },
Texts = rowTexts,
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
rowTexts.RemoveAt(rowTexts.Count - 1);
}
}
else
{
// Если нет дисциплин, добавляем пустую строку
rowTexts.Add("");
CreateRow(new PdfRowParameters
{
Texts = rowTexts,
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
}
}*/
foreach(var item in info.PlanOfStudyAndStudent)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { item.Id.ToString(), item.PlanOfStudyName },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
SavePdf(info);
}

View File

@ -277,7 +277,7 @@ namespace UniversityClientAppWorker.Controllers
{
APIClient.PostRequest("api/planofstudys/loadreporttoword", new ReportBindingModel
{
FileName = $"C:\\Users\\{Environment.UserName}\\Downloads\\Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.docx"
FileName = "C:\\ВременныеОтчёты\\Планы обучений по дисциплинам.docx"
});
return GetWordFile();
}
@ -286,7 +286,7 @@ namespace UniversityClientAppWorker.Controllers
{
APIClient.PostRequest("api/planofstudys/loadreporttoexcel", new ReportBindingModel
{
FileName = $"C:\\Users\\{Environment.UserName}\\Downloads\\Ïëàíû îáó÷åíèé ïî äèñöèïëèíàì.xlsx"
FileName = "C:\\ВременныеОтчёты\\Планы обучений по дисциплинам.xlsx"
});
return GetExcelFile();
}
@ -313,13 +313,13 @@ namespace UniversityClientAppWorker.Controllers
{
APIClient.PostRequest("api/planofstudys/createreporttopdffile", new ReportBindingModel
{
FileName = "C:\\Users\\{Environment.UserName}\\Desktop\\Ñâåäåíèÿ ïî ïëàíàì îáó÷åíèÿ.pdf"
FileName = "C:\\ВременныеОтчёты\\Сведения по планам обучения.pdf"
});
APIClient.PostRequest("api/order/sendpdftomail", new MailSendInfoBindingModel
APIClient.PostRequest("api/planofstudys/sendpdftomail", new MailSendInfoBindingModel
{
MailAddress = APIClient.User.Email,
Subject = "Îò÷åò",
Text = "Îò÷åò ïî çàêàçàì"
Text = "Сведения по планам обучения"
});
}
Response.Redirect("Index");

View File

@ -11,7 +11,7 @@ namespace UniversityDatabaseImplement
if (optionsBuilder.IsConfigured == false)
{
//Возможно понадобится писать вместо (localdb) название пк, вот пк Егора: DESKTOP-N8BRIPR; other-name: LAPTOP-DYCTATOR; other-name: DyCTaTOR
optionsBuilder.UseSqlServer(@"Data Source=DyCTaTOR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-DYCTATOR\SQLEXPRESS;Initial Catalog=UniversityDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}