Completata gestione impianti con cloning e test vari...

git-svn-id: https://keyhammer.ath.cx/svn/WebGIM/trunk@13 3e04ef4b-3b25-4b6c-be27-bb5389ca777b
This commit is contained in:
samuele
2009-01-14 16:45:26 +00:00
parent 64313f3651
commit ad42632920
4 changed files with 133 additions and 19 deletions
+52 -17
View File
@@ -1,10 +1,11 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_impianti.ascx.cs" Inherits="mod_impianti" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_impianti.ascx.cs"
Inherits="mod_impianti" %>
<%@ 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="idxImpianto" DataSourceID="ods"
onrowdatabound="grView_RowDataBound">
OnRowDataBound="grView_RowDataBound" onrowupdating="grView_RowUpdating">
<RowStyle CssClass="ctrRowStyle" />
<AlternatingRowStyle CssClass="ctrAltRowStyle" />
<EditRowStyle CssClass="ctrEditRowStyle" />
@@ -34,57 +35,90 @@
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" />
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="idxImpianto" HeaderText="idxImpianto" Visible="false" InsertVisible="False" ReadOnly="True" SortExpression="idxImpianto" />
<asp:BoundField DataField="idxImpianto" HeaderText="idxImpianto" Visible="false"
InsertVisible="False" ReadOnly="True" SortExpression="idxImpianto" />
<asp:TemplateField HeaderText="codImpianto" SortExpression="codImpianto">
<FooterTemplate>
<asp:TextBox ID="txtcodImpianto" runat="server" Text='<%# Bind("codImpianto") %>'
Width="8em" />
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("codImpianto") %>' Width="8em" />
<asp:TextBox ID="txtcodImpianto" runat="server" Text='<%# Bind("codImpianto") %>'
Width="8em" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("codImpianto") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="nomeImpianto" SortExpression="nomeImpianto">
<FooterTemplate>
<asp:TextBox ID="txtnomeImpianto" runat="server" Text='<%# Bind("nomeImpianto") %>'
Width="20em" />
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("nomeImpianto") %>' Width="20em" />
<asp:TextBox ID="txtnomeImpianto" runat="server" Text='<%# Bind("nomeImpianto") %>'
Width="20em" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("nomeImpianto") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="tipoImpianto" SortExpression="tipoImpianto">
<FooterTemplate>
<asp:TextBox ID="txttipoImpianto" runat="server" Text='<%# Bind("tipoImpianto") %>' />
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("tipoImpianto") %>' />
<asp:TextBox ID="txttipoImpianto" runat="server" Text='<%# Bind("tipoImpianto") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("tipoImpianto") %>' />
</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="txtfunzDal" runat="server" Text='<%# Bind("funzDal","{0:d}") %>' Width="6em" />
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" FirstDayOfWeek="Monday"
TargetControlID="txtfunzDal" Format="dd/MM/yyyy">
</cc1:CalendarExtender>
<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="txtfunzAl" runat="server" Text='<%# Bind("funzAl","{0:d}") %>' Width="6em" />
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" FirstDayOfWeek="Monday"
TargetControlID="txtfunzAl" Format="dd/MM/yyyy">
</cc1:CalendarExtender>
<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}") %>' />
@@ -110,7 +144,8 @@
</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" />
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>
+49 -2
View File
@@ -79,6 +79,10 @@ public partial class mod_impianti : ApplicationUserControl
{
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";
@@ -97,6 +101,9 @@ public partial class mod_impianti : ApplicationUserControl
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;
@@ -345,9 +352,49 @@ public partial class mod_impianti : ApplicationUserControl
// reset selezione...
resetSelezione();
// i primi valori ("0") di default sono "ND"... li inserisco come standard...
DS_applicazioneTableAdapters.AnagImpiantiTableAdapter taImpianti= new DS_applicazioneTableAdapters.AnagImpiantiTableAdapter();
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>
/// 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["idxImpianto"]);
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":
TA_app.obj.taImpianti.sp_clonaImpianto(_idx);
grView.EditIndex = -1;
grView.DataBind();
// blocco update!
e.Cancel = true;
break;
default:
// faccio update!
break;
}
}
#endregion
}
+3
View File
@@ -61,4 +61,7 @@ DROP FUNCTION [dbo].[f_padLeft]
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[rightDivision]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[rightDivision]
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_clonaImpianto]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_clonaImpianto]
GO
+29
View File
@@ -175,6 +175,35 @@ CREATE TABLE AnagPriorita(
)
GO
/****** Object: StoredProcedure [dbo].[sp_clonaImpianto] Script Date: 01/14/2009 17:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*************************************
* STORED PROCEDURE sp_clonaImpianto
* Clona i dati dell'impianto indicato
*
* modif.: S.E.L. - 2009.01.14
**************************************/
CREATE PROCEDURE [dbo].[sp_clonaImpianto]
(
@idxImpianto int
)
AS
BEGIN tran
INSERT INTO AnagImpianti
(codImpianto, nomeImpianto, tipoImpianto, funzDal, funzAl)
SELECT codImpianto + '-clone' AS Expr1, nomeImpianto + '-clone' AS Expr2, tipoImpianto, funzDal, funzAl
FROM AnagImpianti AS AnagImpianti_1
WHERE (idxImpianto = @idxImpianto)
COMMIT tran
RETURN
GO
/*registro versione...*/
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(1, GETDATE())