Files
ScheMe/ScheMe-SP/VVSP_12.aspx.cs
Samuele E. Locatelli cbe94e6fce fix edit x 345...
2017-09-05 10:19:12 +02:00

113 lines
3.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ScheMe_Data;
using SteamWare;
using System.Globalization;
namespace ScheMe
{
public partial class VVSP_12 : SteamWare.UserPage
{
protected int idxPaziente
{
get
{
return memLayer.ML.IntSessionObj("IdxPaziente");
}
}
/// <summary>
/// pagina caricata
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// verifico se sia con parametro paziente o NEW...
string cmd = Request.QueryString["cmd"];
if (cmd == "" || cmd == null || cmd == "sel")
{
frmView.ChangeMode(FormViewMode.ReadOnly);
}
else if (cmd == "new")
{
if (isWriteEnabled)
{
frmView.ChangeMode(FormViewMode.Insert);
}
else
{
frmView.ChangeMode(FormViewMode.ReadOnly);
}
}
}
}
/// <summary>
/// modo formview cambiato
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void frmView_ModeChanged(object sender, EventArgs e)
{
}
/// <summary>
/// evento delete
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ods_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
{
Response.Redirect("Valutazioni");
}
/// <summary>
/// variabile per modo pre comando di update mode...
/// </summary>
public FormViewMode prevMode { get; set; }
/// <summary>
/// evento pre-cambio modo
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void frmView_ModeChanging(object sender, FormViewModeEventArgs e)
{
prevMode = frmView.CurrentMode;
}
protected void frmView_ItemCreated(object sender, EventArgs e)
{
// imposto altezza/peso...
try
{
// recupero dati paziente...
DS_Applicazione.AnagPazientiRow riga = DtProxy.man.taAP.getByKey(idxPaziente)[0];
// Popolo!
TextBox txtAltezza = ((TextBox)frmView.FindControl("txtAltezza"));
if (txtAltezza != null) txtAltezza.Text = riga.Altezza.ToString();
TextBox txtPeso = ((TextBox)frmView.FindControl("txtPeso"));
if (txtPeso != null) txtPeso.Text = riga.Peso.ToString();
}
catch
{ }
}
protected void frmView_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
// fix decimale x float...
e.NewValues["Altezza"] = decimal.Parse(e.NewValues["Altezza"].ToString().Replace(".", ","));
e.NewValues["Peso"] = decimal.Parse(e.NewValues["Peso"].ToString().Replace(".", ","));
e.NewValues["CD"] = decimal.Parse(e.NewValues["CD"].ToString().Replace(".", ","));
}
protected void frmView_ItemInserting(object sender, FormViewInsertEventArgs e)
{
// fix decimale x float...
e.Values["Altezza"] = decimal.Parse(e.Values["Altezza"].ToString().Replace(".", ","));
e.Values["Peso"] = decimal.Parse(e.Values["Peso"].ToString().Replace(".", ","));
e.Values["CD"] = decimal.Parse(e.Values["CD"].ToString().Replace(".", ","));
}
}
}