MH: Neue View zum Bearbeiten von Datei-Infos erstellt
This commit is contained in:
30
BeWo/View/Detail/DateiBearbeiten.xaml
Normal file
30
BeWo/View/Detail/DateiBearbeiten.xaml
Normal file
@@ -0,0 +1,30 @@
|
||||
<localView:BeWoView x:Class="BeWo.View.Detail.DateiBearbeiten"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:localView="clr-namespace:BeWo.View" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
|
||||
Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True">
|
||||
|
||||
|
||||
<Grid Background="{StaticResource ObjectEditBackgroundBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="75"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Dateiname:" Margin="2 0 0 0"/>
|
||||
<TextBox x:Name="Textbox_Dateiname" Grid.Row="0" Grid.Column="1" Height="20" Margin="5 0 2 0"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Beschreibung:" Margin="2 0 0 0"/>
|
||||
<TextBox x:Name="Textbox_Beschreibung" Grid.Row="1" Grid.Column="1" Height="20" Margin="5 0 2 0"/>
|
||||
|
||||
<WrapPanel Grid.Row="2" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5 5 2 0">
|
||||
<Button x:Name="Button_Cancel" Content="Abbrechen" Click="Button_Cancel_Click" Margin="0 0 5 0" />
|
||||
<Button x:Name="Button_Save" Content="Speichern" Click="Button_Save_Click"/>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
|
||||
</localView:BeWoView>
|
||||
80
BeWo/View/Detail/DateiBearbeiten.xaml.cs
Normal file
80
BeWo/View/Detail/DateiBearbeiten.xaml.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
using BeWo.Controls;
|
||||
using BeWo.Core;
|
||||
using BeWo.ServiceProxy;
|
||||
using BeWo.Validation;
|
||||
using BeWo.View.Search;
|
||||
using BeWo.ViewModel;
|
||||
using BeWo.ViewModel.ListViewModel;
|
||||
using BeWo.Core.Service;
|
||||
|
||||
using BS.Shared;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.ClientPartials;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Services;
|
||||
using BS.Shared.Translation;
|
||||
using DevExpress.Xpf.RichEdit;
|
||||
using SupportConceptService = BeWo.Core.Service.SupportConceptService;
|
||||
using System.Linq;
|
||||
using DevExpress.Xpf.Grid;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DevExpress.Utils;
|
||||
|
||||
namespace BeWo.View.Detail
|
||||
{
|
||||
public partial class DateiBearbeiten
|
||||
{
|
||||
public event Action ButtonSaveClicked;
|
||||
public event Action ButtonCancelClicked;
|
||||
|
||||
public FileAttachmentVM Datei { get; set; }
|
||||
public FileAttachmentVM AktualisierteDatei { get; set; }
|
||||
|
||||
public DateiBearbeiten()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void InitView(FileAttachmentVM auswahl)
|
||||
{
|
||||
Textbox_Dateiname.Text = auswahl.FileName;
|
||||
Textbox_Beschreibung.Text = auswahl.Description;
|
||||
|
||||
Datei = auswahl;
|
||||
}
|
||||
private void Button_Save_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string name = Textbox_Dateiname.Text;
|
||||
string description = Textbox_Beschreibung.Text;
|
||||
|
||||
FileAttachmentVM dateiBearbeitet = Datei;
|
||||
dateiBearbeitet.FileName = name;
|
||||
dateiBearbeitet.DataContract.FileName = name;
|
||||
dateiBearbeitet.Description = description;
|
||||
dateiBearbeitet.DataContract.Description = description;
|
||||
|
||||
if (Datei.Equals(dateiBearbeitet))
|
||||
ButtonCancelClicked?.Invoke();
|
||||
|
||||
var newDC = ServiceFacade.DoOperationsServiceSync(s => s.UpdateFileAttachment(dateiBearbeitet.DataContract));
|
||||
AktualisierteDatei = new FileAttachmentVM(newDC);
|
||||
|
||||
ButtonSaveClicked?.Invoke();
|
||||
}
|
||||
|
||||
private void Button_Cancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Wollen Sie wirklich abbrechen?", "BeWoPlaner", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
|
||||
ButtonCancelClicked?.Invoke();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -239,11 +239,11 @@ namespace BeWo.View.Detail.Report
|
||||
vorherigeSchichtStart = TimeSpan.Parse(vorherigeSchicht.Startzeit);
|
||||
vorherigeSchichtEnde = TimeSpan.Parse(vorherigeSchicht.Endzeit);
|
||||
|
||||
if (i == diensteFuerTag.Count - 1)
|
||||
{
|
||||
tagAusgefuellt = false;
|
||||
break;
|
||||
}
|
||||
//if (i == diensteFuerTag.Count - 1)
|
||||
//{
|
||||
// tagAusgefuellt = false;
|
||||
// break;
|
||||
//}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -938,6 +938,17 @@ namespace BeWo.View.Master
|
||||
control.ButtonSaveClicked += () =>
|
||||
{
|
||||
FileAttachmentVM newVM = control.AktualisierteDatei;
|
||||
|
||||
row.DataContract.FilesInFolder.Remove(selectedFile.DataContract);
|
||||
row.DataContract.BeWoFolderDC.Files.Remove(selectedFile.DataContract);
|
||||
|
||||
row.DataContract.FilesInFolder.Add(newVM.DataContract);
|
||||
row.DataContract.BeWoFolderDC.Files.Add(newVM.DataContract);
|
||||
|
||||
this.datagrid_documents.ItemsSource = null;
|
||||
this.datagrid_documents.ItemsSource = row.DataContract.FilesInFolder;
|
||||
|
||||
|
||||
beWoWindow.Close();
|
||||
return;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user