/// <summary> /// Uploads to sharepoint. /// </summary> /// <param name="fileMemoryStream">The file memory stream.</param> /// <param name="periodString">The period string.</param> /// <param name="reportReceiver">The report receiver.</param> private void UploadToSharepoint(MemoryStream fileMemoryStream, string periodString, ParameterReportReceiver reportReceiver) { SharePointWrapper sharePointWrapper = new SharePointWrapper(this.SharePointUserName, this.SharePointPassword, this.SharePointDomain, this.SharePointURL); using (GenerationDao generationDao = DataAccessFactory.Create<GenerationDao>()) { var newReportQueueGenerationOutput = new ReportGenerationQueueOutputDto(); try { string destinationFolder = this.SharePointURL + this.SharePointURLExtended + reportReceiver.StaffName + "/"; newReportQueueGenerationOutput.SharePointTargetUrl = destinationFolder + periodString + "/" + this.GetFileName(); bool doesUserFolderExist = sharePointWrapper.CheckIfFolderExists(destinationFolder); if (doesUserFolderExist) { sharePointWrapper.AddFile(destinationFolder + periodString + "/", this.ReportParameter.ReportName, fileMemoryStream.GetBuffer()); newReportQueueGenerationOutput.IsUserFolderMissing = false; newReportQueueGenerationOutput.IsSuccessfullyUploaded = true; } else { newReportQueueGenerationOutput.IsUserFolderMissing = true; newReportQueueGenerationOutput.IsSuccessfullyUploaded = false; } } catch (ApplicationException ex) { newReportQueueGenerationOutput.ErrorMessage = "Message:\n" + ex.Message + "\nDetail:\n" + ex.ToString() + "\nStackTrace:\n" + ex.StackTrace; newReportQueueGenerationOutput.IsSuccessfullyUploaded = false; } finally { newReportQueueGenerationOutput.ReportGenerationQueueId = this.ReportParameter.ReportGenerationQueueId; newReportQueueGenerationOutput.ReportReceiverStaffId = reportReceiver.StaffID; this._ReportQueueStatusService.UpdateReportGenerationQueueOutput(newReportQueueGenerationOutput); } } }
private void detach_ParameterReportReceivers(ParameterReportReceiver entity) { this.SendPropertyChanging(); entity.Staff = null; }