fix update pagina orario
This commit is contained in:
@@ -13,17 +13,17 @@
|
||||
<PagerSettings Mode="NumericFirstLast" />
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center" ItemStyle-Wrap="false">
|
||||
<HeaderTemplate>
|
||||
<asp:LinkButton ID="lbtReset" runat="server" CssClass="btn btn-sm btn-info" ToolTip='<%# traduci("Reset") %>' CausesValidation="False" OnClick="btnReset_Click" Visible="true"><i class="fa fa-refresh" aria-hidden="true"></i></asp:LinkButton>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="imgSelect" runat="server" CausesValidation="False" CommandName="Select" ToolTip='<%# traduci("Select") %>' ImageUrl="~/images/view_s.png" />
|
||||
<asp:ImageButton ID="imgEdit" runat="server" CausesValidation="False" CommandName="Edit" ToolTip='<%# traduci("Edit") %>' ImageUrl="~/images/edit_s.png" />
|
||||
<asp:LinkButton runat="server" ID="lbtSelect" CssClass="btn btn-sm btn-info" CausesValidation="False" CommandName="Select" ToolTip='<%# traduci("Select") %>'><i class="fa fa-search" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton runat="server" ID="lbtEdit" CssClass="btn btn-sm btn-primary" CausesValidation="False" CommandName="Edit" ToolTip='<%# traduci("Edit") %>'><i class="fa fa-edit" aria-hidden="true"></i></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:ImageButton ID="imgUpdate" runat="server" CausesValidation="False" CommandName="Update" ToolTip='<%# traduci("Update")%>' ImageUrl="~/images/apply_s.png" />
|
||||
<asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip='<%# traduci("Cancel") %>' ImageUrl="~/images/cancel_s.png" />
|
||||
<asp:LinkButton runat="server" ID="lbtUpdate" CssClass="btn btn-sm btn-success" CausesValidation="False" CommandName="Update" ToolTip='<%# traduci("Update") %>'><i class="fa fa-check" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton runat="server" ID="lbtCancel" CssClass="btn btn-sm btn-warning" CausesValidation="False" CommandName="Cancel" ToolTip='<%# traduci("Cancel") %>'><i class="fa fa-ban" aria-hidden="true"></i></asp:LinkButton>
|
||||
</EditItemTemplate>
|
||||
<HeaderTemplate>
|
||||
<asp:ImageButton ID="imgBtnReset" runat="server" ToolTip='<%# traduci("Reset") %>' CausesValidation="False" OnClick="btnReset_Click" ImageUrl="~/images/reload_m.png" Visible="true" />
|
||||
</HeaderTemplate>
|
||||
<ItemStyle HorizontalAlign="Center"></ItemStyle>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="codOrario" HeaderText="cod" SortExpression="codOrario" ControlStyle-Width="7em" />
|
||||
@@ -45,17 +45,15 @@
|
||||
<asp:BoundField DataField="oraInizio_3" HeaderText="Inizio_3" SortExpression="oraInizio_3" ControlStyle-Width="4em" />
|
||||
<asp:BoundField DataField="oraFine_3" HeaderText="Fine_3" SortExpression="oraFine_3" ControlStyle-Width="4em" />
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<HeaderTemplate>
|
||||
<asp:LinkButton runat="server" ID="lbtNew" CssClass="btn btn-sm btn-success" OnClick="btnNew_Click" ToolTip='<%# traduci("New") %>' Visible='<%# chkLicOk %>'><i class="fa fa-plus" aria-hidden="true"></i></asp:LinkButton>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandArgument='<%# Eval("codOrario") %>' CommandName="Delete" ImageUrl="~/images/elimina_s.png" ToolTip='<%# traduci("Delete") %>' Visible='<%# delEnabled(Eval("codOrario")) %>' />
|
||||
<asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText='<%# traduci("confermaDel")%>' TargetControlID="imgDelete"></asp:ConfirmButtonExtender>
|
||||
<asp:LinkButton runat="server" ID="lbtDelete" CssClass="btn btn-sm btn-danger" CausesValidation="False" CommandArgument='<%# Eval("codOrario") %>' CommandName="Delete" ToolTip='<%# traduci("Delete") %>' Visible='<%# delEnabled(Eval("codOrario")) %>'><i class="fa fa-trash" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:ConfirmButtonExtender ID="cbeDelete" runat="server" ConfirmText='<%# traduci("confermaDel")%>' TargetControlID="lbtDelete"></asp:ConfirmButtonExtender>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:ImageButton ID="imgUpdate2" runat="server" CausesValidation="False" CommandName="Update" ImageUrl="~/images/apply_s.png" ToolTip='<%# traduci("Update")%>' />
|
||||
<asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/images/cancel_s.png" ToolTip='<%# traduci("Cancel") %>' />
|
||||
</EditItemTemplate>
|
||||
<HeaderTemplate>
|
||||
<asp:Button ID="btnNew" runat="server" OnClick="btnNew_Click" Text='<%# traduci("New") %>' Visible='<%# chkLicOk %>' CssClass="btnNew" />
|
||||
</HeaderTemplate>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
@@ -74,7 +72,6 @@
|
||||
<InsertParameters>
|
||||
<asp:Parameter Name="codOrario" Type="String" />
|
||||
<asp:Parameter Name="descOrario" Type="String" />
|
||||
<asp:Parameter Name="oreOrdSett" Type="Double" />
|
||||
<asp:Parameter Name="oreStraordAss" Type="Double" />
|
||||
<asp:Parameter Name="autoCompOreOrd" Type="Boolean" />
|
||||
<asp:Parameter Name="oreLun" Type="Double" />
|
||||
@@ -94,7 +91,6 @@
|
||||
<UpdateParameters>
|
||||
<asp:Parameter Name="codOrario" Type="String" />
|
||||
<asp:Parameter Name="descOrario" Type="String" />
|
||||
<asp:Parameter Name="oreOrdSett" Type="Double" />
|
||||
<asp:Parameter Name="oreStraordAss" Type="Double" />
|
||||
<asp:Parameter Name="autoCompOreOrd" Type="Boolean" />
|
||||
<asp:Parameter Name="oreLun" Type="Double" />
|
||||
|
||||
@@ -12,45 +12,51 @@ namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
public partial class mod_adminOrario : System.Web.UI.UserControl
|
||||
{
|
||||
#region area standard (non modificare)
|
||||
#region Public Events
|
||||
|
||||
#region gestione eventi
|
||||
|
||||
public event EventHandler eh_resetSelezione;
|
||||
public event EventHandler eh_nuovoValore;
|
||||
|
||||
#endregion
|
||||
public event EventHandler eh_resetSelezione;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// effettua traduzione del lemma
|
||||
/// controllo stato licenze!
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(string lemma)
|
||||
public bool chkLicOk
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma);
|
||||
get
|
||||
{
|
||||
return (licenzeGPW.checkLicenze);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// caricamento
|
||||
/// gestione evento richiesta nuovo valore (mostra footer, ...)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
grView.PageSize = utils.pageSize;
|
||||
}
|
||||
/// <summary>
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
public void resetSelezione()
|
||||
{
|
||||
grView.SelectedIndex = -1;
|
||||
// reset selezione...
|
||||
resetSelezione();
|
||||
// inserisco record
|
||||
DataProxy.DP.taAO.insertQuery("0000 (new)", "descrizione");
|
||||
//update!
|
||||
grView.DataBind();
|
||||
if (eh_resetSelezione != null)
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_resetSelezione(this, new EventArgs());
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reset della selezione
|
||||
/// </summary>
|
||||
@@ -60,26 +66,21 @@ namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
resetSelezione();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// inserisce nuovo valore da footer
|
||||
/// elenco colonne del datagrid
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblIns_click(object sender, EventArgs e)
|
||||
/// <returns></returns>
|
||||
protected DataColumnCollection colonneObj()
|
||||
{
|
||||
// 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;
|
||||
DataColumnCollection colonne = null;
|
||||
using (DS_Applicazione.AnagOrariDataTable tabella = new DS_Applicazione.AnagOrariDataTable())
|
||||
{
|
||||
colonne = tabella.Columns;
|
||||
}
|
||||
return colonne;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// traduce gli header delle colonne
|
||||
/// </summary>
|
||||
@@ -90,7 +91,7 @@ namespace GPW_Admin.WebUserControls
|
||||
if (grView.Rows.Count > 0)
|
||||
{
|
||||
LinkButton lb;
|
||||
// aggiorno gli headers
|
||||
// aggiorno gli headers
|
||||
foreach (TableCell cella in grView.HeaderRow.Cells)
|
||||
{
|
||||
try
|
||||
@@ -110,74 +111,57 @@ namespace GPW_Admin.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region area CUSTOM (da modificare)
|
||||
|
||||
/// <summary>
|
||||
/// elenco colonne del datagrid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected DataColumnCollection colonneObj()
|
||||
{
|
||||
DataColumnCollection colonne = null;
|
||||
using (DS_Applicazione.AnagOrariDataTable tabella = new DS_Applicazione.AnagOrariDataTable())
|
||||
{
|
||||
colonne = tabella.Columns;
|
||||
}
|
||||
return colonne;
|
||||
}
|
||||
/// <summary>
|
||||
/// determina se sia eliminabile il record (=non usato)
|
||||
/// </summary>
|
||||
/// <param name="idxMaker"></param>
|
||||
/// <returns></returns>
|
||||
public bool delEnabled(object idxObj)
|
||||
{
|
||||
bool answ = true;
|
||||
// solo se ha diritti scrittura controllo
|
||||
if (idxObj != null)
|
||||
{
|
||||
int trovati = 0;
|
||||
// controllo se ci siano tipo celle associate
|
||||
trovati = DataProxy.DP.taDipendenti.getByCodOrario(idxObj.ToString()).Rows.Count;
|
||||
// controllo se ci sono record correlati...
|
||||
if (trovati > 0)
|
||||
{
|
||||
answ = false;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// gestione evento richiesta nuovo valore (mostra footer, ...)
|
||||
/// annulla inserimento nuovo valore da footer
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
protected void lblCanc_click(object sender, EventArgs e)
|
||||
{
|
||||
// reset selezione...
|
||||
resetSelezione();
|
||||
// inserisco record
|
||||
DataProxy.DP.taAO.Insert("0000 (new)", "descrizione", 0, 0, false, 0, 0, 0, 0, 0, 0, 0, DateTime.Today.TimeOfDay, DateTime.Today.TimeOfDay, null, null, null, null);
|
||||
//update!
|
||||
grView.DataBind();
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
// annullo inserimento: nascondo footer, bind controlli...
|
||||
grView.FooterRow.Visible = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// controllo stato licenze!
|
||||
/// inserisce nuovo valore da footer
|
||||
/// </summary>
|
||||
public bool chkLicOk
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblIns_click(object sender, EventArgs e)
|
||||
{
|
||||
get
|
||||
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
|
||||
ods.Insert();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check licenze in fase di update...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
{
|
||||
if (!licenzeGPW.checkLicenze)
|
||||
{
|
||||
return (licenzeGPW.checkLicenze);
|
||||
if (e != null)
|
||||
{
|
||||
// annullo insert se licenze sforate...
|
||||
e.Cancel = true;
|
||||
grView.EditIndex = -1;
|
||||
grView.DataBind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// caricamento
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
grView.PageSize = utils.pageSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
|
||||
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
|
||||
@@ -216,12 +200,15 @@ namespace GPW_Admin.WebUserControls
|
||||
case "textBox":
|
||||
e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{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("chk{0}", nomeCol))).Checked;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -236,25 +223,57 @@ namespace GPW_Admin.WebUserControls
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// check licenze in fase di update...
|
||||
/// determina se sia eliminabile il record (=non usato)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
/// <param name="idxMaker"></param>
|
||||
/// <returns></returns>
|
||||
public bool delEnabled(object idxObj)
|
||||
{
|
||||
if (!licenzeGPW.checkLicenze)
|
||||
bool answ = true;
|
||||
// solo se ha diritti scrittura controllo
|
||||
if (idxObj != null)
|
||||
{
|
||||
if (e != null)
|
||||
int trovati = 0;
|
||||
// controllo se ci siano tipo celle associate
|
||||
trovati = DataProxy.DP.taDipendenti.getByCodOrario(idxObj.ToString()).Rows.Count;
|
||||
// controllo se ci sono record correlati...
|
||||
if (trovati > 0)
|
||||
{
|
||||
// annullo insert se licenze sforate...
|
||||
e.Cancel = true;
|
||||
grView.EditIndex = -1;
|
||||
grView.DataBind();
|
||||
answ = false;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
public void resetSelezione()
|
||||
{
|
||||
grView.SelectedIndex = -1;
|
||||
grView.DataBind();
|
||||
if (eh_resetSelezione != null)
|
||||
{
|
||||
eh_resetSelezione(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// effettua traduzione del lemma
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(string lemma)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user