Compare commits

...

2 Commits

12 changed files with 507 additions and 56 deletions
+2
View File
@@ -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"
+6
View File
@@ -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"
@@ -133,6 +134,11 @@ Public Module ConstIni
Public Const K_ZEBRAUTILITIES As String = "ZebraUtilities"
Public Const K_TEMPLATE As String = "Template"
Public Const S_CUSTOMERCONTACT As String = "CustomerContact"
Public Const K_CONTACTEMAIL As String = "ContactEmail"
Public Const K_CONTACTNAME As String = "ContactName"
Public Const K_CONTACTPHONE As String = "ContactPhone"
Public Const S_BEAM_LIST As String = "Beam_List"
Public Const S_WALL_LIST As String = "Wall_List"
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>
@@ -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; } = "";
/// <summary>
/// Istanzia un nuovo ogetto richeista supporto
/// </summary>
/// <param name="codApp">Codice Applicazione (es EBW-UP)</param>
/// <param name="codImp">Codice Impegno (es codice chiave HW)</param>
/// <param name="codInst">Codice Cliente/Installazione</param>
/// <param name="contactEmail">Email x contatto</param>
/// <param name="contactName">Nome del richiedente/clietne</param>
/// <param name="contactPhone">Tel richeidente/cliente</param>
/// <param name="masterKey">Chiave master di comunicazione da LiMan</param>
/// <param name="ReqBody">Testo delal richiesta</param>
/// <param name="idxSubLic">Idx univoco di sublic (es x gestione utenti)</param>
/// <param name="tipo">tipo ticket da gestire (default fileUpload)</param>
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;
}
/// <summary>
/// Effettua salvataggio su file di un oggetto richiesta file upload
/// </summary>
/// <param name="currReq">Oggetto richiesta (già istanziato)</param>
/// <param name="filePath">Path dove salvare il file</param>
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
}
}
@@ -697,6 +697,10 @@
<Project>{24d7760e-662a-47e4-b729-b70126c24a31}</Project>
<Name>EgtBEAMWALL.DataLayer</Name>
</ProjectReference>
<ProjectReference Include="..\LiMan.Core\LiMan.Core.csproj">
<Project>{b61508b2-20cb-45d9-8c00-209a22c44de5}</Project>
<Name>LiMan.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\TreeView\Folder.png" />
@@ -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,167 @@ 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)
' recupero codice chiave di protezione
'Dim sLicFileName As String = String.Empty
'GetMainPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
'Dim sLicFile As String = Map.refMainWindowVM.MainWindowM.sConfigDir & "\" & sLicFileName
'Dim sKey As String = String.Empty
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
' recupero contatti cliente
Dim sContactEmail As String = String.Empty
Dim sContactName As String = String.Empty
Dim sContactPhone As String = String.Empty
GetMainPrivateProfileString(S_CUSTOMERCONTACT, K_CONTACTEMAIL, "", sContactEmail)
GetMainPrivateProfileString(S_CUSTOMERCONTACT, K_CONTACTNAME, "", sContactName)
GetMainPrivateProfileString(S_CUSTOMERCONTACT, K_CONTACTPHONE, "", sContactPhone)
Dim sp As SupportRequest = New SupportRequest("Uploader",
sKey,
"EgalWare",
sContactEmail,
sContactName,
sContactPhone,
"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 = 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
@@ -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_LIMANUTILITIES, LIMANTRANSFER_EXE, sTransferExe)
Return sTransferExe
End Get
End Property
#End Region ' FIELDS
#Region "CONSTRUCTOR"
+32
View File
@@ -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
+54
View File
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B61508B2-20CB-45D9-8C00-209A22C44DE5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LiMan.Core</RootNamespace>
<AssemblyName>LiMan.Core</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SupportRequest.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+36
View File
@@ -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")]
+90
View File
@@ -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; } = "";
/// <summary>
/// Istanzia un nuovo ogetto richeista supporto
/// </summary>
/// <param name="codApp">Codice Applicazione (es EBW-UP)</param>
/// <param name="codImp">Codice Impegno (es codice chiave HW)</param>
/// <param name="codInst">Codice Cliente/Installazione</param>
/// <param name="contactEmail">Email x contatto</param>
/// <param name="contactName">Nome del richiedente/clietne</param>
/// <param name="contactPhone">Tel richeidente/cliente</param>
/// <param name="masterKey">Chiave master di comunicazione da LiMan</param>
/// <param name="ReqBody">Testo delal richiesta</param>
/// <param name="idxSubLic">Idx univoco di sublic (es x gestione utenti)</param>
/// <param name="tipo">tipo ticket da gestire (default fileUpload)</param>
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;
}
/// <summary>
/// Effettua salvataggio su file di un oggetto richiesta file upload
/// </summary>
/// <param name="currReq">Oggetto richiesta (già istanziato)</param>
/// <param name="filePath">Path dove salvare il file</param>
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
}
}
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
</packages>