public ReportModel(Report report) { _report = report; }
private void ShowInvoiceReportCommandExecuted() { var appPath = (string)ApplicationSettings.Read("DocumentsPath"); var fileName = string.Format("{0}_{1}_{2}", _event.Name, "Invoice", DateTime.Now.ToString("g").Replace(":", "").Replace(@"/", "")); var reportPath = string.Concat(fileName, ".pdf"); var exportPath = string.Concat(appPath, reportPath); // create a pdf file ReportingService.CreateInvoiceReport(Invoice, exportPath); // store report in the database var report = new Report() { ID = Guid.NewGuid(), EventID = _event.Event.ID, Date = DateTime.Now, Name = string.Format("Invoice"), Path = reportPath }; _eventDataUnit.InvoicesRepository.Add(_invoice.InnerInvoice); _eventDataUnit.ReportsRepository.Add(report); _event.Reports.Add(new ReportModel(report)); _event.RefreshReports(); // update Updates table var update = new EventUpdate() { ID = Guid.NewGuid(), EventID = _event.Event.ID, Date = DateTime.Now, UserID = AccessService.Current.User.ID, Message = "Event invoice was created", OldValue = null, NewValue = _invoice.InvoiceNumber.ToString(), ItemId = _invoice.InnerInvoice.ID, ItemType = "EventInvoice", Field = "Invoice", Action = UpdateAction.Added }; // add document var document = new Document() { ID = report.ID, Path = reportPath, Name = string.Format("Invoice for {0}", _event.Name), IsEnabled = true, IsCommon = false }; _eventDataUnit.DocumentsRepository.Add(document); _event.Documents.Add(document); _eventDataUnit.EventUpdatesRepository.Add(update); }
/// <summary> /// Deprecated Method for adding a new object to the Reports EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToReports(Report report) { base.AddObject("Reports", report); }
/// <summary> /// Create a new Report object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="eventID">Initial value of the EventID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="date">Initial value of the Date property.</param> /// <param name="path">Initial value of the Path property.</param> public static Report CreateReport(global::System.Guid id, global::System.Guid eventID, global::System.String name, global::System.DateTime date, global::System.String path) { Report report = new Report(); report.ID = id; report.EventID = eventID; report.Name = name; report.Date = date; report.Path = path; return report; }
private void ShowFunctionSheetCommandExecuted() { var appPath = (string)ApplicationSettings.Read("DocumentsPath"); var eventWasChanged = _event.Event.LastFunctionSheetPrint <= _event.Event.LastEditDate; var lastReport = _event.Reports.Where(x => x.Name == "Function Sheet").OrderByDescending(x => x.Report.Date).FirstOrDefault(); if (!eventWasChanged && lastReport != null) { var oldExportPath = string.Concat(appPath, lastReport.Report.Path); if (File.Exists(oldExportPath)) { Process.Start(oldExportPath); return; } } var fileName = string.Format("{0}_{1}_{2}", _event.Name, "Function Sheet", DateTime.Now.ToString("g").Replace(":", "").Replace(@"/", "")); var reportPath = string.Concat(fileName, ".pdf"); var exportPath = string.Concat(appPath, reportPath); // create a pdf file ReportingService.CreateFunctionSheetReport(_event, exportPath); // store report in the database var report = new Report() { ID = Guid.NewGuid(), EventID = _event.Event.ID, Date = DateTime.Now, Name = string.Format("Function Sheet"), Path = reportPath }; _event.Event.LastFunctionSheetPrint = DateTime.Now; _event.Reports.Insert(0, new ReportModel(report)); _eventDataUnit.ReportsRepository.Add(report); _event.RefreshReports(); // update Updates table var update = new EventUpdate() { ID = Guid.NewGuid(), EventID = _event.Event.ID, Date = DateTime.Now, UserID = AccessService.Current.User.ID, Message = Resources.MESSAGE_FUNCTION_SHEET_WAS_CREATED, OldValue = null, NewValue = report.Name, ItemId = report.ID, ItemType = "EventReport", Field = "FunctionSheetReport", Action = UpdateAction.Added }; _event.EventUpdates.Insert(0, update); _eventDataUnit.EventUpdatesRepository.Add(update); var document = new Document() { ID = report.ID, EventID = _event.Event.ID, Path = reportPath, Name = Path.GetFileNameWithoutExtension(reportPath), IsEnabled = true, IsCommon = false }; _event.Documents.Add(document); _eventDataUnit.DocumentsRepository.Add(document); }