update x gestione vocabolario

This commit is contained in:
Samuele Locatelli
2021-03-23 14:18:03 +01:00
parent 86b2a79f2b
commit 0fad61aca3
21 changed files with 1067 additions and 6 deletions
@@ -0,0 +1,48 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_lemmiVocab.ascx.cs" Inherits="MP_ADM.WebUserControls.cmp_lemmiVocab" %>
<div class="row" style="font-size: 8pt;">
<div class="col-sm-12">
<asp:GridView ID="grView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="Lingua,Lemma" DataSourceID="ods" OnDataBound="grView_DataBound" CssClass="table table-striped table-sm">
<SelectedRowStyle CssClass="info" />
<EmptyDataTemplate>
<asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
</EmptyDataTemplate>
<Columns>
<asp:TemplateField HeaderText="Lingua" SortExpression="Lingua">
<EditItemTemplate>
<asp:Label ID="TextBox0" runat="server" Text='<%# Eval("Lingua") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Lingua") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Lemma" SortExpression="Lemma" Visible="false">
<EditItemTemplate>
<asp:Label ID="TextBox2" runat="server" Text='<%# Eval("Lemma") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Lemma") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Traduzione" SortExpression="Traduzione">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Traduzione") %>' Width="500px"
TextMode="MultiLine"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Traduzione") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Label ID="lblNumRec" runat="server" CssClass="didascalia" />
<asp:ObjectDataSource ID="ods" runat="server" SelectMethod="getVocabolario" TypeName="MapoDb.selDataVoc"
OldValuesParameterFormatString="original_{0}"
FilterExpression="Lemma LIKE '%{0}%'">
<FilterParameters>
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="lemma_sel" />
</FilterParameters>
</asp:ObjectDataSource>
</div>
</div>
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
namespace MP_ADM.WebUserControls
{
public partial class cmp_lemmiVocab : ApplicationUserControl
{
#region Protected Methods
protected override void aggiornaControlliDataGL()
{
base.aggiornaControlliDataGL();
grView.PageSize = _righeDataGridAnagr;
}
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 = "";
}
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// aggiorna i dati mostrati
/// </summary>
public void doUpdate()
{
ods.DataBind();
grView.DataBind();
}
#endregion Public Methods
}
}
+44
View File
@@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MP_ADM.WebUserControls
{
public partial class cmp_lemmiVocab
{
/// <summary>
/// grView control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView grView;
/// <summary>
/// lblNumRec control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumRec;
/// <summary>
/// ods control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
}
}
@@ -0,0 +1,9 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_ricercaGenerica.ascx.cs" Inherits="MP_ADM.WebUserControls.cmp_ricercaGenerica" %>
<% if (false)
{ %>
<link href="~/css/Style.css" rel="stylesheet" type="text/css" />
<% } %>
<div class="boxRicerca">
<asp:TextBox ID="txtCerca" runat="server" OnTextChanged="txtCerca_TextChanged" Width="200px" />
<asp:Button ID="btnCerca" runat="server" OnClick="btnCerca_Click" Text="..." />
</div>
@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
namespace MP_ADM.WebUserControls
{
public partial class cmp_ricercaGenerica : ApplicationUserControl
{
#region Public Events
public event EventHandler eh_nuovaRicerca;
#endregion Public Events
#region Protected Properties
/// <summary>
/// testo ricerca trimmato da spazi
/// </summary>
protected string testoRicerca
{
get
{
return txtCerca.Text.Trim();
}
set
{
txtCerca.Text = value;
}
}
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// pressione del button di ricerca
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCerca_Click(object sender, EventArgs e)
{
salvaCerca();
}
protected override void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
updateText();
btnCerca.Text = traduci("lblCerca");
}
/// <summary>
/// effettua salvataggio ricerca
/// </summary>
protected void salvaCerca()
{
if (string.IsNullOrEmpty(testoRicerca))
{
SteamWare.memLayer.ML.emptySessionVal("valoreSearch");
}
else
{
SteamWare.memLayer.ML.setSessionVal("valoreSearch", testoRicerca);
// raise dell'evento
if (eh_nuovaRicerca != null)
{
eh_nuovaRicerca(this, new EventArgs());
}
}
}
/// <summary>
/// cambiato valore in ricerca
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtCerca_TextChanged(object sender, EventArgs e)
{
salvaCerca();
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// aggiorna il testo cercato
/// </summary>
public void updateText()
{
if (!string.IsNullOrEmpty(memLayer.ML.StringSessionObj("valoreSearch")) && !Page.IsPostBack)
{
testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreSearch");
}
}
#endregion Public Methods
}
}
@@ -0,0 +1,35 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MP_ADM.WebUserControls
{
public partial class cmp_ricercaGenerica
{
/// <summary>
/// txtCerca control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtCerca;
/// <summary>
/// btnCerca control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnCerca;
}
}
+5
View File
@@ -0,0 +1,5 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_righePag.ascx.cs" Inherits="MP_ADM.WebUserControls.cmp_righePag" %>
<div style="float: right;">
<asp:Label runat="server" ID="lblNumRighe" CssClass="didascalia"><%: traduci("righePerPag") %></asp:Label>
<asp:TextBox ID="txtNumRighe" runat="server" AutoPostBack="True" OnTextChanged="txtNumRighe_TextChanged" Width="2em" ToolTip="Righe richieste" />
</div>
+126
View File
@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
namespace MP_ADM.WebUserControls
{
public partial class cmp_righePag : BaseUserControl
{
#region Public Events
/// <summary>
/// indicato (nuovo) numero righe x pagina
/// </summary>
public event EventHandler eh_newNum;
#endregion Public Events
#region Protected Properties
/// <summary>
/// numero righe gridview da mostrare legato a controllo textbox
/// </summary>
protected int numRowReq
{
get
{
int answ = numRowPag;
try
{
answ = Convert.ToInt32(txtNumRighe.Text.Trim());
if (answ == 0)
{
answ = numRowPag;
txtNumRighe.Text = answ.ToString();
}
}
catch
{ }
return answ;
}
set
{
txtNumRighe.Text = value.ToString();
}
}
#endregion Protected Properties
#region Public Properties
/// <summary>
/// numero righe per pagina (in sessione)
/// </summary>
public int numRowPag
{
get
{
int answ = 10;
try
{
answ = memLayer.ML.IntSessionObj(uid + "_numRowPag");
}
catch
{
answ = 10;
}
return answ;
}
set
{
memLayer.ML.setSessionVal(uid + "_numRowPag", value);
numRowReq = value;
}
}
/// <summary>
/// stringa UID univoca
/// </summary>
public string uid
{
get
{
return this.UniqueID.Replace("$", "_").Replace("-", "_");
}
}
#endregion Public Properties
#region Protected Methods
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
numRowReq = numRowPag;
}
}
/// <summary>
/// aggiorno controllo paginazione...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtNumRighe_TextChanged(object sender, EventArgs e)
{
// salvo num righe...
numRowPag = numRowReq;
// sollevo evento nuovo valore...
if (eh_newNum != null)
{
eh_newNum(this, new EventArgs());
}
}
#endregion Protected Methods
}
}
+35
View File
@@ -0,0 +1,35 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MP_ADM.WebUserControls
{
public partial class cmp_righePag
{
/// <summary>
/// lblNumRighe control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumRighe;
/// <summary>
/// txtNumRighe control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtNumRighe;
}
}
@@ -0,0 +1,90 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_vocabolario.ascx.cs" Inherits="MP_ADM.WebUserControls.cmp_vocabolario" %>
<div class="row" style="font-size: 8pt;">
<div class="col-sm-12">
<asp:Button ID="btnNewLemma" runat="server" OnClick="btnNewLemma_Click" CssClass="btn btn-success btn-sm" />
<asp:TextBox ID="txtNewLemma" runat="server" placeholder="inserire lemma" />
</div>
<div class="col-sm-12">
<asp:GridView ID="grView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="Lingua,Lemma" DataSourceID="ods" OnDataBound="grView_DataBound"
OnSelectedIndexChanged="grView_SelectedIndexChanged" OnRowEditing="grView_RowEditing" CssClass="table table-striped table-sm">
<HeaderStyle CssClass="default" />
<PagerStyle CssClass="active GridPager" />
<PagerSettings Mode="NumericFirstLast" />
<SelectedRowStyle CssClass="table-info" />
<EmptyDataTemplate>
<asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
</EmptyDataTemplate>
<Columns>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton runat="server" ID="lbtUpdate" CausesValidation="False" CommandName="Update"
ToolTip='<%# traduci("Update")%>' CssClass="btn btn-success btn-sm"><i class="fa fa-check-circle-o" aria-hidden="true"></i></asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtCancel" CausesValidation="False" CommandName="Cancel"
ToolTip='<%# traduci("Cancel") %>' CssClass="btn btn-warning btn-sm"><i class="fa fa-ban" aria-hidden="true"></i></asp:LinkButton>
</EditItemTemplate>
<HeaderTemplate>
<asp:LinkButton ID="lbtReset" runat="server" OnClick="btnReset_Click" CssClass="btn btn-warning btn-sm" Visible="true"><i class="fa fa-refresh"></i> <%: traduci("Reset") %></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton runat="server" ID="lbtSelect" CausesValidation="False" CommandName="Select"
ToolTip='<%# traduci("Select") %>' CssClass="btn btn-sm btn-info"><i class="fa fa-search" aria-hidden="true"></i></asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtEdit" CausesValidation="False" CommandName="Edit"
ToolTip='<%# traduci("Edit") %>' CssClass="btn btn-sm btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Lingua" SortExpression="Lingua">
<EditItemTemplate>
<asp:Label ID="TextBox0" runat="server" Text='<%# Eval("Lingua") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Lingua") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Lemma" SortExpression="Lemma">
<EditItemTemplate>
<asp:Label ID="TextBox2" runat="server" Text='<%# Eval("Lemma") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("Lemma") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Traduzione" SortExpression="Traduzione">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Traduzione") %>' CssClass="form-control form-control-sm"
TextMode="MultiLine" Height="8em"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("Traduzione") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton runat="server" ID="lbtDelete" CausesValidation="False" CommandName="Delete"
ToolTip='<%# traduci("Delete") %>' OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' CssClass="btn btn-sm btn-danger"><i class="fa fa-trash" aria-hidden="true"></i></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Label ID="lblNumRec" runat="server" CssClass="didascalia" />
<asp:ObjectDataSource ID="ods" runat="server" SelectMethod="getVocabolario" TypeName="MapoDb.selDataVoc"
UpdateMethod="updateLemmaVoc" DeleteMethod="deleteLemmaVoc" OldValuesParameterFormatString="Original_{0}"
FilterExpression="Traduzione LIKE '%{0}%' OR Lemma LIKE '%{0}%' "
OnUpdated="ods_Updated">
<UpdateParameters>
<asp:Parameter Name="Traduzione" Type="String" />
<asp:Parameter Name="Original_Lingua" Type="String" />
<asp:Parameter Name="Original_Lemma" Type="String" />
</UpdateParameters>
<FilterParameters>
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
</FilterParameters>
<DeleteParameters>
<asp:Parameter Name="Original_Lingua" Type="String" />
<asp:Parameter Name="Original_Lemma" Type="String" />
</DeleteParameters>
</asp:ObjectDataSource>
</div>
</div>
@@ -0,0 +1,170 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
namespace MP_ADM.WebUserControls
{
public partial class cmp_vocabolario : ApplicationUserControl
{
#region Public Events
public event EventHandler eh_resetSelezione;
public event EventHandler eh_selezioneValore;
#endregion Public Events
#region Public Properties
/// <summary>
/// dimensione pagina grid view
/// </summary>
public int pageSize
{
get
{
return grView.PageSize;
}
set
{
grView.PageSize = value;
}
}
#endregion Public Properties
#region Private Methods
/// <summary>
/// creazione nuovo lemma
/// </summary>
private void creaNuovoLemma()
{
if (!string.IsNullOrEmpty(txtNewLemma.Text))
{
// inserisco
DataWrap.DW.creaNuovoLemmaVoc(txtNewLemma.Text.Trim());
// metto in campo ricerca...
memLayer.ML.setSessionVal("valoreCercato", txtNewLemma.Text.Trim());
// svuoto campo text
txtNewLemma.Text = "";
try
{
// aggiorno vocabolario
DataWrap.DW.resetVocabolario();
}
catch
{ }
// riparto...
Response.Redirect(_paginaCorrente);
}
}
private void selezionatoValore()
{
SteamWare.memLayer.ML.setSessionVal("lemma_sel", grView.SelectedDataKey.Values[1]);
if (eh_selezioneValore != null)
{
eh_selezioneValore(this, new EventArgs());
}
}
#endregion Private Methods
#region Protected Methods
protected override void aggiornaControlliDataGL()
{
base.aggiornaControlliDataGL();
ods.DataBind();
}
/// <summary>
/// inserisco nel db il nuovo lemma...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNewLemma_Click(object sender, EventArgs e)
{
creaNuovoLemma();
}
protected void btnReset_Click(object sender, EventArgs e)
{
resetSelezione();
}
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 = "";
}
}
protected void grView_RowEditing(object sender, GridViewEditEventArgs e)
{
// seleziono la riga corrente...
grView.SelectedIndex = e.NewEditIndex;
selezionatoValore();
}
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
selezionatoValore();
}
protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e)
{
selezionatoValore();
}
protected override void traduciObj()
{
base.traduciObj();
btnNewLemma.Text = user_std.UtSn.Traduci("btnNewLemma");
txtNewLemma.Text = "";
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// resetta la selezione dei valori in caso di modifiche su altri controlli
/// </summary>
public void resetSelezione()
{
SteamWare.memLayer.ML.emptySessionVal("lemma_sel");
grView.SelectedIndex = -1;
grView.DataBind();
if (eh_resetSelezione != null)
{
eh_resetSelezione(this, new EventArgs());
}
}
#endregion Public Methods
}
}
+62
View File
@@ -0,0 +1,62 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MP_ADM.WebUserControls
{
public partial class cmp_vocabolario
{
/// <summary>
/// btnNewLemma control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnNewLemma;
/// <summary>
/// txtNewLemma control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtNewLemma;
/// <summary>
/// grView control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView grView;
/// <summary>
/// lblNumRec control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumRec;
/// <summary>
/// ods control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
}
}
@@ -51,6 +51,10 @@
<i class="fa fa-check-square-o fa-4x text-success"></i>
<span class="shortcut-label"><%: traduci("TechSheetMan") %></span>
</a>
<a href="Vocabolario" class="shortcut">
<i class="fa fa-language fa-4x text-dark"></i>
<span class="shortcut-label"><%: traduci("Vocabolario") %></span>
</a>
<%--<a href="gestPedane" class="shortcut">
<i class="fa-2x fas fa-print"></i>
<span class="shortcut-label">PEDANE</span>
+5 -5
View File
@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
// <auto-generated>
// This code was generated by a tool.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------