/// <summary> /// 新增附件 /// </summary> /// <param name="attachment"></param> public void AddAttachment(Attachment attachment) { int did = GetDocumentId("Contract"); if (Attachments == null) Attachments = new List<Attachment>(); if (AddAttachments == null) AddAttachments = new List<Attachment>(); attachment.DocumentId = did; int id = -GetMaxNum(); attachment.Id = id; _attachments.Add(attachment); using ( var attachmentService = SvcClientManager.GetSvcClient<AttachmentServiceClient>(SvcType.AttachmentSvc) ) { Attachments= attachmentService.ChangeAttachmentName(_attachments); } AddAttachments.Add(attachment); }
/// <summary> /// 新增附件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button1Click(object sender, RoutedEventArgs e) { var frm = new FileUpload { Header = Properties.Resources.AttachmentUpload }; frm.ShowDialog(); if (!string.IsNullOrWhiteSpace(frm.FileName) && frm.SaveFile) { var attachment = new Attachment { FileName = frm.SavePath, DocumentId = 3 }; VM.AddAttachment(attachment); RefreshAttachment(); } }
/// <summary> /// 新增附件 /// </summary> /// <param name="attachment"></param> public void AddAttachment(Attachment attachment) { int did = GetDocumentId("ProvisionalInvoice"); if (Attachments == null) Attachments = new List<Attachment>(); if (AddAttachments == null) AddAttachments = new List<Attachment>(); attachment.DocumentId = did; int id = -GetMaxNum(); attachment.Id = id; _attachments.Add(attachment); ChangeAttachmentName(_attachments); AddAttachments.Add(attachment); }