112 lines
2.8 KiB
C#
112 lines
2.8 KiB
C#
using SteamWare;
|
|
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_TechSheetArtAddNew : BaseUserControl
|
|
{
|
|
#region Public Properties
|
|
|
|
public string CodArticolo
|
|
{
|
|
get
|
|
{
|
|
return ddlArticolo.SelectedValue;
|
|
}
|
|
}
|
|
|
|
public string CodTempl
|
|
{
|
|
get
|
|
{
|
|
return hfCodTipo.Value;
|
|
}
|
|
set
|
|
{
|
|
hfCodTipo.Value = value;
|
|
preliminaryCheck();
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// verifiche preliminari inserimento scheda
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool preliminaryCheck()
|
|
{
|
|
bool answ = false;
|
|
// verifico OK selezione tipo
|
|
if (string.IsNullOrEmpty(CodTempl))
|
|
{
|
|
displError("Errore! prego selezionare tipo scheda per proseguire.");
|
|
}
|
|
else
|
|
{
|
|
// verifico NON esista già
|
|
var tabST = DataLayerObj.taSTA.getBySearchArt(CodArticolo, CodTempl);
|
|
if (tabST.Rows.Count > 0)
|
|
{
|
|
displError("Errore! Scheda articolo già presente.");
|
|
}
|
|
else
|
|
{
|
|
// ok valido!
|
|
answ = true;
|
|
}
|
|
}
|
|
lbtAddNew.Enabled = answ;
|
|
return answ;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// selezione articolo
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlArticolo_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
preliminaryCheck();
|
|
}
|
|
|
|
protected void displError(string message)
|
|
{
|
|
lblMessage.Text = message;
|
|
lblMessage.Visible = !string.IsNullOrEmpty(message);
|
|
}
|
|
|
|
protected void lbtAddNew_Click(object sender, EventArgs e)
|
|
{
|
|
bool checkOk = preliminaryCheck();
|
|
if (checkOk)
|
|
{
|
|
DataLayerObj.taSTA.InsertQuery(CodTempl, CodArticolo, user_std.UtSn.userNameAD);
|
|
raiseNewVal();
|
|
}
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
lblMessage.Visible = false;
|
|
}
|
|
|
|
protected void txtSearch_TextChanged(object sender, EventArgs e)
|
|
{
|
|
ddlArticolo.DataBind();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |