Bozza elenco richieste...

git-svn-id: https://keyhammer.ath.cx/svn/WebGIM/trunk@27 3e04ef4b-3b25-4b6c-be27-bb5389ca777b
This commit is contained in:
samuele
2009-01-22 11:15:34 +00:00
parent 12c0437ac8
commit 500b200860
8 changed files with 510 additions and 24 deletions
+8
View File
@@ -0,0 +1,8 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/AjaxSearch.master" AutoEventWireup="true" CodeFile="elencoRichieste.aspx.cs" Inherits="elencoRichieste" %>
<%@ Register src="mod_elencoRichieste.ascx" tagname="mod_elencoRichieste" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<uc1:mod_elencoRichieste ID="mod_elencoRichieste1" runat="server" />
</asp:Content>
@@ -4,7 +4,7 @@ using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class listRichieste : System.Web.UI.Page
public partial class elencoRichieste : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
-8
View File
@@ -1,8 +0,0 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/AjaxSearch.master" AutoEventWireup="true" CodeFile="listRichieste.aspx.cs" Inherits="listRichieste" %>
<%@ Register src="mod_listRichieste.ascx" tagname="mod_listRichieste" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<uc1:mod_listRichieste ID="mod_listRichieste1" runat="server" />
</asp:Content>
+124
View File
@@ -0,0 +1,124 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_elencoRichieste.ascx.cs"
Inherits="mod_elencoRichieste" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<div style="width: 100%; background: #cdcdcd;">
area filtraggi vari
</div>
<div>
<asp:GridView ID="grView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
Width="100%" OnSelectedIndexChanged="grView_SelectedIndexChanged" OnDataBound="grView_DataBound"
DataKeyNames="numIntMtz" DataSourceID="ods" OnRowDataBound="grView_RowDataBound"
OnRowUpdating="grView_RowUpdating">
<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") %>' />
</EmptyDataTemplate>
<Columns>
<%--<asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center">
<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) %>' />
&nbsp;
<asp:ImageButton ID="imgEdit" runat="server" CausesValidation="False" CommandName="Edit"
ToolTip='<%# traduci("Edit") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.modifica, SteamWare.dimImg.small) %>'
Visible='<%# isDeletable(Eval("idxImpianto")) %>' />
</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) %>' />
<asp:ImageButton ID="imgClona" runat="server" CausesValidation="False" ToolTip='<%# traduci("clonaRecord") %>'
ImageUrl='<%# imgPath(SteamWare.tipoImg.clona , SteamWare.dimImg.small) %>' CommandArgument="clonaObj"
CommandName="Update" OnClick="imgClona_Click" />
</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>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>--%>
<asp:BoundField DataField="numIntMtz" HeaderText="numIntMtz" Visible="true" ReadOnly="True"
SortExpression="numIntMtz" />
<asp:BoundField DataField="richiesta" HeaderText="richiesta" SortExpression="richiesta" />
<asp:BoundField DataField="dataLav" HeaderText="dataLav" SortExpression="dataLav" />
<asp:BoundField DataField="turnoLav" HeaderText="turnoLav" SortExpression="turnoLav" />
<asp:BoundField DataField="matr" HeaderText="matr" SortExpression="matr" />
<asp:BoundField DataField="guasto" HeaderText="guasto" SortExpression="guasto" />
<asp:BoundField DataField="idxAmbito" HeaderText="idxAmbito" SortExpression="idxAmbito" />
<asp:BoundField DataField="idxPriorita" HeaderText="idxPriorita" SortExpression="idxPriorita" />
<asp:BoundField DataField="isFermo" HeaderText="isFermo" SortExpression="isFermo" />
<asp:BoundField DataField="idxTipo" HeaderText="idxTipo" SortExpression="idxTipo" />
<asp:BoundField DataField="idxImpianto" HeaderText="idxImpianto" SortExpression="idxImpianto" />
<asp:BoundField DataField="idxMacchina" HeaderText="idxMacchina" SortExpression="idxMacchina" />
<asp:BoundField DataField="descrizione" HeaderText="descrizione" SortExpression="descrizione" />
<asp:BoundField DataField="idxStato" HeaderText="idxStato" SortExpression="idxStato" />
<asp:BoundField DataField="presaInCarico" HeaderText="presaInCarico" SortExpression="presaInCarico" />
<asp:BoundField DataField="inizioIntervento" HeaderText="inizioIntervento" SortExpression="inizioIntervento" />
<asp:BoundField DataField="fineIntervento" HeaderText="fineIntervento" SortExpression="fineIntervento" />
<asp:BoundField DataField="descrizioneIntervento" HeaderText="descrizioneIntervento"
SortExpression="descrizioneIntervento" />
<asp:BoundField DataField="isPreventivabile" HeaderText="isPreventivabile" SortExpression="isPreventivabile" />
<asp:BoundField DataField="idxCausale" HeaderText="idxCausale" SortExpression="idxCausale" />
<asp:BoundField DataField="descrAmbitoGuasto" HeaderText="descrAmbitoGuasto" SortExpression="descrAmbitoGuasto" />
<asp:BoundField DataField="descrPriorita" HeaderText="descrPriorita" SortExpression="descrPriorita" />
<asp:BoundField DataField="descrTipo" HeaderText="descrTipo" SortExpression="descrTipo" />
<asp:BoundField DataField="codImpianto" HeaderText="codImpianto" SortExpression="codImpianto" />
<asp:BoundField DataField="nomeImpianto" HeaderText="nomeImpianto" SortExpression="nomeImpianto" />
<asp:BoundField DataField="codMacchina" HeaderText="codMacchina" SortExpression="codMacchina" />
<asp:BoundField DataField="nomeMacchina" HeaderText="nomeMacchina" SortExpression="nomeMacchina" />
<asp:BoundField DataField="DescrStato" HeaderText="DescrStato" SortExpression="DescrStato" />
<asp:BoundField DataField="descrCausale" HeaderText="descrCausale" SortExpression="descrCausale" />
<%--<asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center">
<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"
CommandArgument='<%# Eval("idxImpianto") %>' ToolTip='<%# traduci("Delete") %>'
Visible='<%# isDeletable(Eval("idxImpianto")) %>' 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>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>--%>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="DS_applicazioneTableAdapters.v_intervExpTableAdapter"
OnInserting="recuperaFooter" FilterExpression=" codImpianto LIKE '%{0}%' OR nomeImpianto LIKE '%{0}%' OR codMacchina LIKE '%{0}%' OR nomeMacchina LIKE '%{0}%' OR descrizione LIKE '%{0}%' "
OnInserted="ods_Updated" OnUpdated="ods_Updated">
<FilterParameters>
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
</FilterParameters>
</asp:ObjectDataSource>
<asp:Label ID="lblNumRec" runat="server" CssClass="txtMini" />
<asp:Label ID="lblWarning" runat="server" Visible="false" CssClass="erroreMid" />
</div>
+376
View File
@@ -0,0 +1,376 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
using System.Data;
public partial class mod_elencoRichieste : ApplicationUserControl
{
#region area da NON modificare
#region area protected
protected string _idxGridView;
protected string _idxGridViewExt;
protected bool _showNewBtn = false;
/// <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>
/// 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("cal_{0}", nomeCol)) != null)
{
tipoColonna = "calTextBox";
}
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 "calTextBox":
e.InputParameters[nomeCol] = Convert.ToDateTime(((TextBox)grView.FooterRow.FindControl(string.Format("cal_{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 = "";
}
}
/// <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();
}
/// <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>
/// 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>
/// 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());
}
}
/// <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());
}
}
#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>
/// verifica complessiva non esistenza record child
/// </summary>
/// <param name="idxObj"></param>
/// <returns></returns>
protected bool objIsNotRelated(object idxObj)
{
return false;// taMacchine.getByIdxFase(idxObj.ToString()).Rows.Count == 0;
}
/// <summary>
/// elenco colonne del datagrid
/// </summary>
/// <returns></returns>
protected DataColumnCollection colonneObj()
{
DS_applicazione.v_intervExpDataTable tabella = new DS_applicazione.v_intervExpDataTable();
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 = "numIntMtz";
}
/// <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_applicazione.v_intervExpRow riga = (DS_applicazione.v_intervExpRow)_drv.Row;
if (SteamWare.memLayer.ML.StringSessionObj(_idxGridView) == riga.idxImpianto.ToString())
{
grView.SelectedIndex = e.Row.RowIndex;
// salvo in session il valore selezionato...
SteamWare.memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), SteamWare.memLayer.ML.StringSessionObj(_idxGridView));
// 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)
{
// svuoto da cache...
}
/// <summary>
/// in caso di aggiornamento verifico se sia salvato un comando clona...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grView_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
// carico l'idx dell'oggetto
int _idx = Convert.ToInt32(e.Keys["numIntMtz"]);
string _comando = "";
if (SteamWare.memLayer.ML.isInSessionObject("nextObjCommand"))
{
_comando = SteamWare.memLayer.ML.StringSessionObj("nextObjCommand");
SteamWare.memLayer.ML.emptySessionVal("nextObjCommand");
}
// verifico il tipo di richiesta (up/down level, clona o update normale
switch (_comando)
{
case "clonaObj":
#if false
TA_app.obj.taImpianti.sp_clonaImpianto(_idx);
grView.EditIndex = -1;
grView.DataBind();
#endif
// blocco update!
e.Cancel = true;
break;
default:
// faccio update!
break;
}
}
#endregion
}
+1 -1
View File
@@ -162,7 +162,7 @@
<br />
<asp:LinkButton runat="server" ID="lnkbInsertNewReq" OnClick="lnkbtnInsertNewReq_Click" />
&nbsp;&nbsp;
<asp:HyperLink runat="server" ID="lnkGoToReqList" NavigateUrl="~/listRichieste.aspx" />
<asp:HyperLink runat="server" ID="lnkGoToReqList" NavigateUrl="~/elencoRichieste.aspx" />
</div>
</div>
</asp:Panel>
-1
View File
@@ -1 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_listRichieste.ascx.cs" Inherits="mod_listRichieste" %>
-13
View File
@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class mod_listRichieste : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
}