6b37941263
- pagina serarch: completata funzione decode (mancano immagini x test) - decode gestito
99 lines
2.7 KiB
C#
99 lines
2.7 KiB
C#
using MongoDB.Bson;
|
|
using MongoDB.Driver;
|
|
using NKC_SDK;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_SpecPartDet : BaseUserControl
|
|
{
|
|
public string fullData
|
|
{
|
|
get => hfFullData.Value;
|
|
set
|
|
{
|
|
hfFullData.Value = value;
|
|
decodedData(value);
|
|
}
|
|
}
|
|
|
|
private void decodedData(string rawVal)
|
|
{
|
|
dataDecoded = new Dictionary<string, string>();
|
|
if (!string.IsNullOrEmpty(rawVal))
|
|
{
|
|
// splitto e salvo...
|
|
var strDecod = rawVal.Split(';');
|
|
if (strDecod.Length > 5)
|
|
{
|
|
dataDecoded.Add("CartCode", strDecod[0]);
|
|
dataDecoded.Add("Order", strDecod[1]);
|
|
dataDecoded.Add("Date", strDecod[2]);
|
|
dataDecoded.Add("PartCode", strDecod[3]);
|
|
dataDecoded.Add("PartQty", strDecod[4]);
|
|
dataDecoded.Add("PartDescr", strDecod[5]);
|
|
}
|
|
}
|
|
}
|
|
|
|
public string getData(string key)
|
|
{
|
|
string answ = "[]";
|
|
if (dataDecoded.ContainsKey(key))
|
|
{
|
|
answ = dataDecoded[key];
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
public string getDatetime()
|
|
{
|
|
string answ = "";
|
|
string rawDate=getData("Date");
|
|
if (rawDate.Length==8)
|
|
{
|
|
int year = DateTime.Today.Year;
|
|
int month = 1;
|
|
int day= 1;
|
|
int.TryParse(rawDate.Substring(0, 4), out year);
|
|
int.TryParse(rawDate.Substring(4, 2), out month);
|
|
int.TryParse(rawDate.Substring(6, 2), out day);
|
|
DateTime newDate = new DateTime(year, month, day);
|
|
answ = $"{newDate: MMM dd yyyy}";
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
public string getImageName()
|
|
{
|
|
string answ = getData("PartCode");
|
|
answ = answ != "[]" ? answ : "none";
|
|
return answ;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Effettua update componente, mostrando tutte le info
|
|
/// </summary>
|
|
public void doUpdate()
|
|
{
|
|
// effettua redraw dei componenti
|
|
divDisplay.DataBind();
|
|
imgQrLogin.ImageUrl = getImgUrl(fullData);
|
|
}
|
|
|
|
|
|
private Dictionary<string, string> dataDecoded { get; set; } = new Dictionary<string, string>();
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
} |