- aggiunta gestione archiviazione progetti
This commit is contained in:
+81
-171
@@ -56,42 +56,6 @@ Public Class NewOpenProjectFileDialogVM
|
||||
dtEnd = dtEndDate
|
||||
End Select
|
||||
|
||||
Dim DbProjList As New List(Of ProjFileM)
|
||||
' CheckMe: lasciato come prima, anche NON attivi (cancellazione logica)
|
||||
If m_SelBTLDateType = BTLDateTypes.CREATEDATE Then
|
||||
DbProjList = DbControllers.m_ProjController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
Else
|
||||
DbProjList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
End If
|
||||
For Each Project In DbProjList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For
|
||||
' verifico se ha prod
|
||||
If Not IsNothing(Project.nProdId) And Project.nProdId > 0 Then
|
||||
' verifico se prod e' gia' stato creato
|
||||
Dim SameProdItem As ProdItem = m_ProjectList.FirstOrDefault(Function(x) Not IsNothing(x.ProdFileVM) AndAlso Not IsNothing(x.ProdFileVM.nProdId) AndAlso x.ProdFileVM.nProdId = Project.nProdId)
|
||||
If Not IsNothing(SameProdItem) Then
|
||||
SameProdItem.ProjFileList.Add(New ProjFileVM(Project))
|
||||
Else
|
||||
' recupero Prod
|
||||
Dim NewDbProd As ProdFileM = DbControllers.m_ProdController.FindCoreByProdId(Project.nProdId)
|
||||
If Not IsNothing(NewDbProd) Then
|
||||
m_ProjectList.Add(New ProdItem(New ProdFileVM(NewDbProd), New ProjFileVM(Project)))
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
m_ProjectList.Add(New ProdItem(Nothing, New ProjFileVM(Project)))
|
||||
End If
|
||||
'Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||
'If File.Exists(sPath) Then
|
||||
' m_ProjectList.Add(New ProjFileVM(Project))
|
||||
'Else
|
||||
' ' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
' 'DbControllers.m_ProjController.DeleteProj(Project.nProjId, False)
|
||||
' 'EgtOutLog("Found project on Db without the folder and erased it! Proj number " & Project.nProjId.ToString("0000"))
|
||||
' MessageBox.Show("Project file not found!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
'End If
|
||||
Next
|
||||
|
||||
|
||||
|
||||
@@ -103,142 +67,80 @@ Public Class NewOpenProjectFileDialogVM
|
||||
|
||||
|
||||
' leggo da db
|
||||
'If m_ProjectType = ProjectType.PROJ Then
|
||||
' Dim DbProjList As New List(Of ProjFileM)
|
||||
' ' CheckMe: lasciato come prima, anche NON attivi (cancellazione logica)
|
||||
' If m_SelBTLDateType = BTLDateTypes.CREATEDATE Then
|
||||
' DbProjList = DbControllers.m_ProjController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
' Else
|
||||
' DbProjList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity, False)
|
||||
' End If
|
||||
' For Each Project In DbProjList
|
||||
' ' recupero path per verificare esista
|
||||
' If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For
|
||||
' Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||
' If File.Exists(sPath) Then
|
||||
' m_ProjectList.Add(New ProjFileVM(Project))
|
||||
' Else
|
||||
' ' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
' DbControllers.m_ProjController.DeleteProj(Project.nProjId, False)
|
||||
' EgtOutLog("Found project on Db without the folder and erased it! Proj number " & Project.nProjId.ToString("0000"))
|
||||
' End If
|
||||
' Next
|
||||
'ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
'Dim DbProdList As New List(Of ProdFileM)
|
||||
' DbProdList = DbControllers.m_ProdController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
' If GoToProd Then
|
||||
' For Each Project In DbProdList
|
||||
' ' recupero path per verificare esista
|
||||
' If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
' Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
' If Project.sMachine = Map.refProjManagerVM.CurrProj.sMachine AndAlso
|
||||
' Project.nType = Map.refProjManagerVM.CurrProj.nType Then
|
||||
' If File.Exists(sPath) Then
|
||||
' m_ProjectList.Add(New ProdItem(New ProdFileVM(Project), Nothing))
|
||||
' Else
|
||||
' DbControllers.m_ProdController.DeleteProd(Project.nProdId)
|
||||
' EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
' Else
|
||||
' For Each Project In DbProdList
|
||||
' ' recupero path per verificare esista
|
||||
' If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
' Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
' If File.Exists(sPath) Then
|
||||
' m_ProjectList.Add(New ProdFileVM(Project))
|
||||
' Else
|
||||
' DbControllers.m_ProdController.DeleteProd(Project.nProdId)
|
||||
' EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
' End If
|
||||
' Next
|
||||
' End If
|
||||
'End If
|
||||
If m_ProjectType = ProjectType.PROJ Then
|
||||
Dim DbProjList As New List(Of ProjFileM)
|
||||
If m_SelBTLDateType = BTLDateTypes.CREATEDATE Then
|
||||
DbProjList = DbControllers.m_ProjController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
Else
|
||||
DbProjList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
End If
|
||||
For Each Project In DbProjList
|
||||
If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For
|
||||
' verifico se ha prod
|
||||
If Not IsNothing(Project.nProdId) And Project.nProdId > 0 Then
|
||||
' verifico se prod e' gia' stato creato
|
||||
Dim SameProdItem As ProdItem = m_ProjectList.FirstOrDefault(Function(x) Not IsNothing(x.ProdFileVM) AndAlso Not IsNothing(x.ProdFileVM.nProdId) AndAlso x.ProdFileVM.nProdId = Project.nProdId)
|
||||
If Not IsNothing(SameProdItem) Then
|
||||
SameProdItem.ProjFileList.Add(New ProjFileVM(Project))
|
||||
Else
|
||||
' recupero Prod
|
||||
Dim NewDbProd As ProdFileM = DbControllers.m_ProdController.FindCoreByProdId(Project.nProdId)
|
||||
If Not IsNothing(NewDbProd) Then
|
||||
m_ProjectList.Add(New ProdItem(New ProdFileVM(NewDbProd), New ProjFileVM(Project)))
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
m_ProjectList.Add(New ProdItem(New ProjFileVM(Project)))
|
||||
End If
|
||||
Next
|
||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
Dim DbProdList As New List(Of ProdFileM)
|
||||
DbProdList = DbControllers.m_ProdController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True, bViewArchived)
|
||||
If GoToProd Then
|
||||
For Each Project In DbProdList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
If Project.sMachine = Map.refProjManagerVM.CurrProj.sMachine AndAlso
|
||||
Project.nType = Map.refProjManagerVM.CurrProj.nType Then
|
||||
If File.Exists(sPath) Then
|
||||
' m_ProjectList.Add(New ProdItem(New ProdFileVM(Project)))
|
||||
'Else
|
||||
' DbControllers.m_ProdController.DeleteProd(Project.nProdId)
|
||||
' EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
For Each Project In DbProdList
|
||||
' recupero path per verificare esista
|
||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
If File.Exists(sPath) Then
|
||||
' recupero i proj
|
||||
Dim ProjList As New List(Of ProjectFileVM)
|
||||
For Each ProjFileId In Project.nProjIdList
|
||||
Dim ProjFileM As ProjectFileM = DbControllers.m_ProjController.FindByProjIdConv(ProjFileId)
|
||||
ProjList.Add(New ProjFileVM(ProjFileM))
|
||||
Next
|
||||
m_ProjectList.Add(New ProdItem(New ProdFileVM(Project), ProjList))
|
||||
'Else
|
||||
' DbControllers.m_ProdController.DeleteProd(Project.nProdId)
|
||||
' EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'Public Overrides Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
' m_ProjectList.Clear()
|
||||
' ' calcolo periodo e righe
|
||||
' Dim dtStart As DateTime
|
||||
' Dim dtEnd As DateTime
|
||||
' Dim nRowQuantity As Integer = 20
|
||||
' Select Case SelRowQuantity
|
||||
' Case RowQuantities.FIFTY
|
||||
' nRowQuantity = 50
|
||||
' Case RowQuantities.HUNDRED
|
||||
' nRowQuantity = 100
|
||||
' Case RowQuantities.HUNDREDANDFIFTY
|
||||
' nRowQuantity = 150
|
||||
' End Select
|
||||
' Select Case m_SelDayType
|
||||
' Case DayTypes.LASTMONTH
|
||||
' dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
' dtStart = dtEnd - TimeSpan.FromDays(31)
|
||||
' Case DayTypes.LAST3MONTHS
|
||||
' dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
' dtStart = dtEnd - TimeSpan.FromDays(31 * 3)
|
||||
' Case DayTypes.LAST6MONTHS
|
||||
' dtEnd = DateTime.Today + TimeSpan.FromDays(1)
|
||||
' dtStart = dtEnd - TimeSpan.FromDays(31 * 6)
|
||||
' Case DayTypes.PERIOD
|
||||
' dtStart = dtStartDate + TimeSpan.FromDays(1)
|
||||
' dtEnd = dtEndDate
|
||||
' End Select
|
||||
' ' leggo da db
|
||||
' If m_ProjectType = ProjectType.PROJ Then
|
||||
' Dim DbProjectList As New List(Of ProjFileM)
|
||||
' ' CheckMe: lasciato come prima, anche NON attivi (cancellazione logica)
|
||||
' If m_SelBTLDateType = BTLDateTypes.CREATEDATE Then
|
||||
' DbProjectList = DbControllers.m_ProjController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
' Else
|
||||
' DbProjectList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity, False)
|
||||
' End If
|
||||
' For Each Project In DbProjectList
|
||||
' ' recupero path per verificare esista
|
||||
' If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For
|
||||
' Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||
' If File.Exists(sPath) Then
|
||||
' m_ProjectList.Add(New ProjFileVM(Project))
|
||||
' Else
|
||||
' ' CheckMe impostata come cancellazione FISICA dal DB...
|
||||
' DbControllers.m_ProjController.DeleteProj(Project.nProjId, False)
|
||||
' EgtOutLog("Found project on Db without the folder and erased it! Proj number " & Project.nProjId.ToString("0000"))
|
||||
' End If
|
||||
' Next
|
||||
' ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
' Dim DbProjectList As New List(Of ProdFileM)
|
||||
' DbProjectList = DbControllers.m_ProdController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||
' If GoToProd Then
|
||||
' For Each Project In DbProjectList
|
||||
' ' recupero path per verificare esista
|
||||
' If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
' Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
' If Project.sMachine = Map.refProjManagerVM.CurrProj.sMachine AndAlso
|
||||
' Project.nType = Map.refProjManagerVM.CurrProj.nType Then
|
||||
' If File.Exists(sPath) Then
|
||||
' m_ProjectList.Add(New ProdFileVM(Project))
|
||||
' Else
|
||||
' DbControllers.m_ProdController.DeleteProd(Project.nProdId)
|
||||
' EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
' Else
|
||||
' For Each Project In DbProjectList
|
||||
' ' recupero path per verificare esista
|
||||
' If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
||||
' Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
||||
' If File.Exists(sPath) Then
|
||||
' m_ProjectList.Add(New ProdFileVM(Project))
|
||||
' Else
|
||||
' DbControllers.m_ProdController.DeleteProd(Project.nProdId)
|
||||
' EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||
' End If
|
||||
' Next
|
||||
' End If
|
||||
' End If
|
||||
'End Sub
|
||||
Public Overrides Sub Archive()
|
||||
If IsNothing(SelProject) Then Return
|
||||
If IsNothing(SelProject.ProdFileVM) Then Return
|
||||
' archivio il progetto
|
||||
DbControllers.m_ProdController.UpdateArchived(SelProject.ProdFileVM.nProdId, True)
|
||||
' aggiorno lista progetti
|
||||
RefreshProjectList()
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub Delete()
|
||||
'If IsNothing(SelProject) Then Return
|
||||
@@ -385,8 +287,16 @@ Public Class ProdItem
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(ProdFileVM As ProjectFileVM, ProjFileVM As ProjectFileVM)
|
||||
Sub New(ProdFileVM As ProdFileVM, ProjFileVM As ProjFileVM)
|
||||
MyBase.New(ProdFileVM, ProjFileVM)
|
||||
End Sub
|
||||
|
||||
Sub New(ProjFileVM As ProjFileVM)
|
||||
MyBase.New(ProjFileVM)
|
||||
End Sub
|
||||
|
||||
Sub New(ProdFileVM As ProjectFileVM, ProjFileVMList As List(Of ProjectFileVM))
|
||||
MyBase.New(ProdFileVM, ProjFileVMList)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user