e1297f53ed
storico GIAN è ok
179 lines
5.3 KiB
C#
179 lines
5.3 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using WebSCR_data;
|
|
|
|
namespace WebSCR.WebUserControls
|
|
{
|
|
public partial class mod_impegno : System.Web.UI.UserControl
|
|
{
|
|
/// <summary>
|
|
/// evento errore in update
|
|
/// </summary>
|
|
public event EventHandler eh_errUpd;
|
|
/// <summary>
|
|
/// sollevo evento selezione /deselezione
|
|
/// </summary>
|
|
protected void raiseEventErrUpd()
|
|
{
|
|
if (eh_errUpd != null)
|
|
{
|
|
eh_errUpd(this, new EventArgs());
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// evento update
|
|
/// </summary>
|
|
public event EventHandler eh_Upd;
|
|
/// <summary>
|
|
/// sollevo evento selezione /deselezione
|
|
/// </summary>
|
|
protected void raiseEventUpd()
|
|
{
|
|
if (eh_Upd != null)
|
|
{
|
|
eh_Upd(this, new EventArgs());
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
doUpdate();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// disabilita modalità EDIT record...
|
|
/// </summary>
|
|
public bool disableEdit { get; set; }
|
|
/// <summary>
|
|
/// verifica se ci sia matricola in sessione
|
|
/// </summary>
|
|
public bool hasMatricola
|
|
{
|
|
get
|
|
{
|
|
return matrOp != "";
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// matricola OP (x utente)
|
|
/// </summary>
|
|
public string matrOp
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
answ = memLayer.ML.StringSessionObj("matrOp");
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// impegno corrente
|
|
/// </summary>
|
|
public int idxImpegno
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
try
|
|
{
|
|
answ = Convert.ToInt32(qsVal("IdxImpegno"));
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
public void doUpdate()
|
|
{
|
|
frmViewImpegni.DataBind();
|
|
}
|
|
/// <summary>
|
|
/// recupera valore querystring
|
|
/// </summary>
|
|
/// <param name="nome"></param>
|
|
/// <returns></returns>
|
|
protected string qsVal(string nome)
|
|
{
|
|
return memLayer.ML.QSS(nome);
|
|
}
|
|
/// <summary>
|
|
/// recupero valori mancanti
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void odsImpegni_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
|
{
|
|
if (e.InputParameters["UrlDoc"] == null)
|
|
{
|
|
e.InputParameters["UrlDoc"] = "";
|
|
}
|
|
if (e.InputParameters["UserMod"] == null)
|
|
{
|
|
e.InputParameters["UserMod"] = SteamWare.user_std.UtSn.userNameAD;
|
|
}
|
|
if (e.InputParameters["NoteGen"] == null)
|
|
{
|
|
e.InputParameters["NoteGen"] = "";
|
|
}
|
|
if (e.InputParameters["MatrOp"] == null)
|
|
{
|
|
e.InputParameters["MatrOp"] = matrOp;
|
|
}
|
|
}
|
|
|
|
protected void odsImpegni_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
|
|
{
|
|
memLayer.ML.setSessionVal("errorMess", "Record Eliminato");
|
|
Response.Redirect(SteamWare.devicesAuthProxy.pagCorrente);
|
|
}
|
|
|
|
protected void frmViewImpegni_ItemUpdating(object sender, FormViewUpdateEventArgs e)
|
|
{
|
|
// controllo, SE avesse selezionato ND NON permetto salvataggio e blocco
|
|
if (e.NewValues["RitUsato"].ToString() == "-1")
|
|
{
|
|
e.Cancel = true;
|
|
memLayer.ML.setSessionVal("errorMess", "ERRORE: va specificato Si/no per ritiro usato");
|
|
raiseEventErrUpd();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// formatta messaggio orario controllando SE quello impostato sia fuori fascia promessa a cliente
|
|
/// </summary>
|
|
/// <param name="_dataOra"></param>
|
|
/// <param name="_dataOraFrom"></param>
|
|
/// <param name="_dataOraTo"></param>
|
|
/// <param name="txtMain"></param>
|
|
/// <param name="txtErr"></param>
|
|
/// <returns></returns>
|
|
public string checkOrario(object _dataOra, object _dataOraFrom, object _dataOraTo, object txtMain, object txtErr)
|
|
{
|
|
string answ = txtMain.ToString();
|
|
try
|
|
{
|
|
DateTime DTI = Convert.ToDateTime(_dataOra);
|
|
DateTime DTFrom = Convert.ToDateTime(_dataOraFrom);
|
|
DateTime DTTo = Convert.ToDateTime(_dataOraTo);
|
|
if (DTI.Subtract(DTFrom).TotalMinutes < 0 || DTI.Subtract(DTTo).TotalMinutes > 0)
|
|
{
|
|
answ = string.Format("{0}{1}{0}", txtErr, txtMain);
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
} |