Пример #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);
            }
        }
Пример #2
0
        private void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGridRow selectedRow = sender as DataGridRow;

            if (selectedRow != null)
            {
                DocFollowsReport follow = selectedRow.Item as DocFollowsReport;
                if (follow != null)
                {
                    DocRecordFollowView view = new DocRecordFollowView(follow.DocId);
                    view.Owner = this;
                    view.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    view.ShowDialog();
                }
            }
        }