Beispiel #1
0
        protected override void Print()
        {
            string path = Properties.Settings.Default.DocFollowTemplate;

            if (string.IsNullOrEmpty(path))
            {
                string msg = "يجب تحديد مسار تقرير المتابعة";
                Helper.ShowMessage(msg);
                return;
            }
            try
            {
                DocRecord currentDoc = null;
                using (IUnitOfWork unit = new UnitOfWork())
                {
                    currentDoc = unit.DocRecords.GetById(DocId);
                }
                if (currentDoc != null)
                {
                    List <DocFollowsReport> source = new List <DocFollowsReport>();
                    if (currentDoc.DocRecordFollows.Count > 0)
                    {
                        var follows = currentDoc.DocRecordFollows.OrderBy(x => x.FollowDate);
                        foreach (var follow in follows)
                        {
                            DocFollowsReport row = new DocFollowsReport();
                            row.DocId         = currentDoc.Id;
                            row.DocDate       = currentDoc.DocDate;
                            row.Destination   = currentDoc.Destination.Description;
                            row.Subject       = currentDoc.Subject;
                            row.DocStatus     = currentDoc.DocStatus;
                            row.FollowDate    = follow.FollowDate;
                            row.FollowContent = follow.FollowContent;
                            source.Add(row);
                        }
                    }
                    else
                    {
                        DocFollowsReport header = new DocFollowsReport();
                        header.DocId       = currentDoc.Id;
                        header.DocDate     = currentDoc.DocDate;
                        header.Destination = currentDoc.Destination.Description;
                        header.Subject     = currentDoc.Subject;
                        header.DocStatus   = currentDoc.DocStatus;
                        source.Add(header);
                    }

                    ExcelProperties            excelProp = new ExcelProperties(2, 1, false);
                    DocRecordFollowPrintReport report    = new DocRecordFollowPrintReport(source, path, excelProp);
                    report.Print();
                }
            }
            catch (Exception ex)
            {
                Helper.LogShowError(ex);
            }
        }
Beispiel #2
0
        private Task PrintAsync(string path)
        {
            Task task = Task.Run(() => {
                var source = DocRecordReport.ToList();
                ExcelProperties excelProp         = new ExcelProperties(2, 1, false);
                DocRecordFollowPrintReport report = new DocRecordFollowPrintReport(source, path, excelProp);
                report.ReportProgress            += Report_ReportProgress;
                report.Print();
            });

            return(task);
        }