internal void FillPreview() { string pre = tbxFilenames.Text; pre = pre.Replace("{KW}", DateTimeTools.GetWeekOfYear(DateTime.Now).ToString()); pre = pre.Replace("{AW}", DateTimeTools.GetActAppWeek(DateTime.Parse(DataManager.LoadBaseData()["beginn"]), DateTime.Now).ToString()); pre = pre.Replace("{WS}", DateTimeTools.getWeekAsDays(DateTimeTools.GetWeekOfYear(DateTime.Now), DateTime.Now.Year)[0].ToShortDateString()); pre = pre.Replace("{WE}", DateTimeTools.getWeekAsDays(DateTimeTools.GetWeekOfYear(DateTime.Now), DateTime.Now.Year)[6].ToShortDateString()); pre = pre.Replace("{VN}", DataManager.LoadBaseData()["vorname"]); pre = pre.Replace("{NN}", DataManager.LoadBaseData()["nachname"]); lblPreview.Text = pre; }
internal static string SaveWeeklyReport(string ausbwoche, string kalwoche, string jahr, string fullname, string beruf, string fachrichtung, Report report, string firmenname, string abteilung, string ausbilder, string pdfdir) { DateTime[] dtss = DateTimeTools.getWeekAsDays(int.Parse(kalwoche), int.Parse(jahr)); string pre = DataManager.LoadSettings()["FileNames"]; pre = pre.Replace("{KW}", kalwoche); pre = pre.Replace("{AW}", ausbwoche); pre = pre.Replace("{WS}", dtss[0].ToShortDateString()); pre = pre.Replace("{WE}", dtss[dtss.Length - 1].ToShortDateString()); pre = pre.Replace("{VN}", DataManager.LoadBaseData()["vorname"]); pre = pre.Replace("{NN}", DataManager.LoadBaseData()["nachname"]); string newFile = pdfdir + @"\" + pre + ".pdf"; if (!File.Exists(newFile)) { Thread thr = new Thread(SendStats.SendDocumentCreated); thr.Start(); } ; PdfReader pdfReader = new PdfReader(Resources.nachweis_woche.ToArray <byte>()); PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(newFile, FileMode.Create)); AcroFields pdfFormFields = pdfStamper.AcroFields; pdfFormFields.SetField("Ausbildungswoche", ausbwoche); pdfFormFields.SetField("LaufendeWoche", kalwoche); pdfFormFields.SetField("WochenstartDatum", DateTimeTools.getWeekAsDays(int.Parse(kalwoche), int.Parse(jahr))[0].ToShortDateString()); pdfFormFields.SetField("WochenendeDatum", DateTimeTools.getWeekAsDays(int.Parse(kalwoche), int.Parse(jahr))[6].ToShortDateString()); pdfFormFields.SetField("Ausbildungsjahr", jahr); pdfFormFields.SetField("AzubiName", fullname); pdfFormFields.SetField("Abteilung", abteilung); pdfFormFields.SetField("Firmenname", firmenname); pdfFormFields.SetField("Ausbilder", ausbilder); pdfFormFields.SetField("Ausbildungsberuf", beruf); pdfFormFields.SetField("Fachrichtung", fachrichtung); pdfFormFields.SetField("Betrieb", getTextofRTF(report.CompanyText)); pdfFormFields.SetField("Unterweisungen", getTextofRTF(report.InstructionsText)); pdfFormFields.SetField("Berufsschule", getTextofRTF(report.SchoolText)); pdfStamper.FormFlattening = true; pdfStamper.Close(); placeWatermark(newFile); return(newFile); }
internal void fillReportedDays() { ReportedWeek[] rws = DataManager.getAllReportedWeeks(); foreach (ReportedWeek rw in rws) { DateTime[] WeekDaysReported = DateTimeTools.getWeekAsDays(rw.Week, rw.Year); foreach (DateTime day in WeekDaysReported) { if (!_daypicker.MarkedDates.ContainsKey(day)) { _daypicker.MarkedDates.Add(day, rw.Delivered ? Color.Blue : Color.Green); } else { _daypicker.MarkedDates[day] = rw.Delivered ? Color.Blue : Color.Green; } } } _daypicker.ColorDates(); }