public String GenerateHTMLReport(CathedraReport report) { var template = GenerateHtmlTemplateWithoutBody(); var body = GenerateBodyForTemplate(report); return(template.Replace("{BODY}", body)); }
private string GetHeaderOfReport(CathedraReport report) { return(ReplaceStringWithParameters(GenerateTemplateForHeadOfReport(), new Dictionary <string, string>() { [YEAR_CONST] = report.Date.Value.Year.ToString(), [CATHEDRA_CONST] = report.User.Cathedra.Name.Replace("Кафедра ", ""), })); }
private string GetPunktEleven(CathedraReport report) { if ((report.ApplicationOnInvention == null || report.ApplicationOnInvention == "") && (report.Patents == null || report.Patents == "")) { return(""); } return(GenerateTemplateForGenericPunktHeader(GetTitleForPunktEleven())); }
public static CathedraReportViewModel ConvertToViewModel(CathedraReport report) { var viewModel = new CathedraReportViewModel() { ID = report.ID, Protocol = report.Protocol, Date = report.Date, AchivementSchool = report.AchivementSchool, AllDescriptionBudgetTheme = report.AllDescriptionBudgetTheme, AllDescriptionHospDohovirTheme = report.AllDescriptionHospDohovirTheme, AllDescriptionThemeInWorkTime = report.AllDescriptionThemeInWorkTime, ApplicationAndPatentsOnInventionBudgetTheme = report.ApplicationAndPatentsOnInventionBudgetTheme, ApplicationAndPatentsOnInventionHospDohovirTheme = report.ApplicationAndPatentsOnInventionHospDohovirTheme, ApplicationAndPatentsOnInventionThemeInWorkTime = report.ApplicationAndPatentsOnInventionThemeInWorkTime, ApplicationOnInvention = report.ApplicationOnInvention, BudgetThemeId = report.BudgetTheme?.ID, ConferencesInUniversity = report.ConferencesInUniversity, CooperationWithAcadamyOfScience = report.CooperationWithAcadamyOfScience, CooperationWithForeignScientificInstitution = report.CooperationWithForeignScientificInstitution, CVBudgetTheme = report.CVBudgetTheme, CVHospDohovirTheme = report.CVHospDohovirTheme, CVThemeInWorkTime = report.CVThemeInWorkTime, DefenseOfCoworkers = report.DefenseOfCoworkers, DefenseOfDoctorantsAndAspirants = report.DefenseOfDoctorantsAndAspirants, DefensesOfCoworkersBudgetTheme = report.DefensesOfCoworkersBudgetTheme, DefensesOfCoworkersHospDohovirTheme = report.DefensesOfCoworkersHospDohovirTheme, DefensesOfCoworkersThemeInWorkTime = report.DefensesOfCoworkersThemeInWorkTime, DefenseWithSpecialPeople = report.DefenseWithSpecialPeople, HospDohovirThemeId = report.HospDohovirTheme?.ID, Materials = report.Materials, OtherBudgetTheme = report.OtherBudgetTheme, OtherFormsOfScientificWork = report.OtherFormsOfScientificWork, OtherHospDohovirTheme = report.OtherHospDohovirTheme, OtherThemeInWorkTime = report.OtherThemeInWorkTime, Patents = report.Patents, PropositionForNewForms = report.PropositionForNewForms, StudentsWorks = report.StudentsWorks, ThemeInWorkTimeId = report.ThemeInWorkTime?.ID }; viewModel.PrintedPublicationBudgetTheme = report.PrintedPublicationBudgetTheme.Select(x => new PublicationOption() { Id = x.ID, Checked = false, Name = x.Name }).ToList(); viewModel.PrintedPublicationHospDohovirTheme = report.PrintedPublicationHospDohovirTheme.Select(x => new PublicationOption() { Id = x.ID, Checked = false, Name = x.Name }).ToList(); viewModel.PrintedPublicationThemeInWorkTime = report.PrintedPublicationThemeInWorkTime.Select(x => new PublicationOption() { Id = x.ID, Checked = false, Name = x.Name }).ToList(); return(viewModel); }
private string GetPunktElevenOne(CathedraReport report) { if ((report.ApplicationOnInvention == null || report.ApplicationOnInvention == "")) { return(""); } return(ReplaceStringWithParameters(GenerateTemplateForGenericPunkt(GetTitleForPunktElevenOne()), new Dictionary <string, string>() { [GENERIC_TEXT_CONST] = report.ApplicationOnInvention })); }
private string GetPunktTwelve(CathedraReport report) { if ((report.Materials == null || report.Materials == "")) { return(""); } return(ReplaceStringWithParameters(GenerateTemplateForGenericPunkt(GetTitleForPunktTwelve()), new Dictionary <string, string>() { [GENERIC_TEXT_CONST] = report.Materials })); }
private string GetPunktThirteen(CathedraReport report) { if ((report.PropositionForNewForms == null || report.PropositionForNewForms == "")) { return(""); } return(ReplaceStringWithParameters(GenerateTemplateForGenericPunkt(GetTitleForPunktThirteen()), new Dictionary <string, string>() { [GENERIC_TEXT_CONST] = report.PropositionForNewForms })); }
private string GetPunktTen(CathedraReport report) { if ((report.ConferencesInUniversity == null || report.ConferencesInUniversity == "")) { return(""); } return(ReplaceStringWithParameters(GenerateTemplateForGenericPunkt(GetTitleForPunktTen()), new Dictionary <string, string>() { [GENERIC_TEXT_CONST] = report.ConferencesInUniversity })); }
private string GetPunktSix(CathedraReport report) { if ((report.CooperationWithAcadamyOfScience == null || report.CooperationWithAcadamyOfScience == "") && (report.CooperationWithForeignScientificInstitution == null || report.CooperationWithForeignScientificInstitution == "")) { return(""); } return(GenerateTemplateForGenericPunktHeader(GetTitleForPunktSix())); }
private ActionResult ChooseOldReport(CathedraReport oldReport, List <Publication> allPublications) { var viewModel = ReportConverter.ConvertToViewModel(oldReport); viewModel.PrintedPublicationBudgetTheme = allPublications .Select(x => { var option = new PublicationOption() { Checked = false, Id = x.ID, Name = x.Name }; if (viewModel.PrintedPublicationBudgetTheme.Any(y => y.Id == x.ID)) { option.Checked = true; } return(option); }) .ToList(); viewModel.PrintedPublicationHospDohovirTheme = allPublications .Select(x => { var option = new PublicationOption() { Checked = false, Id = x.ID, Name = x.Name }; if (viewModel.PrintedPublicationHospDohovirTheme.Any(y => y.Id == x.ID)) { option.Checked = true; } return(option); }) .ToList(); viewModel.PrintedPublicationThemeInWorkTime = allPublications .Select(x => { var option = new PublicationOption() { Checked = false, Id = x.ID, Name = x.Name }; if (viewModel.PrintedPublicationThemeInWorkTime.Any(y => y.Id == x.ID)) { option.Checked = true; } return(option); }) .ToList(); return(View(viewModel)); }
private string GetPunktSixOne(CathedraReport report) { if ((report.CooperationWithAcadamyOfScience == null || report.CooperationWithAcadamyOfScience == "")) { return(""); } return(ReplaceStringWithParameters(GenerateTemplateForGenericPunkt(GetTitleForPunktSixOne()), new Dictionary <string, string>() { [GENERIC_TEXT_CONST] = report.CooperationWithAcadamyOfScience, })); }
private string GetPunktFive(CathedraReport report) { if ((report.OtherFormsOfScientificWork == null || report.OtherFormsOfScientificWork == "")) { return(""); } return(ReplaceStringWithParameters(GenerateTemplateForGenericPunkt(GetTitleForPunktFive()), new Dictionary <string, string>() { [GENERIC_TEXT_CONST] = report.OtherFormsOfScientificWork, })); }
private string GetPunktSixTwo(CathedraReport report) { if ((report.CooperationWithForeignScientificInstitution == null || report.CooperationWithForeignScientificInstitution == "")) { return(""); } return(ReplaceStringWithParameters(GenerateTemplateForGenericPunkt(GetTitleForPunktSixTwo()), new Dictionary <string, string>() { [GENERIC_TEXT_CONST] = report.CooperationWithForeignScientificInstitution, })); }
private string GetPunktNine(CathedraReport report) { if ((report.PrintedPublicationBudgetTheme == null || report.PrintedPublicationBudgetTheme.Count == 0) && (report.PrintedPublicationHospDohovirTheme == null || report.PrintedPublicationHospDohovirTheme.Count == 0) && (report.PrintedPublicationThemeInWorkTime == null || report.PrintedPublicationThemeInWorkTime.Count == 0)) { return(""); } return(GenerateTemplateForGenericPunktHeader(GetTitleForPunktNine())); }
public static CathedraReport ConvertToEntity(CathedraReportViewModel reportViewModel) { var report = new CathedraReport() { Protocol = reportViewModel.Protocol, Date = reportViewModel.Date, AchivementSchool = reportViewModel.AchivementSchool, AllDescriptionBudgetTheme = reportViewModel.AllDescriptionBudgetTheme, AllDescriptionHospDohovirTheme = reportViewModel.AllDescriptionHospDohovirTheme, AllDescriptionThemeInWorkTime = reportViewModel.AllDescriptionThemeInWorkTime, ApplicationAndPatentsOnInventionBudgetTheme = reportViewModel.ApplicationAndPatentsOnInventionBudgetTheme, ApplicationAndPatentsOnInventionHospDohovirTheme = reportViewModel.ApplicationAndPatentsOnInventionHospDohovirTheme, ApplicationAndPatentsOnInventionThemeInWorkTime = reportViewModel.ApplicationAndPatentsOnInventionThemeInWorkTime, ApplicationOnInvention = reportViewModel.ApplicationOnInvention, ConferencesInUniversity = reportViewModel.ConferencesInUniversity, CooperationWithAcadamyOfScience = reportViewModel.CooperationWithAcadamyOfScience, CooperationWithForeignScientificInstitution = reportViewModel.CooperationWithForeignScientificInstitution, CVBudgetTheme = reportViewModel.CVBudgetTheme, CVHospDohovirTheme = reportViewModel.CVHospDohovirTheme, CVThemeInWorkTime = reportViewModel.CVThemeInWorkTime, DefenseOfCoworkers = reportViewModel.DefenseOfCoworkers, DefenseOfDoctorantsAndAspirants = reportViewModel.DefenseOfDoctorantsAndAspirants, DefensesOfCoworkersBudgetTheme = reportViewModel.DefensesOfCoworkersBudgetTheme, DefensesOfCoworkersHospDohovirTheme = reportViewModel.DefensesOfCoworkersHospDohovirTheme, DefensesOfCoworkersThemeInWorkTime = reportViewModel.DefensesOfCoworkersThemeInWorkTime, DefenseWithSpecialPeople = reportViewModel.DefenseWithSpecialPeople, Materials = reportViewModel.Materials, OtherBudgetTheme = reportViewModel.OtherBudgetTheme, OtherFormsOfScientificWork = reportViewModel.OtherFormsOfScientificWork, OtherHospDohovirTheme = reportViewModel.OtherHospDohovirTheme, OtherThemeInWorkTime = reportViewModel.OtherThemeInWorkTime, Patents = reportViewModel.Patents, PropositionForNewForms = reportViewModel.PropositionForNewForms, StudentsWorks = reportViewModel.StudentsWorks, }; return(report); }
private string GetFooter(CathedraReport report) { var lead = db.Users.FirstOrDefault(x => x.Position.ID == 1 && x.Cathedra.Faculty.ID == report.User.Cathedra.Faculty.ID); var cathedraLeadInitials = lead?.I18nUserInitials.FirstOrDefault(); var initials = string.Empty; if (cathedraLeadInitials != null) { initials = cathedraLeadInitials.FirstName?.Substring(0, 1).ToUpper() + ". " + cathedraLeadInitials.FathersName?.Substring(0, 1).ToUpper() + ". " + cathedraLeadInitials.LastName; } var cathedraLeadStatus = lead?.ScienceDegree.Value; return(ReplaceStringWithParameters(GetFooterTemplate(), new Dictionary <string, string>() { [PROTOCOL_CONST] = report.Protocol != null ? report.Protocol : "", [DATE_CONST] = report.Date != null ? report.Date.Value.ToString("dd.MM.yyyy") : "", [FACULTY_CONST] = report.User.Cathedra.Faculty.Name.Replace("Факультет ", "").ToLower(), [FACULTY_LEAD] = initials, [FACULTY_LEAD_STATUS] = cathedraLeadStatus })); }
private String GenerateBodyForTemplate(CathedraReport report) { String body = "<body><div class=\"body\">" + REPORT_HEADER + PUNKT_1 + PUNKT_2 + PUNKT_2_DESCRIPTION + PUNKT_2_CV + PUNKT_2_DEFENSES + PUNKT_2_PUBLICATIONS + PUNKT_2_PATENTS + PUNKT_2_OTHER + PUNKT_3 + PUNKT_3_DESCRIPTION + PUNKT_3_CV + PUNKT_3_DEFENSES + PUNKT_3_PUBLICATIONS + PUNKT_3_PATENTS + PUNKT_3_OTHER + PUNKT_4 + PUNKT_4_DESCRIPTION + PUNKT_4_CV + PUNKT_4_DEFENSES + PUNKT_4_PUBLICATIONS + PUNKT_4_PATENTS + PUNKT_4_OTHER + PUNKT_5 + PUNKT_6 + PUNKT_6_1 + PUNKT_6_2 + PUNKT_8 + PUNKT_9 + PUNKT_9_MONOGRAPHY + PUNKT_9_MONOGRAPHY_TABLE + PUNKT_9_BOOK + PUNKT_9_BOOK_TABLE + PUNKT_9_TRAINING_BOOK + PUNKT_9_TRAINING_BOOK_TABLE + PUNKT_9_OTHER + PUNKT_9_OTHER_TABLE + PUNKT_9_ARTICLES_HEADER + PUNKT_9_ARTICLES_INTERNATIONAL + PUNKT_9_ARTICLES_NATIONAL_FAH + PUNKT_9_ARTICLES_NATIONAL + PUNKT_9_CONFERENCES_HEADER + PUNKT_9_CONFERENCES_INTERNATIONAL + PUNKT_9_CONFERENCES_NATIONAL + PUNKT_10 + PUNKT_11 + PUNKT_11_1 + PUNKT_11_2 + PUNKT_12 + PUNKT_13 + FOOTER + "</div></body>"; var mainHeader = GenerateTemplateForHeadOfReport(); var punktOne = GetPunktOne(report); var punktTwo = GetPunktThemeGeneric(report.BudgetTheme, GetTitleForPunktTwo()); var punktTwoDescr = GetPunktThemeGenericField(report.AllDescriptionBudgetTheme, report.BudgetTheme, GetTitleForPunktTwoDescription()); var punktTwoCV = GetPunktThemeGenericField(report.CVBudgetTheme, report.BudgetTheme, GetTitleForPunktBudgetCV()); var punktTwoDefenses = GetPunktThemeGenericField(report.DefensesOfCoworkersBudgetTheme, report.BudgetTheme, GetTitleForPunktBudgetDefenses()); var punktTwoPublications = GetPunktThemeGenericPublications(report.BudgetTheme, report.PrintedPublicationBudgetTheme, GetTitleForPunktBudgetPublications()); var punktTwoPatents = GetPunktThemeGenericField(report.ApplicationAndPatentsOnInventionBudgetTheme, report.BudgetTheme, GetTitleForPunktBudgetPatents()); var punktTwoOther = GetPunktThemeGenericField(report.OtherBudgetTheme, report.BudgetTheme, GetTitleForPunktBudgetOther()); var punktTree = GetPunktThemeGeneric(report.ThemeInWorkTime, GetTitleForPunktTree()); var punktTreeDescr = GetPunktThemeGenericField(report.AllDescriptionThemeInWorkTime, report.ThemeInWorkTime, GetTitleForPunktTreeDescription()); var punktTreeCV = GetPunktThemeGenericField(report.CVThemeInWorkTime, report.ThemeInWorkTime, GetTitleForPunktInWorkCV()); var punktTreeDefenses = GetPunktThemeGenericField(report.DefensesOfCoworkersThemeInWorkTime, report.ThemeInWorkTime, GetTitleForPunktInWorkDefenses()); var punktTreePublications = GetPunktThemeGenericPublications(report.ThemeInWorkTime, report.PrintedPublicationThemeInWorkTime, GetTitleForPunktInWorkPublications()); var punktTreePatents = GetPunktThemeGenericField(report.ApplicationAndPatentsOnInventionThemeInWorkTime, report.ThemeInWorkTime, GetTitleForPunktInWorkPatents()); var punktTreeOther = GetPunktThemeGenericField(report.OtherThemeInWorkTime, report.ThemeInWorkTime, GetTitleForPunktInWorkOther()); var punktFour = GetPunktThemeGeneric(report.HospDohovirTheme, GetTitleForPunktFour()); var punktFourDescr = GetPunktThemeGenericField(report.AllDescriptionHospDohovirTheme, report.HospDohovirTheme, GetTitleForPunktFourDescription()); var punktFourCV = GetPunktThemeGenericField(report.CVHospDohovirTheme, report.HospDohovirTheme, GetTitleForPunktHospDohovirCV()); var punktFourDefenses = GetPunktThemeGenericField(report.DefensesOfCoworkersHospDohovirTheme, report.HospDohovirTheme, GetTitleForPunktHospDohovirDefenses()); var punktFourPublications = GetPunktThemeGenericPublications(report.HospDohovirTheme, report.PrintedPublicationHospDohovirTheme, GetTitleForPunktHospDohovirPublications()); var punktFourPatents = GetPunktThemeGenericField(report.ApplicationAndPatentsOnInventionHospDohovirTheme, report.HospDohovirTheme, GetTitleForPunktHospDohovirPatents()); var punktFourOther = GetPunktThemeGenericField(report.OtherHospDohovirTheme, report.HospDohovirTheme, GetTitleForPunktHospDohovirOther()); var punktFive = GetPunktFive(report); var punktSix = GetPunktSix(report); var punktSixOne = GetPunktSixOne(report); var punktSixTwo = GetPunktSixTwo(report); var punktEight = GetPunktEight(report); var punktNine = GetPunktNine(report); var distinctPublications = report.PrintedPublicationBudgetTheme .Union(report.PrintedPublicationHospDohovirTheme) .Union(report.PrintedPublicationThemeInWorkTime) .GroupBy(x => x.ID) .Select(x => x.First()) .ToList(); var punktNineMonography = GetPublicationGenericPunktNine("Монографії", PublicationType.Монографія, distinctPublications); var punktNineMonographyTable = GetPublicationTableGeneric(PublicationType.Монографія, distinctPublications); var punktNineBook = GetPublicationGenericPunktNine("Підручники", PublicationType.Підручник, distinctPublications); var punktNineBookTable = GetPublicationTableGeneric(PublicationType.Підручник, distinctPublications); var punktNineTrainingBook = GetPublicationGenericPunktNine("Навчальні посібники", PublicationType.Навчальний_Посібник, distinctPublications); var punktNineTrainingBookTable = GetPublicationTableGeneric(PublicationType.Навчальний_Посібник, distinctPublications); var punktNineOther = GetPublicationGenericPunktNine("Інші наукові видання", PublicationType.Інше_Наукове_Видання, distinctPublications); var punktNineOtherTable = GetPublicationTableGeneric(PublicationType.Інше_Наукове_Видання, distinctPublications); var punktNineArticlesHeader = GetArticlesHeader(distinctPublications); var punktNineArticlesInternational = GetPublicationArticlesOrConferencesTemplate(GetTitleForArticlesInternational(), PublicationType.Стаття_В_Закордонних_Виданнях, distinctPublications); var punktNineArticlesNational = GetPublicationArticlesOrConferencesTemplate(GetTitleForArticlesNational(), PublicationType.Стаття_В_Інших_Виданнях_України, distinctPublications); var punktNineArticlesNationalFah = GetPublicationArticlesOrConferencesTemplate(GetTitleForArticlesNationalFah(), PublicationType.Стаття_В_Фахових_Виданнях_України, distinctPublications); var punktNineConferencesHeader = GetConferencesHeader(distinctPublications); var punktNineConferencesInternational = GetPublicationArticlesOrConferencesTemplate(GetTitleForConferencesInternational(), PublicationType.Тези_Доповіді_На_Міжнародній_Конференції, distinctPublications); var punktNineConferencesNational = GetPublicationArticlesOrConferencesTemplate(GetTitleForConferencesNational(), PublicationType.Тези_Доповіді_На_Вітчизняній_Конференції, distinctPublications); var punktTen = GetPunktTen(report); var punktEleven = GetPunktEleven(report); var punktElevenOne = GetPunktElevenOne(report); var punktElevenTwo = GetPunktElevenTwo(report); var punktTwelve = GetPunktTwelve(report); var punktThirteen = GetPunktThirteen(report); var footer = GetFooter(report); var formetedBody = ReplaceStringWithParameters(body, new Dictionary <string, string>() { [REPORT_HEADER] = GetHeaderOfReport(report), [PUNKT_1] = punktOne, [PUNKT_2] = punktTwo, [PUNKT_2_DESCRIPTION] = punktTwoDescr, [PUNKT_2_CV] = punktTwoCV, [PUNKT_2_DEFENSES] = punktTwoDefenses, [PUNKT_2_PUBLICATIONS] = punktTwoPublications, [PUNKT_2_PATENTS] = punktTwoPatents, [PUNKT_2_OTHER] = punktTwoOther, [PUNKT_3] = punktTree, [PUNKT_3_DESCRIPTION] = punktTreeDescr, [PUNKT_3_CV] = punktTreeCV, [PUNKT_3_DEFENSES] = punktTreeDefenses, [PUNKT_3_PUBLICATIONS] = punktTreePublications, [PUNKT_3_PATENTS] = punktTreePatents, [PUNKT_3_OTHER] = punktTreeOther, [PUNKT_4] = punktFour, [PUNKT_4_DESCRIPTION] = punktFourDescr, [PUNKT_4_CV] = punktFourCV, [PUNKT_4_DEFENSES] = punktFourDefenses, [PUNKT_4_PUBLICATIONS] = punktFourPublications, [PUNKT_4_PATENTS] = punktFourPatents, [PUNKT_4_OTHER] = punktFourOther, [PUNKT_5] = punktFive, [PUNKT_6] = punktSix, [PUNKT_6_1] = punktSixOne, [PUNKT_6_2] = punktSixTwo, [PUNKT_8] = punktEight, [PUNKT_9] = punktNine, [PUNKT_9_MONOGRAPHY] = punktNineMonography, [PUNKT_9_MONOGRAPHY_TABLE] = punktNineMonographyTable, [PUNKT_9_BOOK] = punktNineBook, [PUNKT_9_BOOK_TABLE] = punktNineBookTable, [PUNKT_9_TRAINING_BOOK] = punktNineTrainingBook, [PUNKT_9_TRAINING_BOOK_TABLE] = punktNineTrainingBookTable, [PUNKT_9_OTHER] = punktNineOther, [PUNKT_9_OTHER_TABLE] = punktNineOtherTable, [PUNKT_9_ARTICLES_HEADER] = punktNineArticlesHeader, [PUNKT_9_ARTICLES_INTERNATIONAL] = punktNineArticlesInternational, [PUNKT_9_ARTICLES_NATIONAL_FAH] = punktNineArticlesNationalFah, [PUNKT_9_ARTICLES_NATIONAL] = punktNineArticlesNational, [PUNKT_9_CONFERENCES_HEADER] = punktNineConferencesHeader, [PUNKT_9_CONFERENCES_INTERNATIONAL] = punktNineConferencesInternational, [PUNKT_9_CONFERENCES_NATIONAL] = punktNineConferencesNational, [PUNKT_10] = punktTen, [PUNKT_11] = punktEleven, [PUNKT_11_1] = punktElevenOne, [PUNKT_11_2] = punktElevenTwo, [PUNKT_12] = punktTwelve, [PUNKT_13] = punktThirteen, [FOOTER] = footer, }); return(formetedBody); }