Iniziata maschera gesitone famiglie macchine da completare...

git-svn-id: https://keyhammer.ath.cx/svn/WebGIM/trunk@19 3e04ef4b-3b25-4b6c-be27-bb5389ca777b
This commit is contained in:
samuele
2009-01-20 17:35:31 +00:00
parent 3db64f34b5
commit 653aaa23d3
12 changed files with 981 additions and 9 deletions
+8
View File
@@ -0,0 +1,8 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/AjaxSearch.master" AutoEventWireup="true" CodeFile="famiglieMacchine.aspx.cs" Inherits="famiglieMacchine" %>
<%@ Register src="mod_famiglieMacchine.ascx" tagname="mod_famiglieMacchine" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<uc1:mod_famiglieMacchine ID="mod_famiglieMacchine1" runat="server" />
</asp:Content>
+13
View File
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class famiglieMacchine : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
+88
View File
@@ -0,0 +1,88 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_elFamMacch.ascx.cs"
Inherits="mod_elFamMacch" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:GridView ID="grView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="idxFamMacchine" DataSourceID="ods"
OnDataBound="grView_DataBound" OnRowEditing="grView_RowEditing"
onselectedindexchanged="grView_SelectedIndexChanged">
<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" ItemStyle-HorizontalAlign="Center">
<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>
<HeaderTemplate>
<asp:Button ID="btnReset" runat="server" Text='<%# traduci("Reset") %>' OnClick="btnReset_Click" />
</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>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="idxFamMacchine" HeaderText="idxFamMacchine" InsertVisible="False"
Visible="false" ReadOnly="True" SortExpression="idxFamMacchine" />
<asp:TemplateField HeaderText="nomeFamMacch" SortExpression="nomeFamMacch">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Width="30em" Text='<%# Bind("nomeFamMacch") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("nomeFamMacch") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<HeaderTemplate>
<asp:Button ID="btnNew" runat="server" OnClick="btnNewFromEmpty_Click" Text='<%# traduci("New") %>' />
</HeaderTemplate>
<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>
<ItemTemplate>
<asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandName="Delete" Visible='<%# isDeletable(Eval("idxFamMacchine")) %>'
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>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Label ID="lblNumRec" runat="server" CssClass="txtMini"></asp:Label>
<asp:ObjectDataSource ID="ods" runat="server" SelectMethod="GetData" TypeName="DS_applicazioneTableAdapters.AnagFamMacchineTableAdapter"
UpdateMethod="Update" DeleteMethod="Delete" OldValuesParameterFormatString="Original_{0}"
FilterExpression="nomeFamMacch LIKE '%{0}%' " InsertMethod="Insert"
onupdated="ods_Updated">
<UpdateParameters>
<asp:Parameter Name="nomeFamMacch" Type="String" />
<asp:Parameter Name="Original_idxFamMacchine" Type="Int32" />
</UpdateParameters>
<FilterParameters>
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
</FilterParameters>
<DeleteParameters>
<asp:Parameter Name="Original_idxFamMacchine" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="nomeFamMacch" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
+129
View File
@@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
public partial class mod_elFamMacch : ApplicationUserControl
{
public event EventHandler eh_selezioneValore;
public event EventHandler eh_resetSelezione;
/// <summary>
/// evento dati associati a controllo
/// </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>
/// reset delle selezioni
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnReset_Click(object sender, EventArgs e)
{
resetSelezione();
}
/// <summary>
/// resetta la selezione dei valori in caso di modifiche su altri controlli
/// </summary>
public void resetSelezione()
{
grView.SelectedIndex = -1;
grView.DataBind();
if (eh_resetSelezione != null)
{
eh_resetSelezione(this, new EventArgs());
}
}
/// <summary>
/// seleziono valore in editing...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grView_RowEditing(object sender, GridViewEditEventArgs e)
{
// seleziono la riga corrente...
grView.SelectedIndex = e.NewEditIndex;
}
/// <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();
// i primi valori ("0") di default sono "ND"... li inserisco come standard...
DS_applicazioneTableAdapters.AnagFamMacchineTableAdapter taFamMacc = new DS_applicazioneTableAdapters.AnagFamMacchineTableAdapter();
taFamMacc.Insert("-- [NUOVA] n.d. --");
grView.DataBind();
}
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
if (eh_selezioneValore != null)
{
eh_selezioneValore(this, new EventArgs());
}
}
/// <summary>
/// restituisce il valore selezionato...
/// </summary>
public int idxFamMacc_sel
{
get
{
return Convert.ToInt32(grView.SelectedValue);
}
}
protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e)
{
grView.SelectedIndex = -1;
grView.DataBind();
}
/// <summary>
/// determina se sia cancellabile
/// </summary>
/// <param name="idx"></param>
/// <returns></returns>
public bool isDeletable(object idx)
{
bool answ=false;
if (TA_app.obj.taMacc2Fam.getByFam(Convert.ToInt32(idx)).Rows.Count == 0)
{
answ = true;
}
return answ;
}
/// <summary>
/// esegue update
/// </summary>
public void doUpdate()
{
grView.DataBind();
}
}
+56
View File
@@ -0,0 +1,56 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_elMacch2Fam.ascx.cs"
Inherits="mod_elMacch2Fam" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:GridView ID="grView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="idxFamMacchine,idxMacchina" DataSourceID="ods" OnDataBound="grView_DataBound" >
<RowStyle CssClass="ctrRowStyleDet" />
<AlternatingRowStyle CssClass="ctrAltRowStyleDet" />
<EditRowStyle CssClass="ctrEditRowStyleDet" />
<SelectedRowStyle CssClass="ctrSelRowStyleDet" />
<FooterStyle CssClass="ctrFooterDet" />
<PagerStyle CssClass="ctrHeaderPagerDet" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle CssClass="ctrHeaderPagerDet" ForeColor="White" Font-Bold="True" />
<EmptyDataRowStyle CssClass="ctrRowStyleDet" />
<EmptyDataTemplate>
<asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
</EmptyDataTemplate>
<Columns>
<asp:BoundField DataField="idxFamMacchine" HeaderText="idxFamMacchine" Visible="false"
ReadOnly="True" />
<asp:BoundField DataField="idxMacchina" HeaderText="idxMacchina" Visible="false"
ReadOnly="True" />
<asp:TemplateField HeaderText="macchina" SortExpression="macchina">
<ItemTemplate>
<asp:Label ID="lblMacchina" runat="server" Text='<%# Bind("macchina") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<HeaderTemplate>
</HeaderTemplate>
<EditItemTemplate>
</EditItemTemplate>
<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>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Label ID="lblNumRec" runat="server" CssClass="txtMini"></asp:Label>
<asp:Label ID="lblFamMacc" runat="server" Visible="false" Text="0" />
<asp:ObjectDataSource ID="ods" runat="server" SelectMethod="getByFam" TypeName="DS_applicazioneTableAdapters.v_selFamMaccTableAdapter"
DeleteMethod="DeleteQuery" OldValuesParameterFormatString="Original_{0}"
onDeleted="ods_Deleted" >
<SelectParameters>
<asp:ControlParameter DefaultValue="*" ControlID="lblFamMacc" Name="idxFamMacchine"
Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="Original_idxMacchina" Type="Int32" />
<asp:Parameter Name="Original_idxFamMacchine" Type="Int32" />
</DeleteParameters>
</asp:ObjectDataSource>
+67
View File
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
public partial class mod_elMacch2Fam : ApplicationUserControl
{
public event EventHandler eh_selezioneValore;
public event EventHandler eh_delValore;
/// <summary>
/// evento dati associati a controllo
/// </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>
/// indica il valore dell'impianto filtrato in visualizzazione
/// </summary>
public int idxFamMacchSel
{
get
{
return Convert.ToInt32(lblFamMacc.Text);
}
set
{
lblFamMacc.Text = value.ToString();
}
}
/// <summary>
/// eliminato il valore genera l'evento
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ods_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
{
if (eh_delValore != null)
{
eh_delValore(this, new EventArgs());
}
}
}
+19
View File
@@ -0,0 +1,19 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_famiglieMacchine.ascx.cs"
Inherits="mod_famiglieMacchine" %>
<%@ Register Src="mod_elFamMacch.ascx" TagName="mod_elFamMacch" TagPrefix="uc1" %>
<%@ Register Src="mod_elMacch2Fam.ascx" TagName="mod_elMacch2Fam" TagPrefix="uc2" %>
<%@ Register Src="mod_selettore.ascx" TagName="mod_selettore" TagPrefix="uc3" %>
<div>
<div style="float: left; width: 50%;">
<uc1:mod_elFamMacch ID="mod_elFamMacch1" runat="server" />
<br />
<asp:Button ID="btnShowAdd" runat="server" onclick="btnShowAdd_Click" />
<asp:Panel runat="server" ID="pnlSceltaMacchine" Visible="false">
<asp:Button ID="btnAddMacchine" runat="server" onclick="btnAddMacchine_Click" />
aaa
</asp:Panel>
</div>
<div style="float: left;">
<uc2:mod_elMacch2Fam ID="mod_elMacch2Fam1" runat="server" Visible="false" />
</div>
</div>
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
public partial class mod_famiglieMacchine : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
mod_elFamMacch1.eh_selezioneValore += new EventHandler(mod_elFamMacch1_eh_selezioneValore);
mod_elFamMacch1.eh_resetSelezione += new EventHandler(mod_elFamMacch1_eh_resetSelezione);
mod_elMacch2Fam1.eh_delValore += new EventHandler(mod_elMacch2Fam1_eh_delValore);
traduci();
}
private void traduci()
{
btnShowAdd.Text = user_std.UtSn.Traduci("showAddMacchine");
btnAddMacchine.Text = user_std.UtSn.Traduci("AddMacchine2Fam");
}
void mod_elMacch2Fam1_eh_delValore(object sender, EventArgs e)
{
mod_elFamMacch1.doUpdate();
}
void mod_elFamMacch1_eh_resetSelezione(object sender, EventArgs e)
{
mod_elMacch2Fam1.Visible = false;
}
void mod_elFamMacch1_eh_selezioneValore(object sender, EventArgs e)
{
mod_elMacch2Fam1.idxFamMacchSel = mod_elFamMacch1.idxFamMacc_sel;
mod_elMacch2Fam1.Visible = true;
}
protected void btnAddMacchine_Click(object sender, EventArgs e)
{
// salvo...
}
protected void btnShowAdd_Click(object sender, EventArgs e)
{
pnlSceltaMacchine.Visible = !pnlSceltaMacchine.Visible;
if (pnlSceltaMacchine.Visible)
{
btnShowAdd.Text = user_std.UtSn.Traduci("hideAddMacchine");
}
else
{
btnShowAdd.Text = user_std.UtSn.Traduci("showAddMacchine");
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_menuBottom.ascx.cs"
Inherits="mod_menuBottom" %>
<asp:Label runat="server" ID="lblApp" Text="."></asp:Label><asp:Label ID="lblrev" runat="server">17 - </asp:Label>
<asp:Label runat="server" ID="lblApp" Text="."></asp:Label><asp:Label ID="lblrev" runat="server">20 - </asp:Label>
<asp:Label runat="server" ID="lblCopyRight" Text="..."></asp:Label>
+58
View File
@@ -0,0 +1,58 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_selettore.ascx.cs"
Inherits="mod_selettore" %>
<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>
&nbsp;
<asp:TextBox ID="txtCerca" runat="server" OnTextChanged="txtCerca_TextChanged" AutoPostBack="true" TabIndex="-1"></asp:TextBox>
&nbsp;
<asp:Button ID="btnCerca" runat="server" Text="Cerca" OnClick="txtCerca_TextChanged" TabIndex="-1" />
&nbsp;
<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>&nbsp;&nbsp;
<asp:ObjectDataSource ID="ods" runat="server" SelectMethod="getSelAllUsers" TypeName="selData"
FilterExpression=" (label LIKE '%{0}%') OR (value LIKE '%{0}%')">
<FilterParameters>
<asp:SessionParameter DefaultValue="*" Name="ricercaPopup" SessionField="ricercaPopup" />
</FilterParameters>
</asp:ObjectDataSource>
</td>
</tr>
</table>
+486
View File
@@ -0,0 +1,486 @@
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 : ApplicationUserControl
{
protected bool _chkVisibile = false;
protected bool _isValueVisible = false;
protected bool _cambioTipo = false;
protected string _valoreFull;
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)
{
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 = "";
traduciObj();
}
if (vistaModulo == tipoVistaMod.editing)
{
setSearchValue();
impostaCampoRicerca();
}
}
/// <summary>
/// imposta il valore della ricerca da quello in session
/// </summary>
private void setSearchValue()
{
if (memLayer.ML.isInSessionObject(searchSessionName))
{
testoRicerca = 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 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")
{
_valoreFull = string.Format("{0}#{1}", val1, val2);
}
else
{
_valoreFull = val1;
}
}
}
/// <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();
}
#if false
else if (_tipoSelettore == tipoSelettore.utentiAD_All || _tipoSelettore == tipoSelettore.utentiAD_cdc)
{
// verifico se sia o meno checked "solo cdc utente"...
if (chkOpzione.Checked)
{
//imposto nuovo tipo selettore
_tipoSelettore = tipoSelettore.utentiAD_cdc;
fixOds();
}
else
{
//imposto nuovo tipo selettore
_tipoSelettore = tipoSelettore.utentiAD_All;
fixOds();
}
// faccio databind...
grView.PageIndex = 0;
grView.DataBind();
}
#endif
}
/// <summary>
/// sistemazione fonte ods...
/// </summary>
protected void fixOds()
{
string _selectMethod = "";
switch (_tipoSelettore)
{
case tipoSelettore.cdc:
_selectMethod = "getSelAllCdC";
break;
case tipoSelettore.impianti:
_selectMethod = "getSelImpianti";
break;
case tipoSelettore.macchine:
_selectMethod = "getSelMacchine";
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...
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();
// 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 = "";
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...
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 grView.SelectedValue.ToString();
}
set
{
_valoreFull = value;
}
}
/// <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
}
@@ -497,11 +497,3 @@ public partial class mod_selettore_ajax : ApplicationUserControl
#endregion
}
public enum tipoSelettore
{
cdc,
impianti,
macchine,
utentiAll,
utentiCdc
}