private void button6_Click(object sender, RoutedEventArgs e) { documentService.DocumentServiceClient cli = new documentService.DocumentServiceClient(); EmplFiles f = cli.addDocument(1, 1); MessageBox.Show(f.Progressive.ToString()); }
// Wenn durch die Aktivität ein Wert zurückgegeben wird, erfolgt eine Ableitung von CodeActivity<TResult> // und der Wert von der Ausführmethode zurückgegeben. protected override void Execute(CodeActivityContext context) { int eId = employeeId.Get(context); int dId = documentId.Get(context); HRONEntities dbContext = new HRONEntities(); Employee empl = dbContext.Employee.Where(e => e.emplID == eId).First(); EmplDocumentation doc = empl.EmplDocumentation.Where(d => d.documentationID == dId).First(); if (doc != null) { byte[] bDoc = doc.baDocumentation.documentationDocument; string nDoc = doc.baDocumentation.documentationDocumentName; if (nDoc.EndsWith(".dotx") || nDoc.EndsWith(".dot")) { convertDocument(empl, ref bDoc, ref nDoc); } EmplFiles fil = new EmplFiles(); fil.EmplDocumentation = doc; fil.Employee = empl; fil.FileContent = bDoc; fil.FileName = nDoc; doc.EmplFiles.Add(fil); dbContext.SaveChanges(); emplFiles.Set(context, fil.UnProxy <EmplFiles>(dbContext)); cleanup(); } }
private void emplFilesListView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var item = (sender as ListView).SelectedItem; if (item != null && item is EmplFiles) { EmplFiles em = (EmplFiles)item; string fileName = moveFile(em); Process prc = new Process(); prc.StartInfo.FileName = fileName; prc.Start(); } }
private static string moveFile(EmplFiles em) { string basePath = System.IO.Path.GetTempPath() + "\\HR"; if (!Directory.Exists(basePath)) { Directory.CreateDirectory(basePath); } string fileName = basePath + "\\" + Guid.NewGuid(); Directory.CreateDirectory(fileName); fileName = fileName + "\\" + em.FileName; File.WriteAllBytes(fileName, em.FileContent); return(fileName); }
private void PackIcon_PreviewMouseMove(object sender, MouseEventArgs e) { MaterialDesignThemes.Wpf.PackIcon pi = (MaterialDesignThemes.Wpf.PackIcon)sender; if (e.LeftButton == MouseButtonState.Pressed) { if (emplFilesListView.SelectedItem != null && emplFilesListView.SelectedItem is EmplFiles) { EmplFiles ef = (EmplFiles)emplFilesListView.SelectedItem; string file = moveFile(ef); string[] array = { file }; var data = new DataObject(DataFormats.FileDrop, array); DragDrop.DoDragDrop(pi, data, DragDropEffects.Move); e.Handled = true; } } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { // Laden Sie Ihre Daten nicht zur Entwurfszeit. // if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) // { // //Laden Sie hier Ihre Daten, und weisen Sie das Ergebnis der CollectionViewSource zu. // System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["Resource Key for CollectionViewSource"]; // myCollectionViewSource.Source = your data // } if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { System.Windows.Data.CollectionViewSource employeeViewSource = (System.Windows.Data.CollectionViewSource) this.Resources["employeeViewSource"]; entities.Employee.Where(m => m.emplID == employee.emplID).Load(); employeeViewSource.Source = entities.Employee.Local; employeeViewSource.View.MoveCurrentToFirst(); foreach (baseEntity ent in filters) { if (ent is EmplDocumentation) { EmplDocumentation doc = (EmplDocumentation)ent; System.Windows.Data.CollectionViewSource employeeEmplFilesViewSourceViewSource = (System.Windows.Data.CollectionViewSource) this.Resources["employeeEmplFilesViewSource"]; if (employeeEmplFilesViewSourceViewSource != null) { employeeEmplFilesViewSourceViewSource.View.Filter = item => { EmplFiles f = (EmplFiles)item; if (f.EmplDocumentation == null) { return(false); } return(f.EmplDocumentation.Equals(doc)); }; } } } } }
public void loadFiles(string[] files) { foreach (string f in files) { FileInfo fi = new FileInfo(f); EmplFiles file = new EmplFiles(); file.EmplID = employee.emplID; file.Employee = employee; file.FileContent = File.ReadAllBytes(f); file.FileName = fi.Name; foreach (baseEntity b in filters) { if (b is EmplDocumentation) { file.EmplDocumentation = b as EmplDocumentation; } } employee.EmplFiles.Add(file); } }