completata gestione copy/paste schede
This commit is contained in:
@@ -4,12 +4,20 @@
|
||||
<div class="card text-dark textCondens">
|
||||
<div class="card-header bg-info text-light">
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-8">
|
||||
<div class="col-6">
|
||||
<h4>Scheda Tecnica Articolo</h4>
|
||||
</div>
|
||||
<div class="col-3 col-md-2">
|
||||
<div class="col-2">
|
||||
<asp:LinkButton runat="server" ID="lbtPaste" CssClass="btn btn-block btn-outline-light" OnClick="lbtPaste_Click">
|
||||
<i class="fa fa-clone" aria-hidden="true"></i> PASTE
|
||||
</asp:LinkButton>
|
||||
</div>
|
||||
<div class="col-3 col-md-2">
|
||||
<div class="col-2">
|
||||
<asp:LinkButton runat="server" ID="lbtCopy" CssClass="btn btn-block btn-outline-light" OnClick="lbtCopy_Click">
|
||||
<i class="fa fa-clone" aria-hidden="true"></i> COPY
|
||||
</asp:LinkButton>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<asp:LinkButton runat="server" ID="lbtDoEdit" CssClass="btn btn-block btn-light" OnClick="lbtDoEdit_Click"><i class="fa fa-pencil" aria-hidden="true"></i> Modifica Scheda</asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,29 @@ 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
|
||||
@@ -28,15 +51,73 @@ namespace MP_ADM.WebUserControls
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void checkClipboard()
|
||||
{
|
||||
bool showPaste = false;
|
||||
// verifico ci sia qualcosa
|
||||
if (!string.IsNullOrEmpty(clipboard))
|
||||
{
|
||||
// verifico sia tipo clipboard valida
|
||||
if (clipboard.StartsWith(preClip))
|
||||
{
|
||||
//verifico sia intero valido
|
||||
if (clipbIdxST > 0)
|
||||
{
|
||||
// verifico SIA una ST esistente...
|
||||
var tabSTA = DataLayerObj.taSTA.getByKey(clipbIdxST);
|
||||
showPaste = (tabSTA.Rows.Count > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
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 = "";
|
||||
}
|
||||
checkClipboard();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
@@ -14,6 +14,24 @@ namespace MP_ADM.WebUserControls
|
||||
public partial class cmp_ST_preview
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lbtPaste.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtPaste;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lbtCopy.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtCopy;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lbtDoEdit.
|
||||
/// </summary>
|
||||
|
||||
@@ -63,6 +63,13 @@ namespace MP_ADM.WebUserControls
|
||||
editMode = true;
|
||||
}
|
||||
|
||||
private void Cmp_ST_preview_eh_resetSelezione(object sender, EventArgs e)
|
||||
{
|
||||
// resetto...
|
||||
IdxST = dummyArt;
|
||||
cmp_TechSheetArt.doUpdate();
|
||||
}
|
||||
|
||||
private void Cmp_TechSheetArt_eh_nuovoValore(object sender, EventArgs e)
|
||||
{
|
||||
IdxST = dummyArt;
|
||||
@@ -121,6 +128,7 @@ namespace MP_ADM.WebUserControls
|
||||
cmp_TechSheetArt.eh_resetSelezione += Cmp_TechSheetArt_eh_resetSelezione;
|
||||
cmp_TechSheetDetail.eh_nuovoValore += Cmp_TechSheetDetail_eh_nuovoValore;
|
||||
cmp_ST_preview.eh_nuovoValore += Cmp_ST_preview_eh_nuovoValore;
|
||||
cmp_ST_preview.eh_resetSelezione += Cmp_ST_preview_eh_resetSelezione;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
Reference in New Issue
Block a user