예제 #1
0
        public int DoCreateCoaReport(Sample sample, Identification identification)
        {
            ReportRecord reportRecord = null;

            logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));

            using (SampleDAO dao = new SampleDAO()) {
                reportRecord = dao.CreateCoaReport(sample, identification);
            }
            if (reportRecord.Id.IsNotNull() && reportRecord.Id > 0) {
                using (ClientDAO customerDao = new ClientDAO()) {
                    reportRecord.ParentId = customerDao.GetClientId(reportRecord.ParentId.Value);
                }
                using (ReportDAO reportDao = new ReportDAO()) {
                    ReportNotification reportNotification = new ReportNotification();
                    reportNotification.ReportId = reportRecord.Id.Value;
                    reportNotification.CustomerId = reportRecord.ParentId.Value;
                    reportNotification.DepartmentId = reportRecord.DepartmentId.Value;
                    reportNotification.SubjectLine = reportRecord.SubjectLine;
                    reportDao.SaveNotificationReports(reportDao.GetNotificationRecords(reportNotification));
                }
            }

            return reportRecord.Id.Value;
        }