Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 23b2606cbc | |||
| ce20fa0eb3 | |||
| c32715a4b5 | |||
| 52c0b6b194 | |||
| a83752e565 | |||
| 60e72aaf22 | |||
| ec2ce96b3b | |||
| d131e0b42d | |||
| efea14db89 | |||
| c09d8a6b0f | |||
| 946ad1d29c | |||
| c5f1d1669f | |||
| 689e81219b | |||
| 05ec565f84 | |||
| 0e7866922d | |||
| fb92f9faea | |||
| f65d07ab22 | |||
| f140b6df54 | |||
| 441ddc4397 | |||
| 8c42493382 |
@@ -116,6 +116,7 @@
|
|||||||
<DependentUpon>NewOpenProjectFileDialogV.xaml</DependentUpon>
|
<DependentUpon>NewOpenProjectFileDialogV.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogVM.vb" />
|
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogVM.vb" />
|
||||||
|
<Compile Include="ProjectFileVM\ProdItem.vb" />
|
||||||
<Compile Include="Utility\DimensionsIniFile.vb" />
|
<Compile Include="Utility\DimensionsIniFile.vb" />
|
||||||
<Compile Include="Utility\Enum.vb" />
|
<Compile Include="Utility\Enum.vb" />
|
||||||
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
|
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
|
||||||
|
|||||||
@@ -779,94 +779,3 @@ Public MustInherit Class NewOpenProjectFileDialogVM
|
|||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Public Class ProdItem
|
|
||||||
Inherits VMBase
|
|
||||||
|
|
||||||
Public Shared m_delIsModifiedSetUp As Action(Of Boolean)
|
|
||||||
|
|
||||||
Protected m_ProdFileVM As ProdFileVM
|
|
||||||
Public ReadOnly Property ProdFileVM As ProdFileVM
|
|
||||||
Get
|
|
||||||
Return m_ProdFileVM
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Private m_ProjFileList As New List(Of ProjectFileVM)
|
|
||||||
Public ReadOnly Property ProjFileList As List(Of ProjectFileVM)
|
|
||||||
Get
|
|
||||||
Return m_ProjFileList
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property sProdId As String
|
|
||||||
Get
|
|
||||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sProdId, "")
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public Overridable Property sName As String
|
|
||||||
Get
|
|
||||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sName, "")
|
|
||||||
End Get
|
|
||||||
Set(value As String)
|
|
||||||
If Not IsNothing(m_ProdFileVM) Then
|
|
||||||
m_ProdFileVM.sName = value
|
|
||||||
End If
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property dtCreateDate As Date
|
|
||||||
Get
|
|
||||||
Return If(Not IsNothing(m_ProdFileVM), {m_ProdFileVM.dtCreateDate, m_ProjFileList.Min(Function(x) x.dtCreateDate)}.Min(), m_ProjFileList.Min(Function(x) x.dtCreateDate))
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
Public ReadOnly Property sCreateDate As String
|
|
||||||
Get
|
|
||||||
Return dtCreateDate.ToString()
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property sMachine As String
|
|
||||||
Get
|
|
||||||
If Not IsNothing(m_ProdFileVM) Then
|
|
||||||
Return m_ProdFileVM.sMachine
|
|
||||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
|
||||||
Return m_ProjFileList(0).sMachine
|
|
||||||
Else Return ""
|
|
||||||
End If
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property bIsArchived As Boolean
|
|
||||||
Get
|
|
||||||
If Not IsNothing(m_ProdFileVM) Then
|
|
||||||
Return m_ProdFileVM.bIsArchived
|
|
||||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
|
||||||
Return m_ProjFileList(0).bIsArchived
|
|
||||||
Else
|
|
||||||
Return True
|
|
||||||
End If
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Public ReadOnly Property Archived_Visibility As Visibility
|
|
||||||
Get
|
|
||||||
Return If(bIsArchived, Visibility.Visible, Visibility.Collapsed)
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
Sub New(ProdFileVM As ProdFileVM, ProjFileVM As ProjFileVM)
|
|
||||||
m_ProdFileVM = ProdFileVM
|
|
||||||
m_ProjFileList.Add(ProjFileVM)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub New(ProjFileVM As ProjFileVM)
|
|
||||||
m_ProjFileList = New List(Of ProjectFileVM)({ProjFileVM})
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub New(ProdFileVM As ProjectFileVM, ProjFileVMList As List(Of ProjectFileVM))
|
|
||||||
m_ProdFileVM = ProdFileVM
|
|
||||||
m_ProjFileList = ProjFileVMList
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
End Class
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ Public MustInherit Class OpenProjectFileDialogVM
|
|||||||
|
|
||||||
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
||||||
|
|
||||||
|
Protected m_GoToProd As Boolean = False
|
||||||
|
|
||||||
Protected m_ProjectColumns As New ObservableCollection(Of EgtDataGridColumn)
|
Protected m_ProjectColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||||
Public Property ProjectColumns As ObservableCollection(Of EgtDataGridColumn)
|
Public Property ProjectColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||||
Get
|
Get
|
||||||
@@ -438,7 +440,7 @@ Public MustInherit Class OpenProjectFileDialogVM
|
|||||||
#Region "METHODS"
|
#Region "METHODS"
|
||||||
|
|
||||||
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||||
Public Overridable Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
Public Overridable Sub RefreshProjectList()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub LoadColumns(ProjectType As ProjectType)
|
Protected Sub LoadColumns(ProjectType As ProjectType)
|
||||||
|
|||||||
@@ -14,6 +14,13 @@ Public Class ProdFileM
|
|||||||
m_nProjIdList = value
|
m_nProjIdList = value
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Protected m_ProjMList As List(Of ProjFileM)
|
||||||
|
Public ReadOnly Property ProjMList As List(Of ProjFileM)
|
||||||
|
Get
|
||||||
|
Return m_ProjMList
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
Protected m_sName As String
|
Protected m_sName As String
|
||||||
Public Property sName As String
|
Public Property sName As String
|
||||||
Get
|
Get
|
||||||
@@ -60,6 +67,24 @@ Public Class ProdFileM
|
|||||||
Return NewProjectFileM
|
Return NewProjectFileM
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||||
|
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, ProjMList As List(Of ProjFileM)) As ProdFileM
|
||||||
|
Dim NewProjectFileM As New ProdFileM
|
||||||
|
NewProjectFileM.m_nProdId = nProdId
|
||||||
|
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||||
|
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||||
|
NewProjectFileM.m_sName = sName
|
||||||
|
NewProjectFileM.m_nType = nType
|
||||||
|
NewProjectFileM.m_sMachine = sMachine
|
||||||
|
NewProjectFileM.m_sLockedBy = sLockedBy
|
||||||
|
NewProjectFileM.m_dtLock = dtLock
|
||||||
|
NewProjectFileM.m_bIsActive = bIsActive
|
||||||
|
NewProjectFileM.m_bIsProduced = bIsProduced
|
||||||
|
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||||
|
NewProjectFileM.m_ProjMList = ProjMList
|
||||||
|
Return NewProjectFileM
|
||||||
|
End Function
|
||||||
|
|
||||||
#End Region ' CONSTRUCTORS
|
#End Region ' CONSTRUCTORS
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
|
||||||
|
Imports EgtWPFLib5
|
||||||
|
Imports System.Windows
|
||||||
|
|
||||||
|
Public Class ProdItem
|
||||||
|
Inherits VMBase
|
||||||
|
|
||||||
|
Public Shared m_delUpdateNameInDb As Action(Of Integer, String)
|
||||||
|
Public Shared m_delIsModifiedSetUp As Action(Of Boolean)
|
||||||
|
|
||||||
|
Protected m_ProdFileVM As ProdFileVM
|
||||||
|
Public ReadOnly Property ProdFileVM As ProdFileVM
|
||||||
|
Get
|
||||||
|
Return m_ProdFileVM
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private m_ProjFileList As New List(Of ProjectFileVM)
|
||||||
|
Public ReadOnly Property ProjFileList As List(Of ProjectFileVM)
|
||||||
|
Get
|
||||||
|
Return m_ProjFileList
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property sProdId As String
|
||||||
|
Get
|
||||||
|
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sProdId, "")
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public Overridable Property sName As String
|
||||||
|
Get
|
||||||
|
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sName, "")
|
||||||
|
End Get
|
||||||
|
Set(value As String)
|
||||||
|
If Not IsNothing(m_ProdFileVM) Then
|
||||||
|
m_delUpdateNameInDb(m_ProdFileVM.nProdId, value)
|
||||||
|
m_ProdFileVM.sName = value
|
||||||
|
m_delIsModifiedSetUp(False)
|
||||||
|
End If
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property dtCreateDate As Date
|
||||||
|
Get
|
||||||
|
Return If(Not IsNothing(m_ProdFileVM), {m_ProdFileVM.dtCreateDate, m_ProjFileList.Min(Function(x) x.dtCreateDate)}.Min(), m_ProjFileList.Min(Function(x) x.dtCreateDate))
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
Public ReadOnly Property sCreateDate As String
|
||||||
|
Get
|
||||||
|
Return dtCreateDate.ToString()
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property sMachine As String
|
||||||
|
Get
|
||||||
|
If Not IsNothing(m_ProdFileVM) Then
|
||||||
|
Return m_ProdFileVM.sMachine
|
||||||
|
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||||
|
Return m_ProjFileList(0).sMachine
|
||||||
|
Else Return ""
|
||||||
|
End If
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property bIsArchived As Boolean
|
||||||
|
Get
|
||||||
|
If Not IsNothing(m_ProdFileVM) Then
|
||||||
|
Return m_ProdFileVM.bIsArchived
|
||||||
|
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||||
|
Return m_ProjFileList(0).bIsArchived
|
||||||
|
Else
|
||||||
|
Return True
|
||||||
|
End If
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property Archived_Visibility As Visibility
|
||||||
|
Get
|
||||||
|
Return If(bIsArchived, Visibility.Visible, Visibility.Collapsed)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Sub New(ProdFileVM As ProdFileVM, ProjFileVM As ProjFileVM)
|
||||||
|
m_ProdFileVM = ProdFileVM
|
||||||
|
m_ProjFileList.Add(ProjFileVM)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Sub New(ProjFileVM As ProjFileVM)
|
||||||
|
m_ProjFileList = New List(Of ProjectFileVM)({ProjFileVM})
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Sub New(ProdFileVM As ProjectFileVM, ProjFileVMList As List(Of ProjectFileVM))
|
||||||
|
m_ProdFileVM = ProdFileVM
|
||||||
|
m_ProjFileList = ProjFileVMList
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Function CreateProdItem(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||||
|
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, ProjMList As List(Of ProjFileM)) As ProdItem
|
||||||
|
|
||||||
|
|
||||||
|
Dim NewProdFileM = ProdFileM.CreateProdFileM(nProdId, nProjIdList, dtCreateProjDate, sName, nType, sMachine, sLockedBy, dtLock, bIsActive, bIsProduced, bIsArchived)
|
||||||
|
Dim NewProdFileVM = New ProdFileVM(NewProdFileM)
|
||||||
|
Dim NewProjFileVM As IEnumerable(Of ProjectFileVM)
|
||||||
|
NewProjFileVM = ProjMList.Select(Of ProjFileVM)(Function(j) New ProjFileVM(j)).ToList
|
||||||
|
Dim NewProdItem = New ProdItem(NewProdFileVM, NewProjFileVM.ToList)
|
||||||
|
|
||||||
|
Return NewProdItem
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function CreateProdItem(ProjFileM As ProjFileM) As ProdItem
|
||||||
|
|
||||||
|
Dim NewProdItem = New ProdItem(New ProjFileVM(ProjFileM))
|
||||||
|
|
||||||
|
Return NewProdItem
|
||||||
|
End Function
|
||||||
|
|
||||||
|
End Class
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data.Entity;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using static EgtBEAMWALL.Core.ConstBeam;
|
using static EgtBEAMWALL.Core.ConstBeam;
|
||||||
|
|
||||||
@@ -208,11 +209,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Elenco prod
|
/// Elenco prod
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="numRecord">Num max record da recuperare</param>
|
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<Core.ProdFileM> GetLastDesc(int numRecord, bool OnlyActive, bool ShowArchived = false)
|
public List<Core.ProdFileM> GetLastDesc(int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||||
{
|
{
|
||||||
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
||||||
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
|
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
|
||||||
@@ -220,9 +221,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
// se numRecord = 0 --> passo tutti
|
// se numRecord = 0 --> passo tutti
|
||||||
if (numRecord == 0)
|
if (NumRecord == 0)
|
||||||
{
|
{
|
||||||
numRecord = localDbCtx.ProdList.Count();
|
NumRecord = localDbCtx.ProdList.Count();
|
||||||
}
|
}
|
||||||
// retrieve
|
// retrieve
|
||||||
dbResult = localDbCtx
|
dbResult = localDbCtx
|
||||||
@@ -235,7 +236,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
(p, e) => p)
|
(p, e) => p)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.OrderByDescending(x => x.ProdId)
|
.OrderByDescending(x => x.ProdId)
|
||||||
.Take(numRecord)
|
.Take(NumRecord)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,13 +248,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Elenco prod
|
/// Elenco prod
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dtStart">Inizio periodo estrazione</param>
|
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||||
/// <param name="dtEnd">Fine periodo estrazione</param>
|
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||||
/// <param name="numRecord">Num max record da recuperare</param>
|
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||||
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||||
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<Core.ProdFileM> GetLastDesc(DateTime dtStart, DateTime dtEnd, int numRecord, bool OnlyActive, bool ShowArchived = false)
|
public List<Core.ProdFileM> GetLastDesc(DateTime DtStart, DateTime DtEnd, int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||||
{
|
{
|
||||||
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
List<Core.ProdFileM> result = new List<Core.ProdFileM>();
|
||||||
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
|
//List<ProdModel> dbResult = GetLastDbModelDesc(numRecord);
|
||||||
@@ -261,14 +262,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
{
|
{
|
||||||
// se numRecord = 0 --> passo tutti
|
// se numRecord = 0 --> passo tutti
|
||||||
if (numRecord == 0)
|
if (NumRecord == 0)
|
||||||
{
|
{
|
||||||
numRecord = localDbCtx.ProdList.Count();
|
NumRecord = localDbCtx.ProdList.Count();
|
||||||
}
|
}
|
||||||
// retrieve
|
// retrieve
|
||||||
dbResult = localDbCtx
|
dbResult = localDbCtx
|
||||||
.ProdList
|
.ProdList
|
||||||
.Where(x => x.DtCreated >= dtStart && x.DtCreated <= dtEnd && (!x.IsArchived || ShowArchived))
|
.Where(x => x.DtCreated >= DtStart && x.DtCreated <= DtEnd && (!x.IsArchived || ShowArchived))
|
||||||
// condizione join sui PROJ
|
// condizione join sui PROJ
|
||||||
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||||
p => p.ProdDbId,
|
p => p.ProdDbId,
|
||||||
@@ -276,7 +277,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
(p, e) => p)
|
(p, e) => p)
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.OrderByDescending(x => x.ProdId)
|
.OrderByDescending(x => x.ProdId)
|
||||||
.Take(numRecord)
|
.Take(NumRecord)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,6 +286,183 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Elenco prod
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||||
|
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||||
|
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<Core.ProdItem> GetLastDescFull(int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||||
|
{
|
||||||
|
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||||
|
// elenco prod completi
|
||||||
|
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||||
|
// elenco proj "orfani"
|
||||||
|
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
// se numRecord = 0 --> passo tutti
|
||||||
|
if (NumRecord == 0)
|
||||||
|
{
|
||||||
|
NumRecord = localDbCtx.ProdList.Count();
|
||||||
|
}
|
||||||
|
// recupero PROD + proj relativi
|
||||||
|
dbResultProd = localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.Where(x => (!x.IsArchived || ShowArchived))
|
||||||
|
//.Include(j => j.)
|
||||||
|
// condizione join sui PROJ
|
||||||
|
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||||
|
p => p.ProdDbId,
|
||||||
|
e => e.ProdDbId,
|
||||||
|
(p, e) => p)
|
||||||
|
.Distinct()
|
||||||
|
.Include(j => j.ProjListNav)
|
||||||
|
.OrderByDescending(x => x.ProdId)
|
||||||
|
.Take(NumRecord)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// recupero i proj "orfani"
|
||||||
|
dbResultProj = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => (x.IsActive || !OnlyActive) && x.Prod == null)
|
||||||
|
.OrderByDescending(x => x.ProjId)
|
||||||
|
.Take(NumRecord)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// conversione
|
||||||
|
result = dbResultProd.Select(x => coreItemConv(x)).ToList();
|
||||||
|
var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();
|
||||||
|
// sommo i risultati
|
||||||
|
result.AddRange(resProj);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Elenco prod
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||||
|
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||||
|
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||||
|
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||||
|
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<Core.ProdItem> GetLastDescFull(DateTime DtStart, DateTime DtEnd, int NumRecord, bool OnlyActive, bool ShowArchived = false)
|
||||||
|
{
|
||||||
|
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||||
|
// elenco prod completi
|
||||||
|
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||||
|
// elenco proj "orfani"
|
||||||
|
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
// se numRecord = 0 --> passo tutti
|
||||||
|
if (NumRecord == 0)
|
||||||
|
{
|
||||||
|
NumRecord = localDbCtx.ProdList.Count();
|
||||||
|
}
|
||||||
|
// retrieve
|
||||||
|
dbResultProd = localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.Where(x => x.DtCreated >= DtStart && x.DtCreated <= DtEnd && (!x.IsArchived || ShowArchived))
|
||||||
|
// condizione join sui PROJ
|
||||||
|
.Join(localDbCtx.ProjList.Where(x => x.IsActive || !OnlyActive),
|
||||||
|
p => p.ProdDbId,
|
||||||
|
e => e.ProdDbId,
|
||||||
|
(p, e) => p)
|
||||||
|
.Distinct()
|
||||||
|
.Include(j => j.ProjListNav)
|
||||||
|
.OrderByDescending(x => x.ProdId)
|
||||||
|
.Take(NumRecord)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// recupero i proj "orfani"
|
||||||
|
dbResultProj = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x => (x.IsActive || !OnlyActive) && x.Prod == null && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd))
|
||||||
|
.OrderByDescending(x => x.ProjId)
|
||||||
|
.Take(NumRecord)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
// conversione
|
||||||
|
result = dbResultProd.Select(x => coreItemConv(x)).ToList();
|
||||||
|
var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();
|
||||||
|
// sommo i risultati
|
||||||
|
result.AddRange(resProj);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Elenco prod
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="DtStart">Inizio periodo estrazione</param>
|
||||||
|
/// <param name="DtEnd">Fine periodo estrazione</param>
|
||||||
|
/// <param name="DtIsCreation">Ture: usa data creazione / False: usa data export</param>
|
||||||
|
/// <param name="NumRecord">Num max record da recuperare</param>
|
||||||
|
/// <param name="OnlyActive">Solo con ALMENO 1 PROJ attivo (senza cancellazione logica)</param>
|
||||||
|
/// <param name="Machine">Nome Macchina (default vuoto = non usato)</param>
|
||||||
|
/// <param name="BtlFileName">Nome file BTL (default vuoto = non usato)</param>
|
||||||
|
/// <param name="ListName">Nome List (default vuoto = non usato)</param>
|
||||||
|
/// <param name="ShowArchived">Se true: mostra anche archiviati (default li nasconde)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<Core.ProdItem> GetLastDescFull(DateTime DtStart, DateTime DtEnd, bool DtIsCreation, int NumRecord, bool OnlyActive, string Machine = "", string BtlFileName = "", string ListName = "", bool ShowArchived = false)
|
||||||
|
{
|
||||||
|
List<Core.ProdItem> result = new List<Core.ProdItem>();
|
||||||
|
List<ProdModel> dbResultProd = new List<ProdModel>();
|
||||||
|
// elenco proj "orfani"
|
||||||
|
List<ProjModel> dbResultProj = new List<ProjModel>();
|
||||||
|
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||||
|
{
|
||||||
|
// se numRecord = 0 --> passo tutti
|
||||||
|
if (NumRecord == 0)
|
||||||
|
{
|
||||||
|
NumRecord = localDbCtx.ProdList.Count();
|
||||||
|
}
|
||||||
|
// retrieve
|
||||||
|
dbResultProd = localDbCtx
|
||||||
|
.ProdList
|
||||||
|
.Where(x => (!x.IsArchived || ShowArchived))
|
||||||
|
// condizione join sui PROJ
|
||||||
|
.Join(localDbCtx.ProjList.Where(x =>
|
||||||
|
(x.IsActive || !OnlyActive)
|
||||||
|
&& (string.IsNullOrEmpty(Machine) || x.Machine.ToLower().Contains(Machine.ToLower()))
|
||||||
|
&& (string.IsNullOrEmpty(BtlFileName) || x.BTLFileName.ToLower().Contains( BtlFileName.ToLower()))
|
||||||
|
&& (string.IsNullOrEmpty(ListName) || x.ListName.ToLower().Contains(ListName.ToLower()))
|
||||||
|
&& ((DtIsCreation && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd)) || (!DtIsCreation && (x.DtExported >= DtStart && x.DtExported <= DtEnd)))
|
||||||
|
),
|
||||||
|
p => p.ProdDbId,
|
||||||
|
e => e.ProdDbId,
|
||||||
|
(p, e) => p)
|
||||||
|
.Distinct()
|
||||||
|
.Include(j => j.ProjListNav)
|
||||||
|
.OrderByDescending(x => x.ProdId)
|
||||||
|
.Take(NumRecord)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// recupero i proj "orfani"
|
||||||
|
dbResultProj = localDbCtx
|
||||||
|
.ProjList
|
||||||
|
.Where(x =>
|
||||||
|
(x.IsActive || !OnlyActive)
|
||||||
|
&& x.Prod == null
|
||||||
|
&& (string.IsNullOrEmpty(Machine) || x.Machine.ToLower().Contains(Machine.ToLower()))
|
||||||
|
&& (string.IsNullOrEmpty(BtlFileName) || x.BTLFileName.ToLower().Contains(BtlFileName.ToLower()))
|
||||||
|
&& (string.IsNullOrEmpty(ListName) || x.ListName.ToLower().Contains(ListName.ToLower()))
|
||||||
|
&& ((DtIsCreation && (x.DtCreated >= DtStart && x.DtCreated <= DtEnd)) || (!DtIsCreation && (x.DtExported >= DtStart && x.DtExported <= DtEnd))))
|
||||||
|
.OrderByDescending(x => x.ProjId)
|
||||||
|
.Take(NumRecord)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
// conversione
|
||||||
|
result = dbResultProd.Select(x => coreItemConv(x)).ToList();
|
||||||
|
var resProj = dbResultProj.Select(x => coreItemConv(x)).ToList();
|
||||||
|
// sommo i risultati
|
||||||
|
result.AddRange(resProj);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
|
/// Fornisce nuovo indice VUOTO da usare (allocando sul DB)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -910,6 +1088,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
protected Core.ProdFileM coreConv(ProdModel currProd)
|
protected Core.ProdFileM coreConv(ProdModel currProd)
|
||||||
{
|
{
|
||||||
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived);
|
Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived);
|
||||||
|
//Core.ProdFileM answ = Core.ProdFileM.CreateProdFileM(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjListNav.Select(j => Core.ProjFileM.CreateProjFileM(j.ProjId, currProd.ProdId, j.DtCreated, j.DtExported, j.ListName, j.BTLFileName, j.ProjDescription, j.IsNew, j.Locked, j.PType, j.Machine, j.IsActive, j.IsActive)).ToList());
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper conversione modelli verso prodItem
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currProd"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected Core.ProdItem coreItemConv(ProdModel currProd)
|
||||||
|
{
|
||||||
|
Core.ProdItem answ = Core.ProdItem.CreateProdItem(currProd.ProdId, ProjIdByProd(currProd.ProdId), currProd.DtCreated, currProd.Description, currProd.PType, currProd.Machine, currProd.LockedBy, currProd.LockDate, currProd.IsActive, currProd.IsProduced, currProd.IsArchived, currProd.ProjListNav.Select(j => Core.ProjFileM.CreateProjFileM(j.ProjId, currProd.ProdId, j.DtCreated, j.DtExported, j.ListName, j.BTLFileName, j.ProjDescription, j.IsNew, j.Locked, j.PType, j.Machine, j.IsActive, j.IsActive)).ToList());
|
||||||
|
return answ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper conversione modelli verso prodItem da singolo proj
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currProd"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected Core.ProdItem coreItemConv(ProjModel currProj)
|
||||||
|
{
|
||||||
|
Core.ProdItem answ = Core.ProdItem.CreateProdItem(Core.ProjFileM.CreateProjFileM(currProj.ProjId, 0, currProj.DtCreated, currProj.DtExported, currProj.ListName, currProj.BTLFileName, currProj.ProjDescription, currProj.IsNew, currProj.Locked, currProj.PType, currProj.Machine, currProj.IsActive, currProj.IsActive));
|
||||||
return answ;
|
return answ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
var dbResult = localDbCtx
|
var dbResult = localDbCtx
|
||||||
.ProjList
|
.ProjList
|
||||||
.Where(x => x.BTLFileName == BTLFileName)
|
.Where(x => x.BTLFileName == BTLFileName)
|
||||||
|
//valutare se usare solo attivi...
|
||||||
|
//.Where(x => x.BTLFileName == BTLFileName && x.IsActive == true)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
//se avesse trovato-- > riporto id...
|
//se avesse trovato-- > riporto id...
|
||||||
@@ -581,7 +583,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
|||||||
/// Update record su DB x elenco BTLParts
|
/// Update record su DB x elenco BTLParts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ProjId"></param>
|
/// <param name="ProjId"></param>
|
||||||
/// <param name="newBTLFileName"></param>
|
/// <param name="BtlPartList"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ProjModel UpdateBtlParts(int ProjId, List<Core.BTLPartM> BtlPartList)
|
public ProjModel UpdateBtlParts(int ProjId, List<Core.BTLPartM> BtlPartList)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
|||||||
{
|
{
|
||||||
#region Public Properties
|
#region Public Properties
|
||||||
|
|
||||||
|
public ProdModel()
|
||||||
|
{
|
||||||
|
ProjListNav = new HashSet<ProjModel>();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Chiave univoca DB
|
/// Chiave univoca DB
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -98,6 +103,11 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
|||||||
[Column("IsArchived")]
|
[Column("IsArchived")]
|
||||||
public bool IsArchived { get; set; } = false;
|
public bool IsArchived { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Collezione oggetti Proj associati (almeno 1 by design)
|
||||||
|
/// </summary>
|
||||||
|
public virtual ICollection<ProjModel> ProjListNav { get; set; }
|
||||||
|
|
||||||
#endregion Public Properties
|
#endregion Public Properties
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,13 +11,14 @@ Public Class OpenProjectFileDialogVM
|
|||||||
|
|
||||||
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||||
m_ProjectType = ProjectType
|
m_ProjectType = ProjectType
|
||||||
|
m_GoToProd = GoToProd
|
||||||
' carico colonne
|
' carico colonne
|
||||||
LoadColumns(m_ProjectType)
|
LoadColumns(m_ProjectType)
|
||||||
NotifyPropertyChanged(NameOf(FilterTypeList))
|
NotifyPropertyChanged(NameOf(FilterTypeList))
|
||||||
m_SelFilterType = m_FilterTypeList(0)
|
m_SelFilterType = m_FilterTypeList(0)
|
||||||
' carico lista progetti
|
' carico lista progetti
|
||||||
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
|
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
|
||||||
RefreshProjectList(GoToProd)
|
RefreshProjectList()
|
||||||
Else
|
Else
|
||||||
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
|
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
|
||||||
NotifyPropertyChanged(NameOf(ProjectList))
|
NotifyPropertyChanged(NameOf(ProjectList))
|
||||||
@@ -26,7 +27,7 @@ Public Class OpenProjectFileDialogVM
|
|||||||
m_ProjectList_View.Filter = AddressOf ProjectFilter
|
m_ProjectList_View.Filter = AddressOf ProjectFilter
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Overrides Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
Public Overrides Sub RefreshProjectList()
|
||||||
m_ProjectList.Clear()
|
m_ProjectList.Clear()
|
||||||
' calcolo periodo e righe
|
' calcolo periodo e righe
|
||||||
Dim dtStart As DateTime
|
Dim dtStart As DateTime
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Public Class NewOpenProjectFileDialogVM
|
|||||||
|
|
||||||
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||||
m_ProjectType = ProjectType
|
m_ProjectType = ProjectType
|
||||||
|
ProdItem.m_delUpdateNameInDb = AddressOf DbControllers.m_ProdController.UpdateDescription
|
||||||
|
|
||||||
NotifyPropertyChanged(NameOf(FilterTypeList))
|
NotifyPropertyChanged(NameOf(FilterTypeList))
|
||||||
m_SelFilterType = m_FilterTypeList(0)
|
m_SelFilterType = m_FilterTypeList(0)
|
||||||
@@ -250,33 +251,3 @@ Public Class NewOpenProjectFileDialogVM
|
|||||||
#End Region ' METHODS
|
#End Region ' METHODS
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Public Class ProdItem
|
|
||||||
Inherits Core.ProdItem
|
|
||||||
|
|
||||||
Public Overrides Property sName As String
|
|
||||||
Get
|
|
||||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sName, "")
|
|
||||||
End Get
|
|
||||||
Set(value As String)
|
|
||||||
If Not IsNothing(m_ProdFileVM) Then
|
|
||||||
DbControllers.m_ProdController.UpdateDescription(m_ProdFileVM.nProdId, value)
|
|
||||||
m_ProdFileVM.sName = value
|
|
||||||
m_delIsModifiedSetUp(False)
|
|
||||||
End If
|
|
||||||
End Set
|
|
||||||
End Property
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -12,6 +12,7 @@ Public Class OpenProjectFileDialogVM
|
|||||||
|
|
||||||
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
Public Overrides Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||||
m_ProjectType = ProjectType
|
m_ProjectType = ProjectType
|
||||||
|
m_GoToProd = GoToProd
|
||||||
' carico colonne
|
' carico colonne
|
||||||
LoadColumns(ProjectType)
|
LoadColumns(ProjectType)
|
||||||
NotifyPropertyChanged(NameOf(FilterTypeList))
|
NotifyPropertyChanged(NameOf(FilterTypeList))
|
||||||
@@ -19,7 +20,7 @@ Public Class OpenProjectFileDialogVM
|
|||||||
' carico lista progetti
|
' carico lista progetti
|
||||||
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
|
If IsNothing(CurrProjectList) OrElse CurrProjectList.Count = 0 Then
|
||||||
SetFixedProjectList(False)
|
SetFixedProjectList(False)
|
||||||
RefreshProjectList(GoToProd)
|
RefreshProjectList()
|
||||||
Else
|
Else
|
||||||
SetFixedProjectList(True)
|
SetFixedProjectList(True)
|
||||||
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
|
m_ProjectList = New ObservableCollection(Of ProjectFileVM)(CurrProjectList)
|
||||||
@@ -29,7 +30,7 @@ Public Class OpenProjectFileDialogVM
|
|||||||
m_ProjectList_View.Filter = AddressOf ProjectFilter
|
m_ProjectList_View.Filter = AddressOf ProjectFilter
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Overrides Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
Public Overrides Sub RefreshProjectList()
|
||||||
m_ProjectList.Clear()
|
m_ProjectList.Clear()
|
||||||
' calcolo periodo e righe
|
' calcolo periodo e righe
|
||||||
Dim dtStart As DateTime
|
Dim dtStart As DateTime
|
||||||
@@ -66,30 +67,15 @@ Public Class OpenProjectFileDialogVM
|
|||||||
Else
|
Else
|
||||||
DbProjectList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity, False)
|
DbProjectList = DbControllers.m_ProjController.GetLastByExpDesc(dtStart, dtEnd, nRowQuantity, False)
|
||||||
End If
|
End If
|
||||||
For Each Project In DbProjectList
|
If m_GoToProd Then
|
||||||
' 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
|
For Each Project In DbProjectList
|
||||||
' recupero path per verificare esista
|
' recupero path per verificare esista
|
||||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
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"
|
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||||
If Project.sMachine = Map.refProjManagerVM.CurrProj.sMachine AndAlso
|
If Project.sMachine = Map.refProjManagerVM.CurrProj.sMachine AndAlso
|
||||||
Project.nType = Map.refProjManagerVM.CurrProj.nType Then
|
Project.nType = Map.refProjManagerVM.CurrProj.nType Then
|
||||||
If File.Exists(sPath) Then
|
If File.Exists(sPath) Then
|
||||||
m_ProjectList.Add(New ProdFileVM(Project))
|
m_ProjectList.Add(New ProjFileVM(Project))
|
||||||
Else
|
Else
|
||||||
DbControllers.m_ProdController.DeleteProd(Project.nProdId, True)
|
DbControllers.m_ProdController.DeleteProd(Project.nProdId, True)
|
||||||
EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
||||||
@@ -99,16 +85,31 @@ Public Class OpenProjectFileDialogVM
|
|||||||
Else
|
Else
|
||||||
For Each Project In DbProjectList
|
For Each Project In DbProjectList
|
||||||
' recupero path per verificare esista
|
' recupero path per verificare esista
|
||||||
If IsNothing(Project.nProdId) OrElse Project.nProdId = 0 Then Continue For
|
If IsNothing(Project.nProjId) OrElse Project.nProjId = 0 Then Continue For
|
||||||
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProdsDir & "\" & Project.nProdId.ToString("0000") & "\" & Project.nProdId.ToString("0000") & ".nge"
|
Dim sPath As String = Map.refMainWindowVM.MainWindowM.sProjsDir & "\" & Project.nProjId.ToString("0000") & "\" & Project.nProjId.ToString("0000") & ".nge"
|
||||||
If File.Exists(sPath) Then
|
If File.Exists(sPath) Then
|
||||||
m_ProjectList.Add(New ProdFileVM(Project))
|
m_ProjectList.Add(New ProjFileVM(Project))
|
||||||
Else
|
Else
|
||||||
DbControllers.m_ProdController.DeleteProd(Project.nProdId, True)
|
' CheckMe impostata come cancellazione FISICA dal DB...
|
||||||
EgtOutLog("Found project on Db without the folder and erased it! Prod number " & Project.nProdId.ToString("0000"))
|
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
|
End If
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||||
|
Dim DbProjectList As New List(Of ProdFileM)
|
||||||
|
DbProjectList = DbControllers.m_ProdController.GetLastDesc(dtStart, dtEnd, nRowQuantity, True)
|
||||||
|
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, True)
|
||||||
|
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
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@@ -68,8 +68,6 @@ Public Module DbControllers
|
|||||||
DataLayer.DbConfig.CheckMigrateDb()
|
DataLayer.DbConfig.CheckMigrateDb()
|
||||||
DataLayer.DbConfig.CheckUser(sUser, sPwd, m_bNetwork AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK))
|
DataLayer.DbConfig.CheckUser(sUser, sPwd, m_bNetwork AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK))
|
||||||
DataLayer.DbConfig.CheckViews(sUser, sPwd)
|
DataLayer.DbConfig.CheckViews(sUser, sPwd)
|
||||||
' riattivare il dump per il backup
|
|
||||||
'DataLayer.DbConfig.DumpDB("C:\Program Files\MariaDB 10.5\bin\mysqldump", "c:\Temp\Pippo.sql")
|
|
||||||
If m_bNetwork AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK) Then
|
If m_bNetwork AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK) Then
|
||||||
' imposto cartella condivisa
|
' imposto cartella condivisa
|
||||||
GetMainPrivateProfileString(S_GENERAL, K_SHAREDFOLDER, Map.refMainWindowVM.MainWindowM.sDataDir, sSharedFolder)
|
GetMainPrivateProfileString(S_GENERAL, K_SHAREDFOLDER, Map.refMainWindowVM.MainWindowM.sDataDir, sSharedFolder)
|
||||||
|
|||||||
Reference in New Issue
Block a user