MH: Letzte Bugs bei Umbenennen-Funktion gefixt
This commit is contained in:
@@ -55,17 +55,22 @@ namespace BeWo.View.Detail
|
||||
string name = Textbox_Dateiname.Text;
|
||||
string description = Textbox_Beschreibung.Text;
|
||||
|
||||
FileAttachmentVM dateiBearbeitet = Datei;
|
||||
FileAttachmentVM dateiBearbeitet = new FileAttachmentVM(Datei.DataContract);
|
||||
|
||||
dateiBearbeitet.FileName = name;
|
||||
dateiBearbeitet.DataContract.FileName = name;
|
||||
dateiBearbeitet.Description = description;
|
||||
dateiBearbeitet.DataContract.Description = description;
|
||||
|
||||
if (Datei.Equals(dateiBearbeitet))
|
||||
if (Datei.FileName.Equals(dateiBearbeitet.FileName) && Datei.Description.Equals(dateiBearbeitet.Description))
|
||||
{
|
||||
ButtonCancelClicked?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
var newDC = ServiceFacade.DoOperationsServiceSync(s => s.UpdateFileAttachment(dateiBearbeitet.DataContract));
|
||||
AktualisierteDatei = new FileAttachmentVM(newDC);
|
||||
var AktualisierteDatei2 = dateiBearbeitet;
|
||||
|
||||
ButtonSaveClicked?.Invoke();
|
||||
}
|
||||
|
||||
@@ -874,18 +874,7 @@ namespace BeWo.View.Master
|
||||
if (selected == null)
|
||||
return;
|
||||
|
||||
var vmList = new List<FileAttachmentVM>();
|
||||
|
||||
if (selected.DataContract.FilesInFolder != null)
|
||||
{
|
||||
List<FileAttachmentDC> list = selected.DataContract.FilesInFolder;
|
||||
foreach (var file in list)
|
||||
{
|
||||
vmList.Add(new FileAttachmentVM(file));
|
||||
}
|
||||
}
|
||||
|
||||
datagrid_documents.ItemsSource = vmList;
|
||||
SetItemSourceForFileGrid(selected);
|
||||
}
|
||||
}
|
||||
private void DeleteButton_Click(object sender, RoutedEventArgs e)
|
||||
@@ -907,7 +896,8 @@ namespace BeWo.View.Master
|
||||
ServiceFacade.DoOperationsServiceAsync(s => s.DeleteFileAttachment(selectedFile.DataContract.FileAttachmentOid.Value, selectedFile.DataContract.FileAttachmentVersion.Value));
|
||||
row.DataContract.FilesInFolder.Remove(selectedFile.DataContract);
|
||||
row.DataContract.BeWoFolderDC.Files.Remove(selectedFile.DataContract);
|
||||
this.datagrid_documents.ItemsSource = row.DataContract.FilesInFolder;
|
||||
|
||||
SetItemSourceForFileGrid(row);
|
||||
}
|
||||
}
|
||||
private void EditButton_Click(object sender, RoutedEventArgs e)
|
||||
@@ -925,7 +915,7 @@ namespace BeWo.View.Master
|
||||
|
||||
var beWoWindow = new BeWoWindow
|
||||
{
|
||||
rootGroupBox = { Header = "Datei \"" + selectedFile.FileName + "\" bearbeiten" },
|
||||
rootGroupBox = { Header = "Datei bearbeiten" },
|
||||
Height = 100,
|
||||
Width = 400,
|
||||
MinWidth = 300,
|
||||
@@ -948,10 +938,7 @@ namespace BeWo.View.Master
|
||||
|
||||
row.DataContract.FilesInFolder = row.DataContract.FilesInFolder.OrderBy(f => f.InsertedOn).ToList();
|
||||
|
||||
this.datagrid_documents.ItemsSource = null;
|
||||
this.datagrid_documents.ItemsSource = row.DataContract.FilesInFolder;
|
||||
|
||||
this.datagrid_documents.SelectedItem = null;
|
||||
SetItemSourceForFileGrid(row);
|
||||
|
||||
beWoWindow.Close();
|
||||
return;
|
||||
@@ -963,14 +950,24 @@ namespace BeWo.View.Master
|
||||
};
|
||||
|
||||
beWoWindow.ShowDialog();
|
||||
}
|
||||
|
||||
//if (selectedFile.DataContract.FileAttachmentOid != null)
|
||||
//{
|
||||
// ServiceFacade.DoOperationsServiceAsync(s => s.DeleteFileAttachment(selectedFile.DataContract.FileAttachmentOid.Value, selectedFile.DataContract.FileAttachmentVersion.Value));
|
||||
// row.DataContract.FilesInFolder.Remove(selectedFile.DataContract);
|
||||
// row.DataContract.BeWoFolderDC.Files.Remove(selectedFile.DataContract);
|
||||
// this.datagrid_documents.ItemsSource = row.DataContract.FilesInFolder;
|
||||
//}
|
||||
private void SetItemSourceForFileGrid(DocumentTreeItemVM row)
|
||||
{
|
||||
this.datagrid_documents.ItemsSource = null;
|
||||
|
||||
var vmList = new List<FileAttachmentVM>();
|
||||
|
||||
if (row.DataContract.FilesInFolder != null)
|
||||
{
|
||||
List<FileAttachmentDC> list = row.DataContract.FilesInFolder;
|
||||
foreach (var file in list)
|
||||
{
|
||||
vmList.Add(new FileAttachmentVM(file));
|
||||
}
|
||||
}
|
||||
|
||||
datagrid_documents.ItemsSource = vmList;
|
||||
}
|
||||
|
||||
private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
pEntity.Oid = pDataContract.FileAttachmentOid;
|
||||
pEntity.Notice = pDataContract.Description;
|
||||
pEntity.Path = pDataContract.FileName;
|
||||
pEntity.IsLocked = pDataContract.IsLocked;
|
||||
pEntity.LockedBy = pDataContract.LockedBy;
|
||||
pEntity.BeWoFolderOid = pDataContract.BeWoFolderOid;
|
||||
|
||||
@@ -134,12 +134,17 @@ namespace BeWo.Service.Dokumentverwaltung
|
||||
}
|
||||
public static FileAttachmentDC UpdateFileAttachment(FileAttachmentDC file)
|
||||
{
|
||||
var origFile = DAOFactory.GenericDAO.LoadByID<FileAttachmentInfo>(file.FileAttachmentOid.Value);
|
||||
MapperFactory.FileAttachmentDC_FileAttachmentInfo.MergeWithEntity(file, origFile);
|
||||
var origFile = DAOFactory.GenericDAO.LoadByID<FileAttachment>(file.FileAttachmentOid.Value);
|
||||
//var origFile = DAOFactory.GenericDAO.LoadByID<FileAttachmentInfo>(file.FileAttachmentOid.Value);
|
||||
|
||||
//MapperFactory.FileAttachmentDC_FileAttachmentInfo.MergeWithEntity(file, origFile); // Bei Fehlern wieder einkommentieren
|
||||
MapperFactory.FileAttachmentDC_FileAttachment.MergeWithEntity(file, origFile); // Bei Fehlern auskommentieren
|
||||
|
||||
DAOFactory.GenericDAO.Update(origFile);
|
||||
|
||||
FileAttachmentDC updatedFileDC = MapperFactory.FileAttachmentDC_FileAttachmentInfo.MapToNewDC(origFile);
|
||||
//FileAttachmentDC updatedFileDC = MapperFactory.FileAttachmentDC_FileAttachmentInfo.MapToNewDC(origFile); // Bei Fehlern wieder einkommentieren
|
||||
FileAttachmentDC updatedFileDC = MapperFactory.FileAttachmentDC_FileAttachment.MapToNewDC(origFile); // Bei Fehlern auskommentieren
|
||||
|
||||
return updatedFileDC;
|
||||
}
|
||||
public static FileAttachmentDC DoTheRealFileUpdate(FileAttachmentDC file)
|
||||
|
||||
Reference in New Issue
Block a user