Fix MP ADM x gestione anagrafica articoli con filtro a capo + speedup paged data
This commit is contained in:
@@ -19,13 +19,8 @@
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center">
|
||||
<HeaderTemplate>
|
||||
<%--<asp:Button ID="btnReset" runat="server" Text='<%# traduci("Reset") %>' OnClick="btnReset_Click"
|
||||
Visible="true" />--%>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<%--<asp:ImageButton ID="imgSelect" runat="server" CausesValidation="False" CommandName="Select"
|
||||
ToolTip='<%# traduci("Select") %>' ImageUrl="~/images/view_m.png" />
|
||||
--%>
|
||||
<asp:ImageButton ID="imgEdit" runat="server" CausesValidation="False" CommandName="Edit"
|
||||
Visible='<%# isWritable() %>' ToolTip='<%# traduci("Edit") %>' ImageUrl="~/images/edit_m.png" />
|
||||
</ItemTemplate>
|
||||
@@ -118,7 +113,7 @@
|
||||
</asp:GridView>
|
||||
<asp:Label ID="lblNumRec" runat="server" CssClass="txtMini" />
|
||||
<asp:Label ID="lblWarning" runat="server" Visible="false" CssClass="erroreMid" />
|
||||
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData" TypeName="MapoDb.DS_ProdTempiTableAdapters.AnagArticoliTableAdapter" OnInserting="recuperaFooter" FilterExpression="CodArticolo LIKE '%{0}%' OR DescArticolo LIKE '%{0}%' " OnInserted="ods_Updated" OnUpdated="ods_Updated" OnDeleted="ods_Updated" UpdateMethod="updateQry" DeleteMethod="deleteQry" InsertMethod="Insert" OnUpdating="ods_Updating">
|
||||
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="getPaged" TypeName="MapoDb.DS_ProdTempiTableAdapters.AnagArticoliTableAdapter" OnInserting="recuperaFooter" FilterExpression="CodArticolo LIKE '%{0}%' OR DescArticolo LIKE '%{0}%' " OnInserted="ods_Updated" OnUpdated="ods_Updated" OnDeleted="ods_Updated" UpdateMethod="updateQry" DeleteMethod="deleteQry" InsertMethod="Insert" OnUpdating="ods_Updating" EnablePaging="True" SelectCountMethod="rowCount" SortParameterName="orderByCol">
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
|
||||
</FilterParameters>
|
||||
|
||||
@@ -8,17 +8,62 @@ namespace MP_ADM.WebUserControls
|
||||
{
|
||||
public partial class mod_anagArticoli : BaseUserControl
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto datalayer specifico
|
||||
/// </summary>
|
||||
private DataLayer DataLayerObj = new DataLayer();
|
||||
|
||||
#region area da NON modificare
|
||||
#endregion Private Fields
|
||||
|
||||
#region area protected
|
||||
#region Protected Fields
|
||||
|
||||
protected string _idxGridView;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Events
|
||||
|
||||
public event EventHandler eh_nuovoValore;
|
||||
|
||||
public event EventHandler eh_resetSelezione;
|
||||
|
||||
public event EventHandler eh_selValore;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// nuovo valore creato...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void mod_newOdl1_eh_nuovoValore(object sender, EventArgs e)
|
||||
{
|
||||
// aggiorno!
|
||||
resetSelezione();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// crea un nuovo record e ricarica...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
string tempCode = string.Format("_{0:yyyyMMdd-HHmmss}", DateTime.Now);
|
||||
string tempName = string.Format("Nuovo articolo creato {0:dd/MM/yyyy HH:mm:ss}", DateTime.Now);
|
||||
DataLayerObj.taAnagArt.Insert(tempCode, tempName, "", "", "", "ART");
|
||||
// reset!
|
||||
resetSelezione();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reset della selezione
|
||||
/// </summary>
|
||||
@@ -30,19 +75,14 @@ namespace MP_ADM.WebUserControls
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gestione cambio selezione valore
|
||||
/// elenco colonne del datagrid
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
/// <returns></returns>
|
||||
protected DataColumnCollection colonneObj()
|
||||
{
|
||||
// salvo in session il valore selezionato...
|
||||
memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false);
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_selValore != null)
|
||||
{
|
||||
eh_selValore(this, new EventArgs());
|
||||
}
|
||||
MapoDb.DS_ProdTempi.DatiMacchineDataTable tabella = new MapoDb.DS_ProdTempi.DatiMacchineDataTable();
|
||||
DataColumnCollection colonne = tabella.Columns;
|
||||
return colonne;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -75,6 +115,63 @@ namespace MP_ADM.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gestione cambio selezione valore
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// salvo in session il valore selezionato...
|
||||
memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false);
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_selValore != null)
|
||||
{
|
||||
eh_selValore(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// svuoto da cache post update
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
// evento come nuovo...
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
{
|
||||
// verifico eventuali nulli --> ""
|
||||
if (e.InputParameters["DescArticolo"] == null) e.InputParameters["DescArticolo"] = "";
|
||||
if (e.InputParameters["CurrRev"] == null) e.InputParameters["CurrRev"] = "";
|
||||
if (e.InputParameters["Disegno"] == null) e.InputParameters["Disegno"] = "";
|
||||
// rimuovo a capo x tutti i campi
|
||||
for (int i = 0; i < e.InputParameters.Count; i++)
|
||||
{
|
||||
e.InputParameters[i] = e.InputParameters[i].ToString().Replace("/n", "").Replace("/r", "");
|
||||
}
|
||||
}
|
||||
|
||||
/// inizializzazione valori di default
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
_idxGridView = "IdxMacchina";
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
|
||||
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
|
||||
@@ -131,110 +228,9 @@ namespace MP_ADM.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// svuoto da cache post update
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
// evento come nuovo...
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
#endregion Protected Methods
|
||||
|
||||
#endregion area protected
|
||||
|
||||
#region are public
|
||||
|
||||
/// <summary>
|
||||
/// effettua traduzione del lemma
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(string lemma)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua traduzione in inglese del lemma
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduciEn(string lemma)
|
||||
{
|
||||
return user_std.UtSn.TraduciEn(lemma);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
public void resetSelezione()
|
||||
{
|
||||
memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView));
|
||||
grView.SelectedIndex = -1;
|
||||
grView.DataBind();
|
||||
lblWarning.Visible = false;
|
||||
if (eh_resetSelezione != null)
|
||||
{
|
||||
eh_resetSelezione(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion are public
|
||||
|
||||
#endregion area da NON modificare
|
||||
|
||||
#region gestione eventi
|
||||
|
||||
public event EventHandler eh_resetSelezione;
|
||||
|
||||
public event EventHandler eh_nuovoValore;
|
||||
|
||||
public event EventHandler eh_selValore;
|
||||
|
||||
#endregion gestione eventi
|
||||
|
||||
#region area da modificare
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
}
|
||||
|
||||
/// inizializzazione valori di default
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
_idxGridView = "IdxMacchina";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// nuovo valore creato...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void mod_newOdl1_eh_nuovoValore(object sender, EventArgs e)
|
||||
{
|
||||
// aggiorno!
|
||||
resetSelezione();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// elenco colonne del datagrid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected DataColumnCollection colonneObj()
|
||||
{
|
||||
MapoDb.DS_ProdTempi.DatiMacchineDataTable tabella = new MapoDb.DS_ProdTempi.DatiMacchineDataTable();
|
||||
DataColumnCollection colonne = tabella.Columns;
|
||||
return colonne;
|
||||
}
|
||||
#region Public Methods
|
||||
|
||||
public bool delEnabled(object _idx)
|
||||
{
|
||||
@@ -262,27 +258,40 @@ namespace MP_ADM.WebUserControls
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// crea un nuovo record e ricarica...
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
public void resetSelezione()
|
||||
{
|
||||
string tempCode = string.Format("_{0:yyyyMMdd-HHmmss}", DateTime.Now);
|
||||
string tempName = string.Format("Nuovo articolo creato {0:dd/MM/yyyy HH:mm:ss}", DateTime.Now);
|
||||
DataLayerObj.taAnagArt.Insert(tempCode, tempName, "", "", "", "ART");
|
||||
// reset!
|
||||
resetSelezione();
|
||||
memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView));
|
||||
grView.SelectedIndex = -1;
|
||||
grView.DataBind();
|
||||
lblWarning.Visible = false;
|
||||
if (eh_resetSelezione != null)
|
||||
{
|
||||
eh_resetSelezione(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion area da modificare
|
||||
|
||||
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
/// <summary>
|
||||
/// effettua traduzione del lemma
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(string lemma)
|
||||
{
|
||||
// verifico eventuali nulli --> ""
|
||||
if (e.InputParameters["DescArticolo"] == null) e.InputParameters["DescArticolo"] = "";
|
||||
if (e.InputParameters["CurrRev"] == null) e.InputParameters["CurrRev"] = "";
|
||||
if (e.InputParameters["Disegno"] == null) e.InputParameters["Disegno"] = "";
|
||||
return user_std.UtSn.Traduci(lemma);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua traduzione in inglese del lemma
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduciEn(string lemma)
|
||||
{
|
||||
return user_std.UtSn.TraduciEn(lemma);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user