143 lines
3.5 KiB
C#
143 lines
3.5 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace CMS_SC.WebUserControls
|
|
{
|
|
public partial class mod_listValues : System.Web.UI.UserControl
|
|
{
|
|
/// <summary>
|
|
/// caricamento pagina
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
lbShowNew.Enabled = true;
|
|
lblBtnShowNew.Text = traduci("btnNewListVal");
|
|
divInsert.Visible = false;
|
|
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// dimensione pagina grid view
|
|
/// </summary>
|
|
public int pageSize
|
|
{
|
|
get
|
|
{
|
|
return grView.PageSize;
|
|
}
|
|
set
|
|
{
|
|
grView.PageSize = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// effettua traduzione del lemma
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(string lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma);
|
|
}
|
|
/// <summary>
|
|
/// effettuo update
|
|
/// </summary>
|
|
private void doUpdate()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// reset selezione
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnReset_Click(object sender, EventArgs e)
|
|
{
|
|
// deseleziono e nascondo pnl statistiche...
|
|
grView.SelectedIndex = -1;
|
|
}
|
|
/// <summary>
|
|
/// mostra footer
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnShowInsert(object sender, EventArgs e)
|
|
{
|
|
// SE HO SELEZIONATO UN VALORE!!!
|
|
if (ddlTable.SelectedIndex > 0)
|
|
{
|
|
// inverto visibilità insert nuovi valori
|
|
divInsert.Visible = !divInsert.Visible;
|
|
if (divInsert.Visible)
|
|
{
|
|
lblBtnShowNew.Text = traduci("btnHideNewListVal");
|
|
// precompilo valori tabella
|
|
txtTableName.Text = ddlTable.SelectedValue;
|
|
}
|
|
else
|
|
{
|
|
lblBtnShowNew.Text = traduci("btnNewListVal");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// evento post "aggancio" del grView x traduzione headers
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_DataBound(object sender, EventArgs e)
|
|
{
|
|
if (grView.Rows.Count > 0)
|
|
{
|
|
LinkButton lb;
|
|
// aggiorno gli headers
|
|
foreach (TableCell cella in grView.HeaderRow.Cells)
|
|
{
|
|
try
|
|
{
|
|
lb = (LinkButton)cella.Controls[0];
|
|
lb.Text = traduci(lb.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1);
|
|
lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord);
|
|
}
|
|
else
|
|
{
|
|
lblNumRec.Text = "";
|
|
}
|
|
}
|
|
|
|
protected void ddlTable_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// se seleziono valore "vuoto" resetto...
|
|
if (ddlTable.SelectedIndex == 0)
|
|
{
|
|
lblBtnShowNew.Text = traduci("btnNewListVal");
|
|
divInsert.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
txtTableName.Text = ddlTable.SelectedValue;
|
|
}
|
|
}
|
|
|
|
protected void btnDoInsert_Click(object sender, EventArgs e)
|
|
{
|
|
// effettua insert!
|
|
CMS_SC_Data.DtProxy.man.taListVal.insertQuery(txtTableName.Text.Trim(), txtFieldName.Text.Trim(), txtvalue.Text.Trim(), txtvalue.Text.Trim(), 999);
|
|
// refresh dati!
|
|
grView.DataBind();
|
|
}
|
|
|
|
}
|
|
} |