Update con anche anagrafica tipo obj...
git-svn-id: https://keyhammer.ath.cx/svn/XPS/trunk@6 43c8e981-f90d-406c-a89a-24a2c4268d51
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<%@ Page Language="C#" MasterPageFile="~/AjaxSearch.master" AutoEventWireup="true" CodeFile="AnagraficaStati.aspx.cs" Inherits="AnagraficaStati" Title="Untitled Page" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
public partial class AnagraficaStati : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<%@ Page Language="C#" MasterPageFile="~/AjaxSearch.master" AutoEventWireup="true" CodeFile="AnagraficaStep.aspx.cs" Inherits="AnagraficaStep" Title="Untitled Page" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
public partial class AnagraficaStep : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<%@ Page Language="C#" MasterPageFile="~/AjaxSearch.master" AutoEventWireup="true" CodeFile="AnagraficaTipoObj.aspx.cs" Inherits="AnagraficaTipoObj" Title="Untitled Page" %>
|
||||
|
||||
<%@ Register Src="mod_anagTipoObj.ascx" TagName="mod_anagTipoObj" TagPrefix="uc1" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
||||
<uc1:mod_anagTipoObj ID="Mod_anagTipoObj1" runat="server" />
|
||||
</asp:Content>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
public partial class AnagraficaTipoObj : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_anagTipoObj.ascx.cs" Inherits="mod_anagTipoObj" %>
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
|
||||
<asp:GridView ID="grView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
|
||||
OnSelectedIndexChanged="grView_SelectedIndexChanged" OnDataBound="grView_DataBound"
|
||||
DataKeyNames="idxTipoObj" DataSourceID="ods">
|
||||
<RowStyle CssClass="ctrRowStyle" />
|
||||
<AlternatingRowStyle CssClass="ctrAltRowStyle" />
|
||||
<EditRowStyle CssClass="ctrEditRowStyle" />
|
||||
<SelectedRowStyle CssClass="ctrSelRowStyle" />
|
||||
<FooterStyle CssClass="ctrFooter" />
|
||||
<PagerStyle CssClass="ctrHeaderPager" ForeColor="White" HorizontalAlign="Center" />
|
||||
<HeaderStyle CssClass="ctrHeaderPager" ForeColor="White" Font-Bold="True" />
|
||||
<EmptyDataRowStyle CssClass="ctrRowStyle" />
|
||||
<EmptyDataTemplate>
|
||||
<asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
|
||||
<asp:Button ID="btnNew" runat="server" OnClick="btnNewFromEmpty_Click" Text='<%# traduci("New") %>' />
|
||||
</EmptyDataTemplate>
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<HeaderTemplate>
|
||||
<asp:Button ID="btnReset" runat="server" Text='<%# traduci("Reset") %>' OnClick="btnReset_Click"
|
||||
Visible="false" />
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="imgSelect" runat="server" CausesValidation="False" CommandName="Select"
|
||||
ToolTip='<%# traduci("Select") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.seleziona, SteamWare.dimImg.small) %>' />
|
||||
<asp:ImageButton ID="imgEdit" runat="server" CausesValidation="False" CommandName="Edit"
|
||||
ToolTip='<%# traduci("Edit") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.modifica, SteamWare.dimImg.small) %>' />
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:ImageButton ID="imgUpdate" runat="server" CausesValidation="False" CommandName="Update"
|
||||
ToolTip='<%# traduci("Update")%>' ImageUrl='<%# imgPath(SteamWare.tipoImg.conferma , SteamWare.dimImg.small) %>' />
|
||||
<asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ToolTip='<%# traduci("Cancel") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.annulla , SteamWare.dimImg.small) %>' />
|
||||
</EditItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:ImageButton ID="imgInsert" runat="server" CausesValidation="False" CommandName="Insert"
|
||||
ToolTip='<%# traduci("Insert") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.nuovo , SteamWare.dimImg.small) %>'
|
||||
OnClick="lblIns_click" />
|
||||
<asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ToolTip='<%# traduci("Cancel") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.annulla , SteamWare.dimImg.small) %>' />
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="idxTipoObj" SortExpression="idxTipoObj">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="txtidxTipoObj" runat="server" Text='<%# Bind("idxTipoObj") %>'></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Bind("idxTipoObj") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:TextBox ID="txtidxTipoObj" runat="server" Text='<%# Bind("idxTipoObj") %>'></asp:TextBox>
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="DescrObj" SortExpression="DescrObj">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="txtDescrObj" runat="server" Text='<%# Bind("DescrObj") %>'></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label2" runat="server" Text='<%# Bind("DescrObj") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:TextBox ID="txtDescrObj" runat="server" Text='<%# Bind("DescrObj") %>'></asp:TextBox>
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Livello" SortExpression="Livello">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Livello") %>'></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Livello") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="ProcReq" SortExpression="ProcReq">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("ProcReq") %>'></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label4" runat="server" Text='<%# Bind("ProcReq") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="ExtView" SortExpression="ExtView">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("ExtView") %>'></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label5" runat="server" Text='<%# Bind("ExtView") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<HeaderTemplate>
|
||||
<asp:Button ID="btnNew" runat="server" OnClick="btnNew_Click" Text='<%# traduci("New") %>' />
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandName="Delete"
|
||||
ToolTip='<%# traduci("Delete") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.elimina , SteamWare.dimImg.small) %>' />
|
||||
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText='<%# traduci("confermaDel")%>'
|
||||
TargetControlID="imgDelete">
|
||||
</cc1:ConfirmButtonExtender>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:ImageButton ID="imgUpdate2" runat="server" CausesValidation="False" CommandName="Update"
|
||||
ToolTip='<%# traduci("Update")%>' ImageUrl='<%# imgPath(SteamWare.tipoImg.conferma , SteamWare.dimImg.small) %>' />
|
||||
<asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ToolTip='<%# traduci("Cancel") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.annulla , SteamWare.dimImg.small) %>' />
|
||||
</EditItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:ImageButton ID="imgInsert2" runat="server" CausesValidation="False" CommandName="Insert"
|
||||
ToolTip='<%# traduci("Insert") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.nuovo , SteamWare.dimImg.small) %>'
|
||||
OnClick="lblIns_click" />
|
||||
<asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ToolTip='<%# traduci("Cancel") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.annulla , SteamWare.dimImg.small) %>' />
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}"
|
||||
SelectMethod="GetData" TypeName="DS_XPSTableAdapters.AnagTipoObjTableAdapter" OnInserting="recuperaFooter"
|
||||
FilterExpression=" DescrObj LIKE '%{0}%'" DeleteMethod="DeleteQuery"
|
||||
InsertMethod="Insert" UpdateMethod="UpdateQuery" >
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
|
||||
</FilterParameters>
|
||||
<DeleteParameters>
|
||||
<asp:Parameter Name="Original_IdxTipoObj" Type="Int32" />
|
||||
</DeleteParameters>
|
||||
<UpdateParameters>
|
||||
<asp:Parameter Name="DescrObj" Type="String" />
|
||||
<asp:Parameter Name="Livello" Type="String" />
|
||||
<asp:Parameter Name="ProcReq" Type="Boolean" />
|
||||
<asp:Parameter Name="ExtView" Type="Boolean" />
|
||||
<asp:Parameter Name="Original_IdxTipoObj" Type="Int32" />
|
||||
</UpdateParameters>
|
||||
<InsertParameters>
|
||||
<asp:Parameter Name="DescrObj" Type="String" />
|
||||
<asp:Parameter Name="Livello" Type="String" />
|
||||
<asp:Parameter Name="ProcReq" Type="Boolean" />
|
||||
<asp:Parameter Name="ExtView" Type="Boolean" />
|
||||
</InsertParameters>
|
||||
</asp:ObjectDataSource>
|
||||
<asp:Label ID="lblNumRec" runat="server" CssClass="txtMini"></asp:Label><br />
|
||||
<asp:Label ID="lblWarning" runat="server" Visible="false" CssClass="erroreMid" />
|
||||
@@ -0,0 +1,366 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using SteamWare;
|
||||
|
||||
public partial class mod_anagTipoObj : SteamWare.ApplicationUserControl
|
||||
{
|
||||
#region area da NON modificare
|
||||
|
||||
#region area protected
|
||||
|
||||
protected string _idxGridView;
|
||||
protected string _tabCache;
|
||||
protected bool _showNewBtn = true;
|
||||
|
||||
/// <summary>
|
||||
/// imposta errore non cancellabilità per record correlati
|
||||
/// </summary>
|
||||
protected void setNoDeletableErrorMessage()
|
||||
{
|
||||
// mostro avviso di non cancellabilità...
|
||||
lblWarning.Text = traduci("notDeletable_hasChild");
|
||||
lblWarning.Visible = true;
|
||||
grView.DataBind();
|
||||
}
|
||||
/// <summary>
|
||||
/// esegue cancellazione record
|
||||
/// </summary>
|
||||
protected void doDelete()
|
||||
{
|
||||
// posso cancellare...
|
||||
lblWarning.Visible = false;
|
||||
ods.Delete();
|
||||
}
|
||||
/// <summary>
|
||||
/// Valida la cancellazione per i dati mostrati dal gridView
|
||||
/// richiede sia preventivamentedichiarato _idxGridView
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected virtual void validaDelete(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
{
|
||||
int idx = Convert.ToInt32(e.InputParameters[string.Format("Original_{0}", _idxGridView)]);
|
||||
if (objIsNotRelated(idx))
|
||||
{
|
||||
// annullo cancellazione...
|
||||
e.Cancel = true;
|
||||
// seleziono record... metto in session valore idx e poi ridisegno...
|
||||
SteamWare.memLayer.ML.setSessionVal(_idxGridView, idx);
|
||||
setNoDeletableErrorMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
doDelete();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// inserisce nuovo valore da footer
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblIns_click(object sender, EventArgs e)
|
||||
{
|
||||
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
|
||||
ods.Insert();
|
||||
SteamWare.memLayer.ML.emptyCacheVal(_tabCache);
|
||||
}
|
||||
/// <summary>
|
||||
/// annulla inserimento nuovo valore da footer
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblCanc_click(object sender, EventArgs e)
|
||||
{
|
||||
// annullo inserimento: nascondo footer, bind controlli...
|
||||
grView.FooterRow.Visible = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// aggiorna controlli datagrid e numero righe in pagina
|
||||
/// </summary>
|
||||
protected override void aggiornaControlliDataGL()
|
||||
{
|
||||
base.aggiornaControlliDataGL();
|
||||
grView.PageSize = _righeDataGridMed;
|
||||
}
|
||||
/// <summary>
|
||||
/// traduce gli header delle colonne
|
||||
/// </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 = "";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
public void resetSelezione()
|
||||
{
|
||||
SteamWare.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());
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// gestione evento richeista nuovo valore (mostra footer, ...)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
// reset selezione...
|
||||
resetSelezione();
|
||||
// mostro il footer oppure la riga dei dettagli x nuovo...
|
||||
if (grView.FooterRow != null)
|
||||
{
|
||||
grView.FooterRow.Visible = true;
|
||||
}
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// reset della selezione
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnReset_Click(object sender, EventArgs e)
|
||||
{
|
||||
resetSelezione();
|
||||
}
|
||||
/// <summary>
|
||||
/// collega i controlli
|
||||
/// </summary>
|
||||
protected override void bindControlli()
|
||||
{
|
||||
base.bindControlli();
|
||||
caricaTabelle();
|
||||
}
|
||||
/// <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...
|
||||
SteamWare.memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue);
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_selValore != null)
|
||||
{
|
||||
eh_selValore(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region gestione eventi
|
||||
|
||||
public event EventHandler eh_resetSelezione;
|
||||
public event EventHandler eh_nuovoValore;
|
||||
public event EventHandler eh_selValore;
|
||||
|
||||
#endregion
|
||||
|
||||
#region public
|
||||
|
||||
/// <summary>
|
||||
/// definisce visibilità btnNew
|
||||
/// </summary>
|
||||
public bool showNewBtn
|
||||
{
|
||||
get
|
||||
{
|
||||
return _showNewBtn;
|
||||
}
|
||||
set
|
||||
{
|
||||
_showNewBtn = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua update del modulo
|
||||
/// </summary>
|
||||
public void doUpdate()
|
||||
{
|
||||
resetSelezione();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region area codice variabile
|
||||
|
||||
/// <summary>
|
||||
/// carico le tabelle
|
||||
/// </summary>
|
||||
private void caricaTabelle()
|
||||
{
|
||||
// non serve qui...
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// verifica complessiva non esistenza record child
|
||||
/// </summary>
|
||||
/// <param name="idxObj"></param>
|
||||
/// <returns></returns>
|
||||
protected bool objIsNotRelated(object idxObj)
|
||||
{
|
||||
// !!! FARE vero controllo cancellazione?
|
||||
return false;// (taRouteVersion.getByOggetti(idxObj.ToString(), vers.ToString()).Rows.Count == 0);
|
||||
}
|
||||
/// <summary>
|
||||
/// elenco colonne del datagrid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected DataColumnCollection colonneObj()
|
||||
{
|
||||
DS_XPS.AnagTipoObjDataTable tabella = new DS_XPS.AnagTipoObjDataTable();
|
||||
DataColumnCollection colonne = tabella.Columns;
|
||||
return colonne;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// inizializzazione valori di default
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
_idxGridView = "idxTipoObj";
|
||||
_tabCache = "tabAnagTipoObj";
|
||||
}
|
||||
void Mod_filtro1_eh_selValore(object sender, EventArgs e)
|
||||
{
|
||||
// ridisegno
|
||||
}
|
||||
/// <summary>
|
||||
/// setta selected alla riga il cui valore key è in session
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
// se riga di dati...
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
// ottengo la riga tipizzata...
|
||||
System.Data.DataRowView _drv = (System.Data.DataRowView)e.Row.DataItem;
|
||||
DS_XPS.AnagTipoObjRow riga = (DS_XPS.AnagTipoObjRow)_drv.Row;
|
||||
if (SteamWare.memLayer.ML.StringSessionObj(_idxGridView) == riga.IdxTipoObj.ToString())
|
||||
{
|
||||
grView.SelectedIndex = e.Row.RowIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// gestione evento inserimento nuovo record standard (se ZERO presenti)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNewFromEmpty_Click(object sender, EventArgs e)
|
||||
{
|
||||
// reset selezione...
|
||||
resetSelezione();
|
||||
DS_XPSTableAdapters.AnagTipoObjTableAdapter taTipoObj = new DS_XPSTableAdapters.AnagTipoObjTableAdapter();
|
||||
// creo 1 obj vuoto...
|
||||
taTipoObj.Insert("Nuovo Oggetto", 1, false, false);
|
||||
grView.DataBind();
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
|
||||
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
{
|
||||
//recupero la riga footer...
|
||||
DataColumnCollection colonne = colonneObj();
|
||||
string nomeCol;
|
||||
string tipoColonna = "";
|
||||
foreach (DataColumn colonna in colonne)
|
||||
{
|
||||
nomeCol = colonna.ColumnName;
|
||||
// cerco un textbox o quello che sia...
|
||||
if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null)
|
||||
{
|
||||
tipoColonna = "textBox";
|
||||
}
|
||||
else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null)
|
||||
{
|
||||
tipoColonna = "dropDownList";
|
||||
}
|
||||
else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null)
|
||||
{
|
||||
tipoColonna = "checkBox";
|
||||
}
|
||||
else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null)
|
||||
{
|
||||
tipoColonna = "selAjax";
|
||||
}
|
||||
// in base al tipo salvo negli inputparameters dell'ODS
|
||||
switch (tipoColonna)
|
||||
{
|
||||
case "textBox":
|
||||
e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text;
|
||||
break;
|
||||
case "dropDownList":
|
||||
e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue;
|
||||
break;
|
||||
case "checkBox":
|
||||
e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).Checked;
|
||||
break;
|
||||
case "selAjax":
|
||||
e.InputParameters[nomeCol] = ((mod_selettore_ajax)grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol))).valore;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
tipoColonna = "";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_anagraficaEventi.ascx.cs" Inherits="mod_anagraficaEventi" %>
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_anagraficaEventi.ascx.cs"
|
||||
Inherits="mod_anagraficaEventi" %>
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
|
||||
<asp:GridView ID="grView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
|
||||
Width="100%" OnSelectedIndexChanged="grView_SelectedIndexChanged" OnDataBound="grView_DataBound"
|
||||
OnSelectedIndexChanged="grView_SelectedIndexChanged" OnDataBound="grView_DataBound"
|
||||
DataKeyNames="idxEvento" DataSourceID="ods">
|
||||
<RowStyle CssClass="ctrRowStyle" />
|
||||
<AlternatingRowStyle CssClass="ctrAltRowStyle" />
|
||||
@@ -18,12 +19,12 @@
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<HeaderTemplate>
|
||||
<asp:Button ID="btnReset" runat="server" Text='<%# traduci("Reset") %>' OnClick="btnReset_Click" visible="false"/>
|
||||
<asp:Button ID="btnReset" runat="server" Text='<%# traduci("Reset") %>' OnClick="btnReset_Click"
|
||||
Visible="false" />
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="imgSelect" runat="server" CausesValidation="False" CommandName="Select"
|
||||
ToolTip='<%# traduci("Select") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.seleziona, SteamWare.dimImg.small) %>' />
|
||||
|
||||
<asp:ImageButton ID="imgEdit" runat="server" CausesValidation="False" CommandName="Edit"
|
||||
ToolTip='<%# traduci("Edit") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.modifica, SteamWare.dimImg.small) %>' />
|
||||
</ItemTemplate>
|
||||
@@ -35,29 +36,75 @@
|
||||
</EditItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:ImageButton ID="imgInsert" runat="server" CausesValidation="False" CommandName="Insert"
|
||||
ToolTip='<%# traduci("Insert") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.nuovo , SteamWare.dimImg.small) %>' OnClick="lblIns_click" />
|
||||
ToolTip='<%# traduci("Insert") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.nuovo , SteamWare.dimImg.small) %>'
|
||||
OnClick="lblIns_click" />
|
||||
<asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ToolTip='<%# traduci("Cancel") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.annulla , SteamWare.dimImg.small) %>' />
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="idxEvento" />
|
||||
<asp:BoundField DataField="DescrEvento" />
|
||||
<asp:TemplateField HeaderText="idxEvento" SortExpression="idxEvento">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="txtidxEvento" runat="server" Text='<%# Bind("idxEvento") %>'></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Bind("idxEvento") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:TextBox ID="txtidxEvento" runat="server" Text='<%# Bind("idxEvento") %>'></asp:TextBox>
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="DescrEvento" SortExpression="DescrEvento">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="txtDescrEvento" runat="server" Text='<%# Bind("DescrEvento") %>'></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label2" runat="server" Text='<%# Bind("DescrEvento") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:TextBox ID="txtDescrEvento" runat="server" Text='<%# Bind("DescrEvento") %>'></asp:TextBox>
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<HeaderTemplate>
|
||||
<asp:Button ID="btnNew" runat="server" OnClick="btnNew_Click" Text='<%# traduci("New") %>' />
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandName="Delete"
|
||||
ToolTip='<%# traduci("Delete") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.elimina , SteamWare.dimImg.small) %>' />
|
||||
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText='<%# traduci("confermaDel")%>'
|
||||
TargetControlID="imgDelete">
|
||||
</cc1:ConfirmButtonExtender>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:ImageButton ID="imgUpdate2" runat="server" CausesValidation="False" CommandName="Update"
|
||||
ToolTip='<%# traduci("Update")%>' ImageUrl='<%# imgPath(SteamWare.tipoImg.conferma , SteamWare.dimImg.small) %>' />
|
||||
<asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ToolTip='<%# traduci("Cancel") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.annulla , SteamWare.dimImg.small) %>' />
|
||||
</EditItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:ImageButton ID="imgInsert2" runat="server" CausesValidation="False" CommandName="Insert"
|
||||
ToolTip='<%# traduci("Insert") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.nuovo , SteamWare.dimImg.small) %>'
|
||||
OnClick="lblIns_click" />
|
||||
<asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ToolTip='<%# traduci("Cancel") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.annulla , SteamWare.dimImg.small) %>' />
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}"
|
||||
SelectMethod="GetData" TypeName="DS_XPSTableAdapters.EventiTableAdapter"
|
||||
OnInserting="recuperaFooter" FilterExpression=" DescrEvento LIKE '%{0}%'" OnUpdating="ods_Updating" OnInit="ods_Init" DeleteMethod="Delete" InsertMethod="Insert" UpdateMethod="Update">
|
||||
SelectMethod="GetData" TypeName="DS_XPSTableAdapters.EventiTableAdapter" OnInserting="recuperaFooter"
|
||||
FilterExpression=" DescrEvento LIKE '%{0}%'" DeleteMethod="DeleteQuery"
|
||||
InsertMethod="Insert" UpdateMethod="UpdateQuery" >
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
|
||||
</FilterParameters>
|
||||
<DeleteParameters>
|
||||
<asp:Parameter Name="Original_idxEvento" Type="Int32" />
|
||||
<asp:Parameter Name="Original_DescrEvento" Type="String" />
|
||||
</DeleteParameters>
|
||||
<UpdateParameters>
|
||||
<asp:Parameter Name="idxEvento" Type="Int32" />
|
||||
<asp:Parameter Name="DescrEvento" Type="String" />
|
||||
<asp:Parameter Name="Original_idxEvento" Type="Int32" />
|
||||
<asp:Parameter Name="Original_DescrEvento" Type="String" />
|
||||
</UpdateParameters>
|
||||
<InsertParameters>
|
||||
<asp:Parameter Name="idxEvento" Type="Int32" />
|
||||
|
||||
@@ -19,7 +19,6 @@ public partial class mod_anagraficaEventi : SteamWare.ApplicationUserControl
|
||||
#region area protected
|
||||
|
||||
protected string _idxGridView;
|
||||
//protected string _idxGridViewExt;
|
||||
protected string _tabCache;
|
||||
protected bool _showNewBtn = true;
|
||||
|
||||
@@ -123,6 +122,20 @@ public partial class mod_anagraficaEventi : SteamWare.ApplicationUserControl
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
public void resetSelezione()
|
||||
{
|
||||
SteamWare.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());
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// gestione evento richeista nuovo valore (mostra footer, ...)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
@@ -209,7 +222,6 @@ public partial class mod_anagraficaEventi : SteamWare.ApplicationUserControl
|
||||
resetSelezione();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
@@ -234,38 +246,27 @@ public partial class mod_anagraficaEventi : SteamWare.ApplicationUserControl
|
||||
// !!! FARE vero controllo cancellazione?
|
||||
return false;// (taRouteVersion.getByOggetti(idxObj.ToString(), vers.ToString()).Rows.Count == 0);
|
||||
}
|
||||
#if false
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// elenco colonne del datagrid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected DataColumnCollection colonneObj()
|
||||
{
|
||||
DS_applicazione.OggettiDataTable tabella = new DS_applicazione.OggettiDataTable();
|
||||
DS_XPS.EventiDataTable tabella = new DS_XPS.EventiDataTable();
|
||||
DataColumnCollection colonne = tabella.Columns;
|
||||
return colonne;
|
||||
return colonne;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// inizializzazione valori di default
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
_idxGridView = "idxObj";
|
||||
_tabCache = "tabOggetti";
|
||||
Mod_filtro1.eh_selValore += new EventHandler(Mod_filtro1_eh_selValore);
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
Mod_filtro1.ods = odsFiltro;
|
||||
}
|
||||
|
||||
_idxGridView = "idxEvento";
|
||||
_tabCache = "tabEventi";
|
||||
}
|
||||
#endif
|
||||
|
||||
void Mod_filtro1_eh_selValore(object sender, EventArgs e)
|
||||
{
|
||||
// ridisegno
|
||||
@@ -278,37 +279,20 @@ public partial class mod_anagraficaEventi : SteamWare.ApplicationUserControl
|
||||
/// <param name="e"></param>
|
||||
protected void grView_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
#if false
|
||||
// se riga di dati...
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
// ottengo la riga tipizzata...
|
||||
System.Data.DataRowView _drv = (System.Data.DataRowView)e.Row.DataItem;
|
||||
DS_applicazione.OggettiRow riga = (DS_applicazione.OggettiRow)_drv.Row;
|
||||
if (SteamWare.memLayer.ML.StringSessionObj(_idxGridView) == riga.idxObj.ToString())
|
||||
DS_XPS.EventiRow riga = (DS_XPS.EventiRow)_drv.Row;
|
||||
if (SteamWare.memLayer.ML.StringSessionObj(_idxGridView) == riga.idxEvento.ToString())
|
||||
{
|
||||
grView.SelectedIndex = e.Row.RowIndex;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
public void resetSelezione()
|
||||
{
|
||||
#if false
|
||||
SteamWare.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());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// gestione evento inserimento nuovo record standard (se ZERO presenti)
|
||||
/// </summary>
|
||||
@@ -316,19 +300,17 @@ public partial class mod_anagraficaEventi : SteamWare.ApplicationUserControl
|
||||
/// <param name="e"></param>
|
||||
protected void btnNewFromEmpty_Click(object sender, EventArgs e)
|
||||
{
|
||||
#if false
|
||||
// reset selezione...
|
||||
resetSelezione();
|
||||
DS_applicazioneTableAdapters.OggettiTableAdapter taOggetti = new DS_applicazioneTableAdapters.OggettiTableAdapter();
|
||||
DS_XPSTableAdapters.EventiTableAdapter taEventi = new DS_XPSTableAdapters.EventiTableAdapter();
|
||||
// creo 1 obj vuoto...
|
||||
taOggetti.Insert("Descrizione oggetto", Convert.ToInt32(Mod_filtro1.valore), "Cod brembo originale");
|
||||
taEventi.Insert(999, "Evento nullo");
|
||||
grView.DataBind();
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -339,7 +321,6 @@ public partial class mod_anagraficaEventi : SteamWare.ApplicationUserControl
|
||||
/// <param name="e"></param>
|
||||
protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
{
|
||||
#if false
|
||||
//recupero la riga footer...
|
||||
DataColumnCollection colonne = colonneObj();
|
||||
string nomeCol;
|
||||
@@ -384,27 +365,7 @@ public partial class mod_anagraficaEventi : SteamWare.ApplicationUserControl
|
||||
}
|
||||
tipoColonna = "";
|
||||
}
|
||||
e.InputParameters["idxTipoObj"] = Convert.ToInt32(Mod_filtro1.valore);
|
||||
e.InputParameters["codBrembo"] = e.InputParameters["codBrembo"].ToString().ToUpper();
|
||||
// svuoto cache...
|
||||
SteamWare.memLayer.ML.emptyCacheVal("_tabSelOggetti");
|
||||
#endif
|
||||
}
|
||||
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
{
|
||||
#if false
|
||||
e.InputParameters["idxTipoObj"] = Convert.ToInt32(Mod_filtro1.valore);
|
||||
e.InputParameters["codBrembo"] = e.InputParameters["codBrembo"].ToString().ToUpper();
|
||||
// svuoto cache...
|
||||
SteamWare.memLayer.ML.emptyCacheVal("_tabSelOggetti");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected void ods_Init(object sender, EventArgs e)
|
||||
{
|
||||
//SteamWare.XPS.DS_XPSTableAdapters.EventiTableAdapter ta = new SteamWare.XPS.DS_XPSTableAdapters.EventiTableAdapter();
|
||||
//ta.Connection.ConnectionString = "Data Source=localhost;Initial Catalog=LVF_JPS;Integrated Security=True";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_selettore_ajax.ascx.cs"
|
||||
Inherits="mod_selettore_ajax" %>
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
|
||||
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" Visible="true">
|
||||
<ContentTemplate>
|
||||
<ajaxToolkit:PopupControlExtender ID="pce" runat="server" TargetControlID="txtSelValue"
|
||||
PopupControlID="pnlSelettore" Position="Bottom" />
|
||||
<ajaxToolkit:PopupControlExtender ID="pce2" runat="server" TargetControlID="lblDescr"
|
||||
PopupControlID="pnlSelettore" Position="Bottom" CommitProperty="innerHTML" />
|
||||
<div class="selezioneValRed">
|
||||
<asp:TextBox ID="txtSelValue" runat="server" Width="0px" CssClass="hiddenTxt" BorderWidth="0px" TabIndex="-1"/>
|
||||
<asp:Label ID="lblDescr" runat="server" Text="-" />
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<asp:Panel ID="pnlSelettore" runat="server" CssClass="popupControl">
|
||||
<asp:UpdatePanel ID="updPnl1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<table cellpadding="0" cellspacing="0" width="50%">
|
||||
<tr>
|
||||
<td>
|
||||
<table cellpadding="2" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<asp:Label ID="lblCerca" runat="server"></asp:Label>
|
||||
|
||||
<asp:TextBox ID="txtCerca" runat="server" OnTextChanged="txtCerca_TextChanged" AutoPostBack="true" TabIndex="-1"></asp:TextBox>
|
||||
|
||||
<asp:Button ID="btnCerca" runat="server" Text="Cerca" OnClick="txtCerca_TextChanged" TabIndex="-1" />
|
||||
|
||||
<asp:CheckBox ID="chkOpzione" runat="server" AutoPostBack="True" OnCheckedChanged="chkOpzione_CheckedChanged" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<asp:GridView ID="grView" runat="server" OnSelectedIndexChanged="grView_SelectedIndexChanged"
|
||||
AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="ods"
|
||||
GridLines="None" OnDataBound="grView_DataBound" DataKeyNames="value" Width="500px"
|
||||
OnPageIndexChanged="grView_PageIndexChanged">
|
||||
<RowStyle CssClass="ctrRowStyle" />
|
||||
<AlternatingRowStyle CssClass="ctrAltRowStyle" />
|
||||
<EditRowStyle CssClass="ctrEditRowStyle" />
|
||||
<SelectedRowStyle CssClass="ctrSelRowStyle" />
|
||||
<FooterStyle CssClass="ctrFooter" BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
|
||||
<PagerStyle CssClass="ctrHeaderPager" ForeColor="White" HorizontalAlign="Center" />
|
||||
<HeaderStyle CssClass="ctrHeaderPager" ForeColor="White" Font-Bold="True" />
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Select"
|
||||
Text='<%# traduci("Sel") %>' TabIndex="-1"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ShowHeader="false">
|
||||
<ItemTemplate>
|
||||
<asp:Label runat="server" ID="lblValue" Text='<%# Eval("value") %>' Visible='<%# isValueVisible %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="label" HeaderText="label" SortExpression="label" HtmlEncode="false" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:Label ID="lblNumRec" runat="server" CssClass="txtMini"></asp:Label>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" SelectMethod="getSelAllUsers" TypeName="selettori"
|
||||
FilterExpression=" (label LIKE '%{0}%') OR (value LIKE '%{0}%')">
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter DefaultValue="*" Name="ricercaPopup" SessionField="ricercaPopup" />
|
||||
</FilterParameters>
|
||||
</asp:ObjectDataSource>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Panel>
|
||||
@@ -0,0 +1,500 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using SteamWare;
|
||||
|
||||
[ValidationProperty("valore")]
|
||||
public partial class mod_selettore_ajax : ApplicationUserControl
|
||||
{
|
||||
|
||||
protected bool _chkVisibile = false;
|
||||
protected bool _isValueVisible = false;
|
||||
protected bool _cambioTipo = false;
|
||||
|
||||
protected string _val1;
|
||||
protected string _val2;
|
||||
#region gestione eventi
|
||||
|
||||
public event EventHandler eh_selDone;
|
||||
public event EventHandler eh_update;
|
||||
|
||||
#endregion
|
||||
|
||||
#region gestione pagina
|
||||
|
||||
protected override void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
base.Page_Load(sender, e);
|
||||
updateChkOpzione();
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
SteamWare.memLayer.ML.emptySessionVal(searchSessionName);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void traduciObj()
|
||||
{
|
||||
base.traduciObj();
|
||||
lblCerca.Text = traduci("lblCerca");
|
||||
btnCerca.Text = traduci("search");
|
||||
if (_chkVisibile)
|
||||
{
|
||||
updateChkOpzione();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
_val1 = "";
|
||||
_val2 = "";
|
||||
if (vistaModulo == SteamWare.tipoVistaMod.editing)
|
||||
{
|
||||
setSearchValue();
|
||||
impostaCampoRicerca();
|
||||
pce.Enabled = true;
|
||||
pce2.Enabled = true;
|
||||
lblDescr.CssClass = "txtLink";
|
||||
}
|
||||
else if (vistaModulo == SteamWare.tipoVistaMod.selezione)
|
||||
{
|
||||
pce.Enabled = false;
|
||||
pce2.Enabled = false;
|
||||
lblDescr.CssClass = "txtValue";
|
||||
}
|
||||
traduciObj();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta il valore della ricerca da quello in session
|
||||
/// </summary>
|
||||
private void setSearchValue()
|
||||
{
|
||||
if (SteamWare.memLayer.ML.isInSessionObject(searchSessionName))
|
||||
{
|
||||
testoRicerca = SteamWare.memLayer.ML.StringSessionObj(searchSessionName);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta i campi del filtro ricerca in session
|
||||
/// </summary>
|
||||
private void impostaCampoRicerca()
|
||||
{
|
||||
// imposto il nome del valore session x ricerca a campo univoco...
|
||||
SessionParameter parametroFiltro = new SessionParameter();
|
||||
parametroFiltro.SessionField = searchSessionName;
|
||||
parametroFiltro.Name = searchSessionName;
|
||||
parametroFiltro.DefaultValue = "*";
|
||||
ods.FilterParameters.Clear();
|
||||
ods.FilterParameters.Add(parametroFiltro);
|
||||
}
|
||||
/// <summary>
|
||||
/// setta il nome del campo di ricerca
|
||||
/// </summary>
|
||||
protected string searchSessionName
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("ricerca_{0}", _tipoSelettore);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region area protected
|
||||
|
||||
protected string _conditio = "";
|
||||
protected string testoRicerca
|
||||
{
|
||||
get
|
||||
{
|
||||
return txtCerca.Text.Trim();
|
||||
}
|
||||
set
|
||||
{
|
||||
txtCerca.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected selettori _selettori = new selettori();
|
||||
/// <summary>
|
||||
/// a seconda del tipo di selettore cambierà l'origine ods
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void chkOpzione_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
fixChkOds();
|
||||
}
|
||||
|
||||
protected void setCheck()
|
||||
{
|
||||
if (_tipoSelettore == tipoSelettore.utentiAll || _tipoSelettore == tipoSelettore.utentiCdc)
|
||||
{
|
||||
_chkVisibile = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_chkVisibile = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// aggiorna visualizzazione del check opzionale con label e visibilità
|
||||
/// </summary>
|
||||
protected void updateChkOpzione()
|
||||
{
|
||||
// se definito il tipo decido SE mostrare il check e tradurre la label...
|
||||
if (_tipoSelettore == tipoSelettore.utentiAll || _tipoSelettore == tipoSelettore.utentiCdc)
|
||||
{
|
||||
chkOpzione.Visible = true;
|
||||
chkOpzione.Text = traduci("chkSoloGer");
|
||||
if (_tipoSelettore == tipoSelettore.utentiCdc)
|
||||
{
|
||||
chkOpzione.Checked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chkOpzione.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// aggiorna la label che traduce il valore a seconda del tipo di oggetto...
|
||||
/// </summary>
|
||||
protected void aggiornaLabelDaValore()
|
||||
{
|
||||
// x ora metto valore di default...
|
||||
string _answ = "-";
|
||||
if (txtSelValue.Text != "")
|
||||
{
|
||||
System.Data.DataView tabella = (System.Data.DataView)ods.Select();
|
||||
tabella.RowFilter = string.Format("value = '{0}'", txtSelValue.Text);
|
||||
try
|
||||
{
|
||||
_answ = tabella.ToTable().Rows[0]["label"].ToString();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
lblDescr.Text = _answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// aggiorna label e valore principale da una chiave multipart
|
||||
/// </summary>
|
||||
private void aggiornaDaValMulti()
|
||||
{
|
||||
// eseguo SE E SOLO SE entrambi i valori sono popolati
|
||||
if (val1 != "" && val1 != null)
|
||||
{
|
||||
if (val2 != "" && val2 != null && val2 != "na")
|
||||
{
|
||||
txtSelValue.Text = string.Format("{0}#{1}", val1, val2);
|
||||
aggiornaLabelDaValore();
|
||||
}
|
||||
else
|
||||
{
|
||||
txtSelValue.Text = val1;
|
||||
aggiornaLabelDaValore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// tipo di valori mostrati
|
||||
/// </summary>
|
||||
protected tipoSelettore _tipoSelettore = tipoSelettore.cdc;
|
||||
/// <summary>
|
||||
/// nome del controllo gestito dal nostro popup
|
||||
/// </summary>
|
||||
protected string _targetControl = "";
|
||||
/// <summary>
|
||||
/// sistemo gli ods
|
||||
/// </summary>
|
||||
protected override void bindControlli()
|
||||
{
|
||||
base.bindControlli();
|
||||
fixChkOds();
|
||||
fixOds();
|
||||
}
|
||||
/// <summary>
|
||||
/// sistema l'ods dato lo stato del chk
|
||||
/// </summary>
|
||||
protected void fixChkOds()
|
||||
{
|
||||
if (_tipoSelettore == tipoSelettore.utentiAll || _tipoSelettore == tipoSelettore.utentiCdc)
|
||||
{
|
||||
// verifico se sia o meno checked "solo cdc utente"...
|
||||
if (chkOpzione.Checked)
|
||||
{
|
||||
//imposto nuovo tipo selettore
|
||||
_tipoSelettore = tipoSelettore.utentiCdc;
|
||||
fixOds();
|
||||
}
|
||||
else
|
||||
{
|
||||
//imposto nuovo tipo selettore
|
||||
_tipoSelettore = tipoSelettore.utentiAll;
|
||||
fixOds();
|
||||
}
|
||||
// faccio databind...
|
||||
grView.PageIndex = 0;
|
||||
grView.DataBind();
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// sistemazione fonte ods...
|
||||
/// </summary>
|
||||
protected void fixOds()
|
||||
{
|
||||
string _selectMethod = "";
|
||||
switch (_tipoSelettore)
|
||||
{
|
||||
case tipoSelettore.cdc:
|
||||
_selectMethod = "getSelAllCdC";
|
||||
break;
|
||||
case tipoSelettore.utentiAll:
|
||||
_selectMethod = "getSelAllUsers";
|
||||
break;
|
||||
case tipoSelettore.utentiCdc:
|
||||
_selectMethod = "getSelUsersGer";
|
||||
break;
|
||||
}
|
||||
ods.SelectMethod = _selectMethod;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// traduce gli header delle colonne
|
||||
/// </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 = "";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// selezione annullata su cambio pagina
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_PageIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
grView.SelectedIndex = -1;
|
||||
}
|
||||
/// <summary>
|
||||
/// aggiornamento filtro da stringa di ricerca del popup
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtCerca_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
// se cambio filtro tolgo il selected...
|
||||
grView.SelectedIndex = -1;
|
||||
// salvo la ricerca in session e filter dell'ods...
|
||||
SteamWare.memLayer.ML.setSessionVal(searchSessionName, txtCerca.Text);
|
||||
impostaCampoRicerca();
|
||||
fixChkOds();
|
||||
fixOds();
|
||||
}
|
||||
/// <summary>
|
||||
/// salvo il valore selezionato
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string valore = grView.SelectedValue.ToString();
|
||||
lblDescr.Text = grView.SelectedRow.Cells[2].Text.ToString();
|
||||
UpdatePanel1.Update();
|
||||
pce.Commit(valore);
|
||||
pce2.Commit(grView.SelectedRow.Cells[2].Text.ToString());
|
||||
// se ho una chiave multiparte salvo nei 2 valori...
|
||||
if (valore.IndexOf('#') > -1)
|
||||
{
|
||||
string[] valori = valore.Split('#');
|
||||
val1 = valori[0];
|
||||
val2 = valori[1];
|
||||
}
|
||||
if (eh_selDone != null)
|
||||
{
|
||||
eh_selDone(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// resetta ricerca e selezione
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnReset_Click(object sender, EventArgs e)
|
||||
{
|
||||
grView.SelectedIndex = -1;
|
||||
testoRicerca = "";
|
||||
SteamWare.memLayer.ML.emptySessionVal(searchSessionName);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region area public
|
||||
|
||||
/// <summary>
|
||||
/// tipo di selettore da istanziare
|
||||
/// </summary>
|
||||
public tipoSelettore tipo
|
||||
{
|
||||
get
|
||||
{
|
||||
return _tipoSelettore;
|
||||
}
|
||||
set
|
||||
{
|
||||
_tipoSelettore = value;
|
||||
setCheck();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua update del controllo
|
||||
/// </summary>
|
||||
public void doUpdate()
|
||||
{
|
||||
// svuoto ricerca...
|
||||
SteamWare.memLayer.ML.emptySessionVal(searchSessionName);
|
||||
testoRicerca = "";
|
||||
// imposto valori cercati...
|
||||
setSearchValue();
|
||||
impostaCampoRicerca();
|
||||
// continuo con update
|
||||
updateChkOpzione();
|
||||
fixOds();
|
||||
aggiornaDaValMulti();
|
||||
// faccio databind...
|
||||
grView.PageIndex = 0;
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// valore mostrato nel campo testo del selettore
|
||||
/// </summary>
|
||||
public string valore
|
||||
{
|
||||
get
|
||||
{
|
||||
return txtSelValue.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtSelValue.Text = value;
|
||||
aggiornaLabelDaValore();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// valore di una chiave multiparte
|
||||
/// </summary>
|
||||
public string val1
|
||||
{
|
||||
get
|
||||
{
|
||||
return _val1;
|
||||
}
|
||||
set
|
||||
{
|
||||
_val1 = value;
|
||||
aggiornaDaValMulti();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// valore di una chiave multiparte
|
||||
/// </summary>
|
||||
public string val2
|
||||
{
|
||||
get
|
||||
{
|
||||
return _val2;
|
||||
}
|
||||
set
|
||||
{
|
||||
_val2 = value;
|
||||
aggiornaDaValMulti();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// impone una condizione di filtro sui valori mostrati
|
||||
/// </summary>
|
||||
public string conditio
|
||||
{
|
||||
get
|
||||
{
|
||||
return _conditio;
|
||||
}
|
||||
set
|
||||
{
|
||||
_conditio = value;
|
||||
if (_conditio != "")
|
||||
{
|
||||
ods.SelectParameters.Clear();
|
||||
ods.SelectParameters.Add("where", string.Format(" conditio = '{0}' ", _conditio));
|
||||
}
|
||||
else
|
||||
{
|
||||
ods.SelectParameters.Clear();
|
||||
ods.SelectParameters.Add("where", " conditio = '*' ");
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// determina se il valore da selezionare sia da visualizzare o meno
|
||||
/// </summary>
|
||||
public bool isValueVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isValueVisible;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isValueVisible = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
public enum tipoSelettore
|
||||
{
|
||||
cdc,
|
||||
utentiAll,
|
||||
utentiCdc
|
||||
}
|
||||
Reference in New Issue
Block a user