From 645c26b3add0c5868591acaa8cc14b4be55efa0d Mon Sep 17 00:00:00 2001 From: samuele Date: Wed, 14 Jan 2009 14:02:33 +0000 Subject: [PATCH] =?UTF-8?q?-=20Inserito=20modulo=20gestione=20priorit?= =?UTF-8?q?=C3=A0=20-=20aggiornati=20script=20creazione=20DB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://keyhammer.ath.cx/svn/WebGIM/trunk@11 3e04ef4b-3b25-4b6c-be27-bb5389ca777b --- WebSites/WebGIM/mod_anagAmbitiGuasto.ascx | 4 +- WebSites/WebGIM/mod_anagAmbitiGuasto.ascx.cs | 29 ++---- WebSites/WebGIM/mod_priorita.ascx | 88 ++++++++++++++++++ WebSites/WebGIM/mod_priorita.ascx.cs | 96 ++++++++++++++++++++ WebSites/WebGIM/priorita.aspx | 8 ++ WebSites/WebGIM/priorita.aspx.cs | 13 +++ WebSites/WebGIM/sql/GIM_0000.sql | 6 ++ WebSites/WebGIM/sql/GIM_0001.sql | 8 ++ WebSites/WebGIM/sql/GIM_0002.sql | 31 ++++++- 9 files changed, 260 insertions(+), 23 deletions(-) create mode 100644 WebSites/WebGIM/mod_priorita.ascx create mode 100644 WebSites/WebGIM/mod_priorita.ascx.cs create mode 100644 WebSites/WebGIM/priorita.aspx create mode 100644 WebSites/WebGIM/priorita.aspx.cs diff --git a/WebSites/WebGIM/mod_anagAmbitiGuasto.ascx b/WebSites/WebGIM/mod_anagAmbitiGuasto.ascx index f81644f..335a2d1 100644 --- a/WebSites/WebGIM/mod_anagAmbitiGuasto.ascx +++ b/WebSites/WebGIM/mod_anagAmbitiGuasto.ascx @@ -2,7 +2,7 @@ Inherits="mod_anagAmbitiGuasto" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> @@ -73,7 +73,7 @@ + FilterExpression="descrAmbitoGuasto LIKE '%{0}%' " InsertMethod="Insert"> diff --git a/WebSites/WebGIM/mod_anagAmbitiGuasto.ascx.cs b/WebSites/WebGIM/mod_anagAmbitiGuasto.ascx.cs index 92a80d9..e6b57df 100644 --- a/WebSites/WebGIM/mod_anagAmbitiGuasto.ascx.cs +++ b/WebSites/WebGIM/mod_anagAmbitiGuasto.ascx.cs @@ -38,7 +38,11 @@ public partial class mod_anagAmbitiGuasto : ApplicationUserControl lblNumRec.Text = ""; } } - + /// + /// reset delle selezioni + /// + /// + /// protected void btnReset_Click(object sender, EventArgs e) { resetSelezione(); @@ -55,27 +59,15 @@ public partial class mod_anagAmbitiGuasto : ApplicationUserControl eh_resetSelezione(this, new EventArgs()); } } - protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e) - { - selezionatoValore(); - } - private void selezionatoValore() - { - if (eh_selezioneValore != null) - { - eh_selezioneValore(this, new EventArgs()); - } - } - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - selezionatoValore(); - } - + /// + /// seleziono valore in editing... + /// + /// + /// protected void grView_RowEditing(object sender, GridViewEditEventArgs e) { // seleziono la riga corrente... grView.SelectedIndex = e.NewEditIndex; - selezionatoValore(); } /// /// gestione evento inserimento nuovo record standard (se ZERO presenti) @@ -91,5 +83,4 @@ public partial class mod_anagAmbitiGuasto : ApplicationUserControl taAnagAmbito.Insert("-- [NUOVO] non definito --"); grView.DataBind(); } - } diff --git a/WebSites/WebGIM/mod_priorita.ascx b/WebSites/WebGIM/mod_priorita.ascx new file mode 100644 index 0000000..3cb0f94 --- /dev/null +++ b/WebSites/WebGIM/mod_priorita.ascx @@ -0,0 +1,88 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="mod_priorita.ascx.cs" + Inherits="mod_priorita" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebSites/WebGIM/mod_priorita.ascx.cs b/WebSites/WebGIM/mod_priorita.ascx.cs new file mode 100644 index 0000000..941c802 --- /dev/null +++ b/WebSites/WebGIM/mod_priorita.ascx.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using SteamWare; + +public partial class mod_priorita : ApplicationUserControl +{ + public event EventHandler eh_selezioneValore; + public event EventHandler eh_resetSelezione; + /// + /// evento dati associati a controllo + /// + /// + /// + 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 = ""; + } + } + /// + /// reset delle selezioni + /// + /// + /// + protected void btnReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + /// + /// resetta la selezione dei valori in caso di modifiche su altri controlli + /// + public void resetSelezione() + { + grView.SelectedIndex = -1; + grView.DataBind(); + if (eh_resetSelezione != null) + { + eh_resetSelezione(this, new EventArgs()); + } + } + /// + /// seleziono valore in editing... + /// + /// + /// + protected void grView_RowEditing(object sender, GridViewEditEventArgs e) + { + // seleziono la riga corrente... + grView.SelectedIndex = e.NewEditIndex; + } + /// + /// gestione evento inserimento nuovo record standard (se ZERO presenti) + /// + /// + /// + 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.AnagPrioritaTableAdapter taPrior = new DS_applicazioneTableAdapters.AnagPrioritaTableAdapter(); + // calcolo ultimo libero e aggiungo 1... + int nextFree = 1; + try + { + nextFree = (int)taPrior.getMaxPriorita() + 1; + } + catch + { + logger.lg.scriviLog("Errore nel recupero del max idx di prorità", tipoLog.EXCEPTION); + } + taPrior.Insert(nextFree, "-- [NUOVA] non definita --"); + grView.DataBind(); + } +} \ No newline at end of file diff --git a/WebSites/WebGIM/priorita.aspx b/WebSites/WebGIM/priorita.aspx new file mode 100644 index 0000000..b509df4 --- /dev/null +++ b/WebSites/WebGIM/priorita.aspx @@ -0,0 +1,8 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/AjaxSearch.master" AutoEventWireup="true" CodeFile="priorita.aspx.cs" Inherits="priorita" %> + +<%@ Register src="mod_priorita.ascx" tagname="mod_priorita" tagprefix="uc1" %> + + + + + diff --git a/WebSites/WebGIM/priorita.aspx.cs b/WebSites/WebGIM/priorita.aspx.cs new file mode 100644 index 0000000..ef6d632 --- /dev/null +++ b/WebSites/WebGIM/priorita.aspx.cs @@ -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 priorita : System.Web.UI.Page +{ + protected void Page_Load(object sender, EventArgs e) + { + + } +} diff --git a/WebSites/WebGIM/sql/GIM_0000.sql b/WebSites/WebGIM/sql/GIM_0000.sql index 55bc51e..e366ced 100644 --- a/WebSites/WebGIM/sql/GIM_0000.sql +++ b/WebSites/WebGIM/sql/GIM_0000.sql @@ -46,6 +46,12 @@ BEGIN END GO +IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'AnagPriorita' AND TABLE_SCHEMA = 'dbo') +BEGIN + DROP TABLE dbo.AnagPriorita +END +GO + /* elimino stored e funzioni */ diff --git a/WebSites/WebGIM/sql/GIM_0001.sql b/WebSites/WebGIM/sql/GIM_0001.sql index 5c0b229..9e9b401 100644 --- a/WebSites/WebGIM/sql/GIM_0001.sql +++ b/WebSites/WebGIM/sql/GIM_0001.sql @@ -168,6 +168,14 @@ GO COMMIT GO +-- gestione priorità +CREATE TABLE AnagPriorita( + idxPriorita INT NOT NULL CONSTRAINT PK_AnagPriorita PRIMARY KEY, + descrPriorita NVARCHAR(50) +) +GO + + /*registro versione...*/ INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(1, GETDATE()) GO diff --git a/WebSites/WebGIM/sql/GIM_0002.sql b/WebSites/WebGIM/sql/GIM_0002.sql index 5612157..54940a2 100644 --- a/WebSites/WebGIM/sql/GIM_0002.sql +++ b/WebSites/WebGIM/sql/GIM_0002.sql @@ -23,9 +23,11 @@ INSERT INTO dbo.Permessi INSERT INTO dbo.Permessi VALUES ('ANAG_ambitiGuasto', 'anagAmbitiGuasto.aspx', 1, 1, 'AnagAmbitiGuasto', 'AnagAmbitiGuastoLong') INSERT INTO dbo.Permessi - VALUES ('ANAG_causali', 'gestioneCausali.aspx', 1, 3, 'GestioneCausali', 'GestioneCausaliLong') + VALUES ('ANAG_causali', 'gestioneCausali.aspx', 1, 4, 'GestioneCausali', 'GestioneCausaliLong') INSERT INTO dbo.Permessi - VALUES ('ANAG_impianti', 'impianti.aspx', 1, 2, 'GestImpianti', 'GestImpiantiLong') + VALUES ('ANAG_impianti', 'impianti.aspx', 1, 3, 'GestImpianti', 'GestImpiantiLong') +INSERT INTO dbo.Permessi + VALUES ('ANAG_priorita', 'priorita.aspx', 1, 2, 'AnagPriorita', 'AnagPrioritaLong') INSERT INTO dbo.Permessi VALUES ('PRINT', 'menu.aspx', 3, 0, 'AreaStampati', 'AreaStampatiLong') INSERT INTO dbo.Permessi @@ -63,8 +65,12 @@ INSERT INTO dbo.Permessi2Funzione VALUES ('ANAG', N'GIM_SU', NULL) INSERT INTO dbo.Permessi2Funzione VALUES ('ANAG_ambitiGuasto', N'GIM_SU', NULL) +INSERT INTO dbo.Permessi2Funzione + VALUES ('ANAG_causali', N'GIM_SU', NULL) INSERT INTO dbo.Permessi2Funzione VALUES ('ANAG_impianti', N'GIM_SU', NULL) +INSERT INTO dbo.Permessi2Funzione + VALUES ('ANAG_priorita', N'GIM_SU', NULL) INSERT INTO dbo.Permessi2Funzione VALUES ('PRINT', N'GIM_U', NULL) INSERT INTO dbo.Permessi2Funzione @@ -86,6 +92,7 @@ GO COMMIT TRANSACTION GO + -- inserisco valori di default degli ambiti di guasto SET xact_abort ON GO @@ -131,6 +138,26 @@ GO COMMIT TRANSACTION GO +-- elenco priorità +SET xact_abort ON +GO + +BEGIN TRANSACTION +GO + +INSERT INTO dbo.AnagPriorita + VALUES (1, N'Pericolo di infortunio') +INSERT INTO dbo.AnagPriorita + VALUES (2, N'Produzione Ferma') +INSERT INTO dbo.AnagPriorita + VALUES (3, N'Intervento fine lavoro') +INSERT INTO dbo.AnagPriorita + VALUES (4, N'Intervento nel mese') +GO + +COMMIT TRANSACTION +GO + -- registro versione... INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(2, GETDATE())