Correzione a file MRU (se nell'INI è presente un file di cui non si trova il ProjId/ProdId viene eliminato e non mostrato)
This commit is contained in:
@@ -211,7 +211,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public Core.ProdFileM FindCoreByProdId(int ProdId)
|
||||
{
|
||||
var currProd = FindByProdId(ProdId);
|
||||
|
||||
if (currProd == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
protected Core.ProjFileM coreConv(ProjModel currProj)
|
||||
{
|
||||
Core.ProjFileM answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine);
|
||||
Core.ProjFileM answ = null;
|
||||
if (currProj != null)
|
||||
{
|
||||
answ = Core.ProjFileM.CreateProjFileM(currProj.ProjId, ProdIdByProdDbId(currProj.ProdDbId), currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,13 +56,17 @@ Public Class ProdManagerVM
|
||||
Public ReadOnly Property MruFileNames As ObservableCollection(Of String)
|
||||
Get
|
||||
Dim IdAndBTLFileNames As New ObservableCollection(Of String)
|
||||
For Each FileName In m_MruFiles.FileNames
|
||||
For Each FileName In m_MruFiles.FileNames.ToList()
|
||||
Dim PdId As Integer = 0
|
||||
Dim sPdId As String = Path.GetFileNameWithoutExtension(DirectCast(FileName, String).Replace("__", "_"))
|
||||
Integer.TryParse(sPdId, PdId)
|
||||
Dim PdFileM = DbControllers.m_ProdController.FindCoreByProdId(PdId)
|
||||
Dim PdFileVM = New ProdFileVM(PdFileM)
|
||||
IdAndBTLFileNames.Add(sPdId & " | " & PdFileVM.sBTLFileName)
|
||||
If IsNothing(PdFileM) Then
|
||||
m_MruFiles.Remove(FileName)
|
||||
Else
|
||||
Dim PdFileVM = New ProdFileVM(PdFileM)
|
||||
IdAndBTLFileNames.Add(sPdId & " | " & PdFileVM.sBTLFileName)
|
||||
End If
|
||||
Next
|
||||
Return IdAndBTLFileNames
|
||||
End Get
|
||||
|
||||
@@ -76,12 +76,16 @@ Public Class ProjManagerVM
|
||||
Public ReadOnly Property MruFileNames As ObservableCollection(Of String)
|
||||
Get
|
||||
Dim IdAndBTLFileNames As New ObservableCollection(Of String)
|
||||
For Each FileName In m_MruFiles.FileNames
|
||||
For Each FileName In m_MruFiles.FileNames.ToList()
|
||||
Dim PjId As Integer = 0
|
||||
Dim sPjId As String = Path.GetFileNameWithoutExtension(DirectCast(FileName, String).Replace("__", "_"))
|
||||
Integer.TryParse(sPjId, PjId)
|
||||
Dim PjFileM = DbControllers.m_ProjController.FindByProjIdConv(PjId)
|
||||
IdAndBTLFileNames.Add(sPjId & " | " & PjFileM.sBTLFileName)
|
||||
If IsNothing(PjFileM) Then
|
||||
m_MruFiles.Remove(FileName)
|
||||
Else
|
||||
IdAndBTLFileNames.Add(sPjId & " | " & PjFileM.sBTLFileName)
|
||||
End If
|
||||
Next
|
||||
Return IdAndBTLFileNames
|
||||
End Get
|
||||
|
||||
Reference in New Issue
Block a user