61028fb668
- porting Bootstrap4 --> bootstrap5 - vari fix (es search vocabolario)
139 lines
4.0 KiB
C#
139 lines
4.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace MP_ADM.WebUserControls
|
|
{
|
|
public partial class cmp_ST_preview : BaseUserControl
|
|
{
|
|
#region Protected Fields
|
|
|
|
protected string preClip = "IdxST:";
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
protected int clipbIdxST
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
if (!string.IsNullOrEmpty(clipboard))
|
|
{
|
|
int.TryParse(clipboard.Replace(preClip, ""), out answ);
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Public Properties
|
|
|
|
public int IdxST
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(hfIdxST.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfIdxST.Value = $"{value}";
|
|
repGroup.DataBind();
|
|
checkClipboard();
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void checkClipboard()
|
|
{
|
|
// Tabella ST selezionata
|
|
var tabCurrSTAR = DataLayerObj.taSTAR.getByST(IdxST);
|
|
bool showPaste = false;
|
|
bool checkSource = false;
|
|
bool checkDest = false;
|
|
// verifico condizioni COPY
|
|
lbtCopy.Visible = (tabCurrSTAR.Rows.Count > 0);
|
|
// verifico condizioni PASTE
|
|
if (!string.IsNullOrEmpty(clipboard))
|
|
{
|
|
// verifico sia tipo clipboard valida
|
|
if (clipboard.StartsWith(preClip))
|
|
{
|
|
//verifico sia intero valido
|
|
if (clipbIdxST > 0)
|
|
{
|
|
// verifico le condizioni: si parte da una una ST esistente...
|
|
var tabSrcSTA = DataLayerObj.taSTA.getByKey(clipbIdxST);
|
|
checkSource = tabSrcSTA.Rows.Count > 0;
|
|
checkDest = tabCurrSTAR.Rows.Count == 0;
|
|
// verifica status visibilità x PASTE
|
|
showPaste = checkSource && checkDest;
|
|
}
|
|
}
|
|
}
|
|
// verifica x stile copy
|
|
lbtCopy.CssClass = checkSource ? "btn w-100 btn-light border border-dark" : "btn w-100 btn-outline-light";
|
|
lbtPaste.Visible = showPaste;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
protected void lbtCopy_Click(object sender, EventArgs e)
|
|
{
|
|
// salvo il clipboard la ST corrente...
|
|
clipboard = $"{preClip}{IdxST}";
|
|
checkClipboard();
|
|
}
|
|
|
|
protected void lbtDoEdit_Click(object sender, EventArgs e)
|
|
{
|
|
raiseNewVal();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Effettua paste --> duplicazione Scheda Tecnica
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtPaste_Click(object sender, EventArgs e)
|
|
{
|
|
// verifico codici...
|
|
if (clipbIdxST > 0 && IdxST > 0)
|
|
{
|
|
// se diversi...
|
|
if (clipbIdxST != IdxST)
|
|
{
|
|
// effettuo chiamata copy/paste
|
|
DataLayerObj.taSTAR.PasteAll(clipbIdxST, IdxST);
|
|
}
|
|
clipboard = "";
|
|
}
|
|
raiseReset();
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
clipboard = "";
|
|
string testo = traduci("ConfirmPasteFullST");
|
|
lbtPaste.OnClientClick = SteamWare.jsUtils.getCBE(testo, false);
|
|
}
|
|
checkClipboard();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |