Exemple #1
0
        public async Task<string> GetStatementAsync(string path, int id)
        {
            if (!string.IsNullOrEmpty(path))
            {
                var cadet = await _context.Cadets.GetAsync(id);
                if (cadet != null)
                {
                    string templatePath = path + "Заявление.docx";
                    if (!Directory.Exists(path + "/CadetFiles/" + id))
                    {
                        Directory.CreateDirectory(path + "/CadetFiles/" + id);
                    }
                    else
                    {
                        if (File.Exists(path + "/CadetFiles/" + id + "/Заявление.pdf"))
                        {
                            return path + "/CadetFiles/" + id + "/Заявление.pdf";
                        }
                    }

                    string saveAsPath = path + "/CadetFiles/" + id + "/Заявление.pdf";

                    StatementReport report = new StatementReport(templatePath, saveAsPath)
                    {
                        FIO = cadet.Initials,
                        BirthDay = cadet.BirthDay,
                        BirthPlace = cadet.BirthPlace,
                        Education = cadet.Education,
                        EnrollmentDate = (DateTime)cadet.EnrollmentDate,
                        Job = cadet.Job,
                        JobPosition = cadet.JobPosition,
                        LastName = cadet.LastName,
                        MedicalDate = cadet.MedicalDate,
                        MedicalName = cadet.MedicalName,
                        MedicalNumber = cadet.MedicalNumber,
                        MiddleName = cadet.MiddleName,
                        Name = cadet.Name,
                        Nationality = cadet.Nationality,
                        PassportIssueBy = cadet.PassportIssueBy,
                        PassportIssueDate = cadet.PassportIssueDate,
                        PassportNumber = cadet.PassportNumber,
                        PhoneHome = cadet.PhoneHome,
                        PhoneMobile = cadet.PhoneMobile,
                        Program = cadet.TrainingProgram.Program,
                        Registration = cadet.Registration,
                    };
                    return report.GetReport();
                }
            }
            return null;
        }
Exemple #2
0
 public static void ReportOne()
 {
     StatementReport obj = new StatementReport(@"D:/ЗаявлениеНаОбучение.docx", @"D:/new1.pdf")
     {
         BirthDay = new DateTime(1994, 2, 6),
         BirthPlace = "г. Климовичи",
         Education = "Высшее",
         EnrollmentDate = DateTime.Now,
         FIO = "Николайченко И. В.",
         Job = "БРУ",
         JobPosition = "Студент",
         LastName = "Николайченко",
         MedicalDate = new DateTime(2015, 10, 12),
         MedicalName = "Климовичская ЦРБ",
         MedicalNumber = 2345,
         MiddleName = "Владимирович",
         Name = "Иван",
         Nationality = "Белорус",
         PassportIssueBy = "Климовичский РОВД",
         PassportIssueDate = new DateTime(2009, 3, 5),
         PassportNumber = "КВ1653568",
         PhoneHome = "8044812562",
         PhoneMobile = "+375448965230",
         Program = "Категория C",
         Registration = "Могилёв, Космонавтов 11",
     };
     Console.WriteLine(obj.GetReport());
 }