113 lines
2.8 KiB
C#
113 lines
2.8 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AppData
|
|
{
|
|
public class DataLayer
|
|
{
|
|
#region oggetti public
|
|
|
|
public DS_AppTableAdapters.BatchListTableAdapter taBL;
|
|
public DS_AppTableAdapters.ItemListTableAdapter taIL;
|
|
public DS_AppTableAdapters.MaterialsTableAdapter taMat;
|
|
public DS_AppTableAdapters.OrderListTableAdapter taOL;
|
|
public DS_AppTableAdapters.StackListTableAdapter taSTL;
|
|
public DS_AppTableAdapters.SheetListTableAdapter taSHL;
|
|
|
|
public DataLayer()
|
|
{
|
|
// inizializzaizone classe
|
|
initTA();
|
|
setupConnString();
|
|
}
|
|
|
|
private void setupConnString()
|
|
{
|
|
string connString = memLayer.ML.CRS("NKC_WFConnectionString");
|
|
taBL.Connection.ConnectionString = connString;
|
|
taIL.Connection.ConnectionString = connString;
|
|
taMat.Connection.ConnectionString = connString;
|
|
taOL.Connection.ConnectionString = connString;
|
|
taSTL.Connection.ConnectionString = connString;
|
|
taSHL.Connection.ConnectionString = connString;
|
|
}
|
|
private void initTA()
|
|
{
|
|
taBL = new DS_AppTableAdapters.BatchListTableAdapter();
|
|
taIL = new DS_AppTableAdapters.ItemListTableAdapter();
|
|
taMat = new DS_AppTableAdapters.MaterialsTableAdapter();
|
|
taOL = new DS_AppTableAdapters.OrderListTableAdapter();
|
|
taSTL = new DS_AppTableAdapters.StackListTableAdapter();
|
|
taSHL = new DS_AppTableAdapters.SheetListTableAdapter();
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// oggetto static/singleton per fare chiamate sul datalayer
|
|
/// </summary>
|
|
public static DataLayer man = new DataLayer();
|
|
|
|
public string CodSoggCurrUser
|
|
{
|
|
get
|
|
{
|
|
return "O000123456";
|
|
}
|
|
}
|
|
public string CognNomeCurrUser
|
|
{
|
|
get
|
|
{
|
|
return "Mario Rossi";
|
|
}
|
|
}
|
|
|
|
public decodedData decodeBcode(string bcValue)
|
|
{
|
|
decodedData answ = new decodedData();
|
|
if (bcValue.StartsWith("MAT"))
|
|
{
|
|
answ.codeType = codeType.Material;
|
|
answ.code = bcValue.Replace("MAT", "");
|
|
answ.description = $"Material: {answ.code}";
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Valori decodificati
|
|
/// </summary>
|
|
public class decodedData
|
|
{
|
|
/// <summary>
|
|
/// Tipo codice decodificato
|
|
/// </summary>
|
|
public codeType codeType { get; set; } = codeType.UNK;
|
|
/// <summary>
|
|
/// Codice decodificato
|
|
/// </summary>
|
|
public string code { get; set; } = "";
|
|
/// <summary>
|
|
/// Descrizione associata
|
|
/// </summary>
|
|
public string description { get; set; } = "";
|
|
}
|
|
/// <summary>
|
|
/// Tipi di barcode gestiti
|
|
/// </summary>
|
|
public enum codeType
|
|
{
|
|
UNK = 0,
|
|
Item,
|
|
Material,
|
|
Sheet,
|
|
Stack,
|
|
Batch
|
|
}
|
|
}
|