Files
icarus/Icarus/Utility/DbControllers.vb
Emmanuele Sassi 0532c0c486 - cambio nome del progetto in Icarus
- gestione ribs completata
- nuove funzionalita' introdotte su tabella TFS
- correzioni e migliorie varie
2022-09-08 17:36:35 +02:00

68 lines
2.7 KiB
VB.net

Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.ViewerOptimizer
Public Module DbControllers
Friend m_SupervisorId As String = "1"
Public m_ProjController As DataLayer.Controllers.ProjController
Public m_ProdController As DataLayer.Controllers.ProdController
Public m_MachGroupController As DataLayer.Controllers.MachGroupController
Public m_StatusMapController As DataLayer.Controllers.StatusMapController
Public m_PartController As DataLayer.Controllers.PartController
Sub Init()
End Sub
Sub New()
' se demo--> server = db.steamware.net, nKey e sKey come le hai...
Dim sKey = "", sUser = "", sPwd = ""
EgtGetKeyInfo(sKey)
sKey = sKey.Replace(" ", "")
If Not IsNothing(sKey) AndAlso sKey.Length > 11 Then
sUser = sKey.Substring(3, 6)
sPwd = sKey.Substring(10, sKey.Length - 10).Replace("(", "").Replace(")", "")
End If
Try
Dim DbAddress As String = "127.0.0.1"
Dim DbMasterKey As Integer = 0
Dim sDbMasterKey As String = ""
If Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK) Then
GetMainPrivateProfileString(S_GENERAL, K_DBADDRESS, "127.0.0.1", DbAddress)
DbMasterKey = GetMainPrivateProfileInt(S_GENERAL, K_DBMASTERKEY, 0)
If DbMasterKey > 0 Then
sDbMasterKey = DbMasterKey.ToString("000000")
End If
If String.IsNullOrWhiteSpace(DbAddress) OrElse DbMasterKey <= 0 Then
DbAddress = "127.0.0.1"
DbMasterKey = 0
End If
End If
DataLayer.DbConfig.InitDb(DbAddress, sUser, sPwd, sDbMasterKey)
DataLayer.DbConfig.CheckUser(sUser, sPwd, Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK))
Catch ex As Exception
EgtOutLog("InitDb error: " & ex.ToString())
MessageBox.Show(Application.Current.MainWindow, "Db connection error!!", "Error")
End
End Try
If Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NETWORK) Then
Dim sSupervisorMachName As String = ""
GetMainPrivateProfileString(S_MACH, K_SUPERVISORMACH, "", sSupervisorMachName)
If Not String.IsNullOrWhiteSpace(sSupervisorMachName) Then m_SupervisorId = sSupervisorMachName
End If
m_ProjController = New DataLayer.Controllers.ProjController
m_ProdController = New DataLayer.Controllers.ProdController
m_MachGroupController = New DataLayer.Controllers.MachGroupController
m_StatusMapController = New DataLayer.Controllers.StatusMapController
m_PartController = New DataLayer.Controllers.PartController
End Sub
End Module