Files
C2P/C2P/WebUserControls/mod_Q_Quot.ascx.cs
T
Samuele E. Locatelli 5da0acefb4 vers 103
inclusa gestioen diritti utente (senza VERA conf) x gestioen visibilità note quote in quote det...
eliminati componenti login "legacy"
2014-07-18 15:04:22 +02:00

96 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace C2P.WebUserControls
{
public partial class mod_Q_Quot : SteamWare.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public event EventHandler eh_update;
/// <summary>
/// fa toggle tra modo edit e read/item
/// </summary>
public void toggleMode()
{
if (frmView.CurrentMode == FormViewMode.ReadOnly)
{
frmView.ChangeMode(FormViewMode.Edit);
}
else
{
frmView.ChangeMode(FormViewMode.ReadOnly);
}
}
/// <summary>
/// indica se il controllo sia in modalità editing
/// </summary>
public bool isEditing
{
get
{
return (frmView.CurrentMode == FormViewMode.Edit);
}
}
protected void odsQuotes_Updated(object sender, ObjectDataSourceStatusEventArgs e)
{
if (eh_update != null)
{
eh_update(this, new EventArgs());
}
}
/// <summary>
/// restituisce classe CSS da confronto di 2 valori numerici:
/// - rosso se val1 minore val2
/// - verde se val1 >= val2
/// </summary>
/// <param name="val1"></param>
/// <param name="val2"></param>
/// <returns></returns>
public string colorByVal(object val1, object val2)
{
string answ = "text-success";
if (Math.Round(Convert.ToDecimal(val1), 3) < Math.Round(Convert.ToDecimal(val2), 3)) answ = "text-danger";
return answ;
}
/// <summary>
/// controllo se inviare evento refresh al cambio di modo della formview
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void frmView_ModeChanged(object sender, EventArgs e)
{
if (frmView.CurrentMode == FormViewMode.ReadOnly)
{
if (eh_update != null)
{
eh_update(this, new EventArgs());
}
}
}
/// <summary>
/// effettua update
/// </summary>
public void doUpdate()
{
frmView.DataBind();
}
/// <summary>
/// verifica se utente sia admin altrimenti non vede dati...
/// </summary>
public bool userIsAdmin
{
get
{
bool answ = SteamWare.user_std.UtSn.userHasRight("SuperUser");
return answ;
}
}
}
}