diff --git a/WebSites/WebGIM/mod_impianti.ascx b/WebSites/WebGIM/mod_impianti.ascx index 3526587..2ff0c3e 100644 --- a/WebSites/WebGIM/mod_impianti.ascx +++ b/WebSites/WebGIM/mod_impianti.ascx @@ -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" %> + OnRowDataBound="grView_RowDataBound" onrowupdating="grView_RowUpdating"> @@ -34,57 +35,90 @@ ToolTip='<%# traduci("Update")%>' ImageUrl='<%# imgPath(SteamWare.tipoImg.conferma , SteamWare.dimImg.small) %>' /> + + ToolTip='<%# traduci("Insert") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.nuovo , SteamWare.dimImg.small) %>' + OnClick="lblIns_click" /> - + + + + - + + + + - + + + + - + + + + + + - - - - + + + + + + + + - - - + + + @@ -110,7 +144,8 @@ + ToolTip='<%# traduci("Insert") %>' ImageUrl='<%# imgPath(SteamWare.tipoImg.nuovo , SteamWare.dimImg.small) %>' + OnClick="lblIns_click" /> diff --git a/WebSites/WebGIM/mod_impianti.ascx.cs b/WebSites/WebGIM/mod_impianti.ascx.cs index a103a81..2a10320 100644 --- a/WebSites/WebGIM/mod_impianti.ascx.cs +++ b/WebSites/WebGIM/mod_impianti.ascx.cs @@ -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(); } + /// + /// salvo in session che il prox comando è clonare... + /// + /// + /// + protected void imgClona_Click(object sender, ImageClickEventArgs e) + { + SteamWare.memLayer.ML.setSessionVal("nextObjCommand", "clonaObj"); + } + /// + /// in caso di aggiornamento verifico se sia salvato un comando clona... + /// + /// + /// + 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 } \ No newline at end of file diff --git a/WebSites/WebGIM/sql/GIM_0000.sql b/WebSites/WebGIM/sql/GIM_0000.sql index e366ced..b53accd 100644 --- a/WebSites/WebGIM/sql/GIM_0000.sql +++ b/WebSites/WebGIM/sql/GIM_0000.sql @@ -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 diff --git a/WebSites/WebGIM/sql/GIM_0001.sql b/WebSites/WebGIM/sql/GIM_0001.sql index b7949b5..72c6128 100644 --- a/WebSites/WebGIM/sql/GIM_0001.sql +++ b/WebSites/WebGIM/sql/GIM_0001.sql @@ -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())