Inserimento prima bozza anagrafica Macchine

git-svn-id: https://keyhammer.ath.cx/svn/WebGIM/trunk@14 3e04ef4b-3b25-4b6c-be27-bb5389ca777b
This commit is contained in:
samuele
2009-01-14 17:58:10 +00:00
parent ad42632920
commit 8d0ce84f18
9 changed files with 691 additions and 23 deletions
+6
View File
@@ -1,4 +1,10 @@
------------------------
- 20080114
------------------------
Modificare comportamento cancellabilità impianti: il 1° NON DEVE ESSERE cancellabile...
------------------------
- 20080113
------------------------
+2 -7
View File
@@ -11,13 +11,8 @@ public partial class impianti : System.Web.UI.Page
{
mod_impianti1.eh_selValore += new EventHandler(Mod_macchine1_eh_selValore);
mod_impianti1.eh_resetSelezione += new EventHandler(Mod_macchine1_eh_resetSelezione);
#if false
if (memLayer.ML.BoolSessionObj("fromJump"))
{
memLayer.ML.emptySessionVal("fromJump");
Response.Redirect("macchine.aspx");
}
#endif
// abilito solo alla vista..
mod_macchine1.vistaModulo = SteamWare.tipoVistaMod.selezione;
}
void Mod_macchine1_eh_resetSelezione(object sender, EventArgs e)
+8
View File
@@ -0,0 +1,8 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/AjaxSearch.master" AutoEventWireup="true" CodeFile="macchine.aspx.cs" Inherits="macchine" %>
<%@ Register src="mod_macchine.ascx" tagname="mod_macchine" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<uc1:mod_macchine ID="mod_macchine1" runat="server" />
</asp:Content>
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class macchine : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// abilitato editing
mod_macchine1.vistaModulo = SteamWare.tipoVistaMod.editing;
}
}
+2 -2
View File
@@ -28,7 +28,7 @@
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) %>' />
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"
@@ -130,7 +130,7 @@
</HeaderTemplate>
<ItemTemplate>
<asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandName="Delete"
CommandArgument='<%# Eval("idxImpianto") %>' ToolTip='<%# traduci("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">
+21 -7
View File
@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
using System.Data;
public partial class mod_impianti : ApplicationUserControl
{
@@ -14,7 +14,6 @@ public partial class mod_impianti : ApplicationUserControl
protected string _idxGridView;
protected string _idxGridViewExt;
protected string _tabCache;
protected bool _showNewBtn = false;
/// <summary>
@@ -128,7 +127,6 @@ public partial class mod_impianti : ApplicationUserControl
{
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
ods.Insert();
SteamWare.memLayer.ML.emptyCacheVal(_tabCache);
}
/// <summary>
/// annulla inserimento nuovo valore da footer
@@ -305,7 +303,6 @@ public partial class mod_impianti : ApplicationUserControl
{
base.OnInit(e);
_idxGridView = "idxImpianto";
_tabCache = "tabImpianti";
}
/// <summary>
/// setta selected alla riga il cui valore key è in session
@@ -352,7 +349,7 @@ public partial class mod_impianti : ApplicationUserControl
// reset selezione...
resetSelezione();
// i primi valori ("0") di default sono "ND"... li inserisco come standard...
TA_app.obj.taImpianti.Insert("0000","-- [NUOVO] Nome Impianto non definito --", "tipo n.d.", DateTime.Today, DateTime.Today.AddYears(10));
TA_app.obj.taImpianti.Insert("0000", "-- [NUOVO] Nome Impianto non definito --", "tipo n.d.", DateTime.Today, DateTime.Today.AddYears(10));
grView.DataBind();
}
/// <summary>
@@ -389,12 +386,29 @@ public partial class mod_impianti : ApplicationUserControl
// blocco update!
e.Cancel = true;
break;
default:
default:
// faccio update!
break;
}
}
/// <summary>
/// determina se sia cancellabile dall'idx (1 e 2 NON LO SONO...)
/// </summary>
/// <param name="idx"></param>
/// <returns></returns>
public bool isDeletable(object _idx)
{
bool answ = false;
int idx = -1;
try
{
idx = Convert.ToInt32(_idx);
}
catch
{ }
if (idx > 2) answ = true;
return answ;
}
#endregion
}
+232 -2
View File
@@ -1,2 +1,232 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_macchine.ascx.cs" Inherits="mod_macchine" %>
here I am
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_macchine.ascx.cs"
Inherits="mod_macchine" %>
<%@ Register Src="mod_selettore_ajax.ascx" TagName="mod_selettore_ajax" TagPrefix="uc1" %>
<%@ 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"
DataKeyNames="idxMacchina" 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") %>' />
<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" />
</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) %>' />
</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>
</asp:TemplateField>
<asp:BoundField DataField="idxMacchina" HeaderText="idxMacchina" Visible="false"
InsertVisible="False" ReadOnly="True" SortExpression="idxMacchina" />
<asp:TemplateField HeaderText="codMacchina" SortExpression="codMacchina">
<FooterTemplate>
<asp:TextBox ID="txtcodMacchina" runat="server" Text='<%# Bind("codMacchina") %>'
Width="8em" />
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtcodMacchina" runat="server" Text='<%# Bind("codMacchina") %>'
Width="8em" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("codMacchina") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="nomeMacchina" SortExpression="nomeMacchina">
<FooterTemplate>
<asp:TextBox ID="txtnomeMacchina" runat="server" Text='<%# Bind("nomeMacchina") %>'
Width="20em" />
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtnomeMacchina" runat="server" Text='<%# Bind("nomeMacchina") %>'
Width="20em" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("nomeMacchina") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="modello" SortExpression="modello">
<FooterTemplate>
<asp:TextBox ID="txtmodello" runat="server" Text='<%# Bind("modello") %>' />
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtmodello" runat="server" Text='<%# Bind("modello") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("modello") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="matricola" SortExpression="matricola">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("matricola") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%# Bind("matricola") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="anno" SortExpression="anno">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("anno") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%# Bind("anno") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="kgPeso" SortExpression="kgPeso">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("kgPeso") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%# Bind("kgPeso") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="kwConsumo" SortExpression="kwConsumo">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("kwConsumo") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label10" runat="server" Text='<%# Bind("kwConsumo") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="funzDal" SortExpression="funzDal">
<FooterTemplate>
<asp:TextBox ID="cal_funzDal" runat="server" Text='<%# Bind("funzDal","{0:d}") %>'
Width="6em" />
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" FirstDayOfWeek="Monday"
TargetControlID="cal_funzDal" Format="dd/MM/yyyy">
</cc1:CalendarExtender>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="cal_funzDal" runat="server" Text='<%# Bind("funzDal","{0:d}") %>'
Width="6em" />
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" FirstDayOfWeek="Monday"
TargetControlID="cal_funzDal" Format="dd/MM/yyyy">
</cc1:CalendarExtender>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("funzDal","{0:d}") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="funzAl" SortExpression="funzAl">
<FooterTemplate>
<asp:TextBox ID="cal_funzAl" runat="server" Text='<%# Bind("funzAl","{0:d}") %>'
Width="6em" />
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" FirstDayOfWeek="Monday"
TargetControlID="cal_funzAl" Format="dd/MM/yyyy">
</cc1:CalendarExtender>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="cal_funzAl" runat="server" Text='<%# Bind("funzAl","{0:d}") %>'
Width="6em" />
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" FirstDayOfWeek="Monday"
TargetControlID="cal_funzAl" Format="dd/MM/yyyy">
</cc1:CalendarExtender>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("funzAl","{0:d}") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="idxImpianto" SortExpression="idxImpianto">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("idxImpianto") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Bind("idxImpianto") %>'></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"
CommandArgument='<%# Eval("idxImpianto") %>' 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" DeleteMethod="DeleteQuery" InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="DS_applicazioneTableAdapters.AnagMacchineTableAdapter"
OnInserting="recuperaFooter" FilterExpression=" codMacchina LIKE '%{0}%' OR nomeMacchina LIKE '%{0}%' OR modello LIKE '%{0}%' OR matricola LIKE '%{0}%' "
UpdateMethod="Update" OnInserted="ods_Updated" OnUpdated="ods_Updated">
<FilterParameters>
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
</FilterParameters>
<DeleteParameters>
<asp:Parameter Name="Original_idxMacchina" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="idxImpianto" Type="Int32" />
<asp:Parameter Name="codMacchina" Type="String" />
<asp:Parameter Name="nomeMacchina" Type="String" />
<asp:Parameter Name="modello" Type="String" />
<asp:Parameter Name="matricola" Type="String" />
<asp:Parameter Name="anno" Type="Int32" />
<asp:Parameter Name="kgPeso" Type="Double" />
<asp:Parameter Name="kwConsumo" Type="Double" />
<asp:Parameter Name="funzDal" Type="DateTime" />
<asp:Parameter Name="funzAl" Type="DateTime" />
<asp:Parameter Name="Original_idxMacchina" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="idxImpianto" Type="Int32" />
<asp:Parameter Name="codMacchina" Type="String" />
<asp:Parameter Name="nomeMacchina" Type="String" />
<asp:Parameter Name="modello" Type="String" />
<asp:Parameter Name="matricola" Type="String" />
<asp:Parameter Name="anno" Type="Int32" />
<asp:Parameter Name="kgPeso" Type="Double" />
<asp:Parameter Name="kwConsumo" Type="Double" />
<asp:Parameter Name="funzDal" Type="DateTime" />
<asp:Parameter Name="funzAl" Type="DateTime" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:Label ID="lblNumRec" runat="server" CssClass="txtMini" />
<asp:Label ID="lblWarning" runat="server" Visible="false" CssClass="erroreMid" />
+405 -4
View File
@@ -3,11 +3,412 @@ 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_macchine : System.Web.UI.UserControl
public partial class mod_macchine : ApplicationUserControl
{
protected void Page_Load(object sender, EventArgs e)
{
protected tipoVistaMod _tipoVistaMod;
#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.AnagMacchineDataTable tabella = new DS_applicazione.AnagMacchineDataTable();
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 = "idxmacchina";
}
/// <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.AnagMacchineRow riga = (DS_applicazione.AnagMacchineRow)_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>
/// 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...
TA_app.obj.taMacchine.Insert(1, "0000", "-- [NUOVA] Nome Macchina non definito --", "modello n.d.", "", DateTime.Now.Year, 0, 0, DateTime.Today, DateTime.Today.AddYears(10));
grView.DataBind();
}
/// <summary>
/// salvo in session che il prox comando è clonare...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void imgClona_Click(object sender, ImageClickEventArgs e)
{
SteamWare.memLayer.ML.setSessionVal("nextObjCommand", "clonaObj");
}
/// <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["idxMacchina"]);
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.taMacchina.sp_clonaImpianto(_idx);
#endif
grView.EditIndex = -1;
grView.DataBind();
// blocco update!
e.Cancel = true;
break;
default:
// faccio update!
break;
}
}
/// <summary>
/// info x comportamento modulo
/// </summary>
public tipoVistaMod vistaModulo
{
get
{
return _tipoVistaMod;
}
set
{
_tipoVistaMod = value;
}
}
#endregion
}
+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">153 - </asp:Label>
<asp:Label runat="server" ID="lblApp" Text="."></asp:Label><asp:Label ID="lblrev" runat="server">10 - </asp:Label>
<asp:Label runat="server" ID="lblCopyRight" Text="..."></asp:Label>