From f4e97d4bae257d05eeb5c557c9e8d15bbd384e38 Mon Sep 17 00:00:00 2001 From: RenzoL Date: Mon, 7 Feb 2022 17:30:47 +0100 Subject: [PATCH] - Invio Feedback ora utilizza l'applicativo LiMan per il trasferimento dei file (dati contatto scritti nel codice per ora, a fini di testing) --- EgtBEAMWALL.Core/Constants/ConstGen.vb | 2 + EgtBEAMWALL.Core/Constants/ConstIni.vb | 1 + .../EgtBEAMWALL.SupportRequest.csproj | 11 + EgtBEAMWALL.SupportRequest/SupportRequest.cs | 89 +++++++ .../EgtBEAMWALL.ViewerOptimizer.vbproj | 4 + .../MainMenu/MainMenuVM.vb | 226 +++++++++++++----- .../MainWindow/MainWindowM.vb | 8 + EgtBEAMWALL.sln | 32 +++ LiMan.Core/LiMan.Core.csproj | 54 +++++ LiMan.Core/Properties/AssemblyInfo.cs | 36 +++ LiMan.Core/SupportRequest.cs | 90 +++++++ LiMan.Core/packages.config | 4 + 12 files changed, 501 insertions(+), 56 deletions(-) create mode 100644 EgtBEAMWALL.SupportRequest/EgtBEAMWALL.SupportRequest.csproj create mode 100644 EgtBEAMWALL.SupportRequest/SupportRequest.cs create mode 100644 LiMan.Core/LiMan.Core.csproj create mode 100644 LiMan.Core/Properties/AssemblyInfo.cs create mode 100644 LiMan.Core/SupportRequest.cs create mode 100644 LiMan.Core/packages.config diff --git a/EgtBEAMWALL.Core/Constants/ConstGen.vb b/EgtBEAMWALL.Core/Constants/ConstGen.vb index b0a6b75b..c03e87c8 100644 --- a/EgtBEAMWALL.Core/Constants/ConstGen.vb +++ b/EgtBEAMWALL.Core/Constants/ConstGen.vb @@ -75,6 +75,8 @@ Public Module ConstGen Public Const SETUP_LUA As String = "SetUp.lua" ' Nome eseguibile per stampa Public Const ZEBRAPRINTER_EXE As String = "ZebraPrinterUtilitiesD32.exe" + ' Nome eseguibile per applicativo di invio feedback + Public Const LIMANTRANSFER_EXE As String = "LiMan.Transfer.exe" ' Sottodirettorio di default per macro Public Const MACRO_DFL_DIR As String = "Macro" diff --git a/EgtBEAMWALL.Core/Constants/ConstIni.vb b/EgtBEAMWALL.Core/Constants/ConstIni.vb index 777f449b..164a2299 100644 --- a/EgtBEAMWALL.Core/Constants/ConstIni.vb +++ b/EgtBEAMWALL.Core/Constants/ConstIni.vb @@ -37,6 +37,7 @@ Public Module ConstIni 'Public Const K_SUPPORT As String = "Support" Public Const K_WAREHOUSE As String = "Warehouse" Public Const K_DBADDRESS As String = "DbAddress" + Public Const K_LIMANUTILITIES As String = "LiManUtilities" 'Public Const S_LANGUAGES As String = "Languages" 'Public Const K_LANGUAGE As String = "Language" diff --git a/EgtBEAMWALL.SupportRequest/EgtBEAMWALL.SupportRequest.csproj b/EgtBEAMWALL.SupportRequest/EgtBEAMWALL.SupportRequest.csproj new file mode 100644 index 00000000..2f38174d --- /dev/null +++ b/EgtBEAMWALL.SupportRequest/EgtBEAMWALL.SupportRequest.csproj @@ -0,0 +1,11 @@ + + + + netcoreapp3.1 + + + + + + + diff --git a/EgtBEAMWALL.SupportRequest/SupportRequest.cs b/EgtBEAMWALL.SupportRequest/SupportRequest.cs new file mode 100644 index 00000000..e978466d --- /dev/null +++ b/EgtBEAMWALL.SupportRequest/SupportRequest.cs @@ -0,0 +1,89 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EgtBEAMWALL.SupportRequest +{ + public class SupportRequest + { + #region Public Properties + + public string CodApp { get; set; } = ""; + public string CodImp { get; set; } = ""; + public string CodInst { get; set; } = ""; + public string ContactEmail { get; set; } = ""; + public string ContactName { get; set; } = ""; + public string ContactPhone { get; set; } = ""; + public int idxSubLic { get; set; } = 0; + + public TipologiaTicket Tipo { get; set; } = TipologiaTicket.ND; + + public bool IsValid + { + get => !string.IsNullOrEmpty(MasterKey) && !string.IsNullOrEmpty(ContactEmail) && !string.IsNullOrEmpty(CodInst) && !string.IsNullOrEmpty(CodApp); + } + + public string MasterKey { get; set; } = ""; + public string ReqBody { get; set; } = ""; + + /// + /// Istanzia un nuovo ogetto richeista supporto + /// + /// Codice Applicazione (es EBW-UP) + /// Codice Impegno (es codice chiave HW) + /// Codice Cliente/Installazione + /// Email x contatto + /// Nome del richiedente/clietne + /// Tel richeidente/cliente + /// Chiave master di comunicazione da LiMan + /// Testo delal richiesta + /// Idx univoco di sublic (es x gestione utenti) + /// tipo ticket da gestire (default fileUpload) + public SupportRequest(string codApp, string codImp, string codInst, string contactEmail, string contactName, string contactPhone, string masterKey, string ReqBody, int idxSubLic = 0, TipologiaTicket tipo = TipologiaTicket.FileUpload) + { + this.CodApp = CodApp; + this.CodImp = CodImp; + this.CodInst = CodInst; + this.ContactEmail = contactEmail; + this.ContactName = contactName; + this.ContactPhone = contactPhone; + this.MasterKey = masterKey; + this.ReqBody = ReqBody; + this.idxSubLic = idxSubLic; + this.Tipo = tipo; + } + + /// + /// Effettua salvataggio su file di un oggetto richiesta file upload + /// + /// Oggetto richiesta (già istanziato) + /// Path dove salvare il file + public static bool SaveRequest(SupportRequest currReq, string filePath) + { + bool fatto = false; + try + { + string rawData = JsonConvert.SerializeObject(currReq, Formatting.Indented); + File.WriteAllText(filePath, rawData); + fatto = true; + } + catch (Exception ex) + { + Console.Write(ex.ToString()); + } + return fatto; + } + + #endregion Public Properties + } + + public enum TipologiaTicket : int { + ND = 0, + FileUpload = 2 + } + +} \ No newline at end of file diff --git a/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj b/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj index 30e2a902..1309eec5 100644 --- a/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj +++ b/EgtBEAMWALL.ViewerOptimizer/EgtBEAMWALL.ViewerOptimizer.vbproj @@ -697,6 +697,10 @@ {24d7760e-662a-47e4-b729-b70126c24a31} EgtBEAMWALL.DataLayer + + {b61508b2-20cb-45d9-8c00-209a22c44de5} + LiMan.Core + diff --git a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb index 30c07955..e440adbc 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MainMenu/MainMenuVM.vb @@ -1,17 +1,21 @@ Imports System.Collections.ObjectModel Imports System.IO Imports System.Runtime.InteropServices +Imports System.Windows.Threading Imports EgtBEAMWALL.Core Imports EgtBEAMWALL.Core.ConstBeam Imports EgtBEAMWALL.DataLayer.DatabaseModels Imports EgtUILib Imports EgtWPFLib5 +Imports LiMan.Core Public Class MainMenuVM Inherits VMBase #Region "FIELDS & PROPERTIES" + Private m_LiManTimer As New DispatcherTimer + Private m_MainMenu_IsEnabled As Boolean = True Public ReadOnly Property MainMenu_IsEnabled As Boolean Get @@ -162,6 +166,8 @@ Public Class MainMenuVM Sub New() ' Creo riferimento a questa classe in EgtCAM5Map Map.SetRefMainMenuVM(Me) + m_LiManTimer.Interval = TimeSpan.FromMilliseconds(1000) + AddHandler m_LiManTimer.Tick, AddressOf LiManTimer_Tick End Sub #End Region ' CONSTRUCTOR @@ -463,6 +469,7 @@ Public Class MainMenuVM MessageBox.Show(EgtMsg(61891), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error) Return End If + Dim FileToSendList As New List(Of String) ' Recupero indirizzo a cui spedire la mail Dim sSupportAddress As String = String.Empty GetMainPrivateProfileString(S_GENERAL, K_SUPPORT, "support@egaltech.com", sSupportAddress) @@ -499,48 +506,19 @@ Public Class MainMenuVM End If Dim sExportFileName = Map.refProjManagerVM.CurrProj.nProjId.ToString("0000") & " - " & Map.refProjManagerVM.CurrProj.sBTLFileName & " - ProjectExport" Dim sExpZipToCreate = Map.refProjManagerVM.ExportProject(sExportFileName) - ' Creo zip file da allegare - Dim sZipToCreate As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\Feedback.zip" - If File.Exists(sZipToCreate) Then - File.Delete(sZipToCreate) + + + ' creo zip del progetto esportato, BTLFeatures.ini e Log + Dim sExpAndMoreZipToCreate As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\" & sExportFileName & " and more.zip" + If File.Exists(sExpAndMoreZipToCreate) Then + File.Delete(sExpAndMoreZipToCreate) End If Try - Using zip As New Ionic.Zip.ZipFile(sZipToCreate, Console.Out) + Using zip As New Ionic.Zip.ZipFile(sExpAndMoreZipToCreate, Console.Out) ' aggiungo progetto esportato If File.Exists(sExpZipToCreate) Then zip.AddItem(sExpZipToCreate, "") End If - ' aggiungo Prod e Proj associati - Dim ProdId As Integer - Select Case Map.refMainMenuVM.SelPage - Case Pages.VIEW - ProdId = Map.refProjManagerVM.CurrProj.nProdId - Case Pages.MACHINING - ProdId = Map.refProdManagerVM.CurrProd.nProdId - End Select - If ProdId = 0 Then - zip.AddItem(Map.refProjManagerVM.CurrProj.sProjDirPath, "Projs\" & Map.refProjManagerVM.CurrProj.nProjId.ToString("0000")) - Else - ProjFileMList = DbControllers.m_ProjController.GetByProdAsc(ProdId) - ' se piu' di uno - If IsNothing(ProjFileMList) Then - Return - ElseIf ProjFileMList.Count > 0 Then - Dim ProjFileVMList As New List(Of ProjectFileVM) - For Each Project In ProjFileMList - ProjFileVMList.Add(New ProjFileVM(Project)) - Next - For Each ProjFileVMItem In ProjFileVMList - zip.AddItem(ProjFileVMItem.sProjDirPath, "Projs\" & ProjFileVMItem.nProjId.ToString("0000")) - Next - zip.AddItem(ProjFileVMList(0).sProdDirPath, "Prods\" & ProjFileVMList(0).nProdId.ToString("0000")) - End If - End If - ' aggiungo cartella macchina del progetto - Dim sMachineDir As String = Map.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sMachineName - If Directory.Exists(sMachineDir) Then - zip.AddItem(sMachineDir, sMachineName) - End If ' aggiungo file log If File.Exists(Map.refMainWindowVM.MainWindowM.sLogFile) Then zip.AddItem(Map.refMainWindowVM.MainWindowM.sLogFile, "") @@ -552,30 +530,166 @@ Public Class MainMenuVM ' salvo lo zip zip.Save() End Using + FileToSendList.Add(sExpAndMoreZipToCreate) + + ' creo zip della cartella macchina + Dim sMachineZipToCreate As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\" & sMachineName & ".zip" + If File.Exists(sMachineZipToCreate) Then + File.Delete(sMachineZipToCreate) + End If + Using zip As New Ionic.Zip.ZipFile(sMachineZipToCreate, Console.Out) + ' aggiungo cartella macchina del progetto + Dim sMachineDir As String = Map.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sMachineName + If Directory.Exists(sMachineDir) Then + zip.AddItem(sMachineDir, sMachineName) + End If + ' salvo lo zip + zip.Save() + End Using + FileToSendList.Add(sMachineZipToCreate) + + ' aggiungo Prod e Proj associati + Dim ProdId As Integer + Select Case Map.refMainMenuVM.SelPage + Case Pages.VIEW + ProdId = Map.refProjManagerVM.CurrProj.nProdId + Case Pages.MACHINING + ProdId = Map.refProdManagerVM.CurrProd.nProdId + End Select + If ProdId = 0 Then + ' Creo zip del Proj + Dim sProjZipToCreate As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\Projs.zip" + If File.Exists(sProjZipToCreate) Then + File.Delete(sProjZipToCreate) + End If + ' aggiungo lo zip del solo Proj + Using zip As New Ionic.Zip.ZipFile(sProjZipToCreate, Console.Out) + zip.AddItem(Map.refProjManagerVM.CurrProj.sProjDirPath, "Projs\" & Map.refProjManagerVM.CurrProj.nProjId.ToString("0000")) + ' salvo lo zip + zip.Save() + End Using + FileToSendList.Add(sProjZipToCreate) + Else + ProjFileMList = DbControllers.m_ProjController.GetByProdAsc(ProdId) + ' se piu' di uno + If IsNothing(ProjFileMList) Then + Return + ElseIf ProjFileMList.Count > 0 Then + Dim ProjFileVMList As New List(Of ProjectFileVM) + For Each Project In ProjFileMList + ProjFileVMList.Add(New ProjFileVM(Project)) + Next + ' prima creo zip del Proj + Dim sProjZipToCreate As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\Projs.zip" + If File.Exists(sProjZipToCreate) Then + File.Delete(sProjZipToCreate) + End If + ' aggiungo lo zip del Proj riempiendolo con tutti i Proj associati + Using zip As New Ionic.Zip.ZipFile(sProjZipToCreate, Console.Out) + For Each ProjFileVMItem In ProjFileVMList + zip.AddItem(ProjFileVMItem.sProjDirPath, "Projs\" & ProjFileVMItem.nProjId.ToString("0000")) + Next + ' salvo lo zip + zip.Save() + End Using + FileToSendList.Add(sProjZipToCreate) + ' ora creo zip del Prod + Dim sProdZipToCreate As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\Prods.zip" + If File.Exists(sProdZipToCreate) Then + File.Delete(sProdZipToCreate) + End If + ' ora aggiungo lo zip del Prod + Using zip As New Ionic.Zip.ZipFile(sProdZipToCreate, Console.Out) + zip.AddItem(ProjFileVMList(0).sProdDirPath, "Prods\" & ProjFileVMList(0).nProdId.ToString("0000")) + ' salvo lo zip + zip.Save() + End Using + FileToSendList.Add(sProdZipToCreate) + End If + End If Catch ex1 As Exception EgtOutLog("Exception in zip: " & ex1.ToString()) End Try - ' preparo la mail per il supporto - Dim bEx As Boolean = False - Try - Dim sAddressArray As String() = sSupportAddress.Split(CType(",", Char())) - Dim SendFeedbackWindow As New EgtWPFLib5.MapiMailMessage("EgtBEAMWALL Feedback - " & sKey) - SendFeedbackWindow.Recipients.Add(sAddressArray(0)) - For index As Integer = 1 To sAddressArray.Length() - 1 - SendFeedbackWindow.Recipients.Add(sAddressArray(index), EgtWPFLib5.MapiMailMessage.RecipientType.CC) + + ' Codice Applicazione (es EBW-UP) + ' Codice Impegno (es codice chiave HW) + ' Codice Cliente/Installazione + ' Email x contatto + ' Nome del richiedente/clietne + ' Tel richeidente/cliente + ' Chiave master di comunicazione da LiMan + ' Testo delal richiesta + ' Idx univoco di sublic (es x gestione utenti) + ' tipo ticket da gestire (Default fileUpload) + + ' recuperare codice chiave SW/HW + ' recuperare contatti cliente + + Dim sp As SupportRequest = New SupportRequest("Uploader", + "", + "EgalWare", + "info@egalware.com", + "Utente", + "035-460560", + "4AIc8fMEXcSyDIMl1Ro05O/1xar7nrVHXAQzrh/fmxfvlczA13tQwXAqida6hTqV", + "Upload da sendlog di EGT BeamWall", + 0, + TipologiaTicket.FileUpload) + + ' specifico le cartelle Data (da cui prendere i file) e Archive (in cui archiviare i file) + Dim sDataFolderPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\Data" + Dim sArchiveFolderPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\Archive" + ' creo le cartelle + DeleteDirectory(sDataFolderPath) + Directory.CreateDirectory(sDataFolderPath) + If Not Directory.Exists(sArchiveFolderPath) Then + Directory.CreateDirectory(sArchiveFolderPath) + End If + ' muovo zip e json nella cartella Data + For Each FileName In FileToSendList + Dim mFile As FileInfo = New FileInfo(FileName) + mFile.MoveTo(sDataFolderPath & "\" & mFile.Name) + Next + SupportRequest.SaveRequest(sp, sDataFolderPath & "\request.json") + + ' eseguo LiMan Transfer con le 2 cartelle come argomenti + Dim Proc = New Process() + Proc.StartInfo.FileName = "C:\EgwProg\LiManTransfer\win-x86\" & Map.refMainWindowVM.MainWindowM.sLiManTransferExe + Proc.StartInfo.Arguments = sDataFolderPath & " " & sArchiveFolderPath + Proc.StartInfo.CreateNoWindow = True + Proc.StartInfo.UseShellExecute = False + AddHandler Proc.Exited, AddressOf Proc_Exited + + For Inde = 0 To 100 + If Not m_LiManTimer.IsEnabled Then Exit For + Threading.Thread.Sleep(100) + Next + If Not m_LiManTimer.IsEnabled AndAlso Proc.Start() Then + m_LiManTimer.Start() + End If + End Sub + + Private Sub Proc_Exited() + m_LiManTimer.Stop() + End Sub + + Private Sub LiManTimer_Tick() + m_LiManTimer.Stop() + EgtOutLog("LiMan Transfer timeout!") + End Sub + + Private Sub DeleteDirectory(path As String) + If Directory.Exists(path) Then + 'Delete all files from the Directory + For Each filepath As String In Directory.GetFiles(path) + File.Delete(filepath) Next - If Not String.IsNullOrWhiteSpace(sZipToCreate) AndAlso File.Exists(sZipToCreate) Then - SendFeedbackWindow.Files.Add(Map.refMainWindowVM.MainWindowM.sTempDir & "\Feedback.zip") - End If - SendFeedbackWindow.ShowDialog() - Catch ex As Exception - EgtOutLog("Feedback exception: " & ex.ToString) - bEx = True - End Try - If bEx OrElse EgtWPFLib5.MapiMailMessage.m_ErrorCode <> 0 Then - MessageBox.Show(String.Format(EgtMsg(MSG_TOPCOMMANDBAR + 12), sSupportAddress, sZipToCreate), EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK, MessageBoxImage.Information) - Else - Map.refMyStatusBarVM.SetOutputMessage(EgtMsg(MSG_TOPCOMMANDBAR + 14)) + 'Delete all child Directories + For Each dir As String In Directory.GetDirectories(path) + DeleteDirectory(dir) + Next + 'Delete a Directory + Directory.Delete(path) End If End Sub diff --git a/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowM.vb b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowM.vb index c0cdbbf8..cb65169d 100644 --- a/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowM.vb +++ b/EgtBEAMWALL.ViewerOptimizer/MainWindow/MainWindowM.vb @@ -152,6 +152,14 @@ Public Class MainWindowM End Get End Property + Friend ReadOnly Property sLiManTransferExe As String + Get + Dim sTransferExe As String = "" + GetMainPrivateProfileString(S_GENERAL, K_ZEBRAUTILITIES, LIMANTRANSFER_EXE, sTransferExe) + Return sTransferExe + End Get + End Property + #End Region ' FIELDS #Region "CONSTRUCTOR" diff --git a/EgtBEAMWALL.sln b/EgtBEAMWALL.sln index 61faa098..499eb54e 100644 --- a/EgtBEAMWALL.sln +++ b/EgtBEAMWALL.sln @@ -11,46 +11,78 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgtBEAMWALL.DataLayer", "Eg EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EgtBEAMWALL.Core", "EgtBEAMWALL.Core\EgtBEAMWALL.Core.vbproj", "{F22835A1-83D8-4334-91BB-BAAEB9CF59B1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiMan.Core", "LiMan.Core\LiMan.Core.csproj", "{B61508B2-20CB-45D9-8C00-209A22C44DE5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|Any CPU.Build.0 = Debug|Any CPU {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x64.ActiveCfg = Debug|x64 {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x64.Build.0 = Debug|x64 {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x86.ActiveCfg = Debug|x86 {57291955-F9C4-4466-8D53-476D43BA3659}.Debug|x86.Build.0 = Debug|x86 + {57291955-F9C4-4466-8D53-476D43BA3659}.Release|Any CPU.ActiveCfg = Release|Any CPU + {57291955-F9C4-4466-8D53-476D43BA3659}.Release|Any CPU.Build.0 = Release|Any CPU {57291955-F9C4-4466-8D53-476D43BA3659}.Release|x64.ActiveCfg = Release|x64 {57291955-F9C4-4466-8D53-476D43BA3659}.Release|x64.Build.0 = Release|x64 {57291955-F9C4-4466-8D53-476D43BA3659}.Release|x86.ActiveCfg = Release|x86 {57291955-F9C4-4466-8D53-476D43BA3659}.Release|x86.Build.0 = Release|x86 + {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|Any CPU.Build.0 = Debug|Any CPU {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x64.ActiveCfg = Debug|x64 {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x64.Build.0 = Debug|x64 {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x86.ActiveCfg = Debug|x86 {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Debug|x86.Build.0 = Debug|x86 + {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|Any CPU.Build.0 = Release|Any CPU {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x64.ActiveCfg = Release|x64 {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x64.Build.0 = Release|x64 {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x86.ActiveCfg = Release|x86 {B71DA327-38C8-4305-BBA1-34F3F3F32405}.Release|x86.Build.0 = Release|x86 + {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|Any CPU.Build.0 = Debug|Any CPU {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x64.ActiveCfg = Debug|Any CPU {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x64.Build.0 = Debug|Any CPU {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x86.ActiveCfg = Debug|Any CPU {24D7760E-662A-47E4-B729-B70126C24A31}.Debug|x86.Build.0 = Debug|Any CPU + {24D7760E-662A-47E4-B729-B70126C24A31}.Release|Any CPU.ActiveCfg = Release|Any CPU + {24D7760E-662A-47E4-B729-B70126C24A31}.Release|Any CPU.Build.0 = Release|Any CPU {24D7760E-662A-47E4-B729-B70126C24A31}.Release|x64.ActiveCfg = Release|Any CPU {24D7760E-662A-47E4-B729-B70126C24A31}.Release|x64.Build.0 = Release|Any CPU {24D7760E-662A-47E4-B729-B70126C24A31}.Release|x86.ActiveCfg = Release|Any CPU {24D7760E-662A-47E4-B729-B70126C24A31}.Release|x86.Build.0 = Release|Any CPU + {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|Any CPU.Build.0 = Debug|Any CPU {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x64.ActiveCfg = Debug|Any CPU {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x64.Build.0 = Debug|Any CPU {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x86.ActiveCfg = Debug|Any CPU {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Debug|x86.Build.0 = Debug|Any CPU + {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|Any CPU.Build.0 = Release|Any CPU {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x64.ActiveCfg = Release|Any CPU {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x64.Build.0 = Release|Any CPU {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x86.ActiveCfg = Release|Any CPU {F22835A1-83D8-4334-91BB-BAAEB9CF59B1}.Release|x86.Build.0 = Release|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Debug|x64.ActiveCfg = Debug|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Debug|x64.Build.0 = Debug|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Debug|x86.ActiveCfg = Debug|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Debug|x86.Build.0 = Debug|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Release|Any CPU.Build.0 = Release|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Release|x64.ActiveCfg = Release|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Release|x64.Build.0 = Release|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Release|x86.ActiveCfg = Release|Any CPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/LiMan.Core/LiMan.Core.csproj b/LiMan.Core/LiMan.Core.csproj new file mode 100644 index 00000000..7e6b666f --- /dev/null +++ b/LiMan.Core/LiMan.Core.csproj @@ -0,0 +1,54 @@ + + + + + Debug + AnyCPU + {B61508B2-20CB-45D9-8C00-209A22C44DE5} + Library + Properties + LiMan.Core + LiMan.Core + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LiMan.Core/Properties/AssemblyInfo.cs b/LiMan.Core/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..57340894 --- /dev/null +++ b/LiMan.Core/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Le informazioni generali relative a un assembly sono controllate dal seguente +// set di attributi. Modificare i valori di questi attributi per modificare le informazioni +// associate a un assembly. +[assembly: AssemblyTitle("LiMan.Core")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LiMan.Core")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili +// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da +// COM, impostare su true l'attributo ComVisible per tale tipo. +[assembly: ComVisible(false)] + +// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi +[assembly: Guid("b61508b2-20cb-45d9-8c00-209a22c44de5")] + +// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: +// +// Versione principale +// Versione secondaria +// Numero di build +// Revisione +// +// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build +// usando l'asterisco '*' come illustrato di seguito: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LiMan.Core/SupportRequest.cs b/LiMan.Core/SupportRequest.cs new file mode 100644 index 00000000..0f3c645f --- /dev/null +++ b/LiMan.Core/SupportRequest.cs @@ -0,0 +1,90 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LiMan.Core +{ + public class SupportRequest + { + #region Public Properties + + public string CodApp { get; set; } = ""; + public string CodImp { get; set; } = ""; + public string CodInst { get; set; } = ""; + public string ContactEmail { get; set; } = ""; + public string ContactName { get; set; } = ""; + public string ContactPhone { get; set; } = ""; + public int idxSubLic { get; set; } = 0; + + public TipologiaTicket Tipo { get; set; } = TipologiaTicket.ND; + + public bool IsValid + { + get => !string.IsNullOrEmpty(MasterKey) && !string.IsNullOrEmpty(ContactEmail) && !string.IsNullOrEmpty(CodInst) && !string.IsNullOrEmpty(CodApp); + } + + public string MasterKey { get; set; } = ""; + public string ReqBody { get; set; } = ""; + + /// + /// Istanzia un nuovo ogetto richeista supporto + /// + /// Codice Applicazione (es EBW-UP) + /// Codice Impegno (es codice chiave HW) + /// Codice Cliente/Installazione + /// Email x contatto + /// Nome del richiedente/clietne + /// Tel richeidente/cliente + /// Chiave master di comunicazione da LiMan + /// Testo delal richiesta + /// Idx univoco di sublic (es x gestione utenti) + /// tipo ticket da gestire (default fileUpload) + public SupportRequest(string codApp, string codImp, string codInst, string contactEmail, string contactName, string contactPhone, string masterKey, string ReqBody, int idxSubLic = 0, TipologiaTicket tipo = TipologiaTicket.FileUpload) + { + this.CodApp = codApp; + this.CodImp = codImp; + this.CodInst = codInst; + this.ContactEmail = contactEmail; + this.ContactName = contactName; + this.ContactPhone = contactPhone; + this.MasterKey = masterKey; + this.ReqBody = ReqBody; + this.idxSubLic = idxSubLic; + this.Tipo = tipo; + } + + /// + /// Effettua salvataggio su file di un oggetto richiesta file upload + /// + /// Oggetto richiesta (già istanziato) + /// Path dove salvare il file + public static bool SaveRequest(SupportRequest currReq, string filePath) + { + bool fatto = false; + try + { + string rawData = JsonConvert.SerializeObject(currReq, Formatting.Indented); + File.WriteAllText(filePath, rawData); + fatto = true; + } + catch (Exception ex) + { + Console.Write(ex.ToString()); + } + return fatto; + } + + #endregion Public Properties + } + + public enum TipologiaTicket : int { + ND = 0, + User = 1, + FileUpload = 2 + } + +} \ No newline at end of file diff --git a/LiMan.Core/packages.config b/LiMan.Core/packages.config new file mode 100644 index 00000000..5eaa239b --- /dev/null +++ b/LiMan.Core/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file