141 lines
5.7 KiB
C#
141 lines
5.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SteamWare;
|
|
using MedPred_Data;
|
|
using System.Data;
|
|
|
|
namespace MedPred
|
|
{
|
|
public partial class VLab : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
protected int IdxPaziente
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.IntSessionObj("IdxPaziente");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// richiesta nuovo record
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbNew_Click(object sender, EventArgs e)
|
|
{
|
|
grView.ShowFooter = true;
|
|
}
|
|
/// <summary>
|
|
/// elenco colonne del datagrid
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected DataColumnCollection colonneObj()
|
|
{
|
|
DS_Applicazione.VisLabDataTable tabella = new MedPred_Data.DS_Applicazione.VisLabDataTable();
|
|
DataColumnCollection colonne = tabella.Columns;
|
|
return colonne;
|
|
}
|
|
/// <summary>
|
|
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
|
|
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
|
|
{
|
|
//recupero la riga footer...
|
|
DataColumnCollection colonne = colonneObj();
|
|
string nomeCol;
|
|
string tipoColonna = "";
|
|
foreach (DataColumn colonna in colonne)
|
|
{
|
|
nomeCol = colonna.ColumnName;
|
|
// cerco un textbox o quello che sia...
|
|
if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "textBox";
|
|
}
|
|
else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "dropDownList";
|
|
}
|
|
else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "checkBox";
|
|
}
|
|
else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "selAjax";
|
|
}
|
|
// in base al tipo salvo negli inputparameters dell'ODS
|
|
switch (tipoColonna)
|
|
{
|
|
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;
|
|
}
|
|
tipoColonna = "";
|
|
}
|
|
// sistemo data...
|
|
e.InputParameters["DataVisita"] = Convert.ToDateTime(e.InputParameters["DataVisita"]);
|
|
e.InputParameters["Glicemia"] = Convert.ToDouble(e.InputParameters["Glicemia"]);
|
|
e.InputParameters["ColesTot"] = Convert.ToDouble(e.InputParameters["ColesTot"]);
|
|
e.InputParameters["LDL"] = Convert.ToDouble(e.InputParameters["LDL"]);
|
|
e.InputParameters["HDL"] = Convert.ToDouble(e.InputParameters["HDL"]);
|
|
e.InputParameters["Trigliceridi"] = Convert.ToDouble(e.InputParameters["Trigliceridi"]);
|
|
e.InputParameters["ColRapLDLHDL"] = Convert.ToDouble(e.InputParameters["ColRapLDLHDL"]);
|
|
e.InputParameters["Creatinina"] = Convert.ToDouble(e.InputParameters["Creatinina"]);
|
|
e.InputParameters["Omocisteina"] = Convert.ToDouble(e.InputParameters["Omocisteina"]);
|
|
e.InputParameters["MHTFR"] = Convert.ToDouble(e.InputParameters["MHTFR"]);
|
|
e.InputParameters["FattII"] = Convert.ToDouble(e.InputParameters["FattII"]);
|
|
e.InputParameters["FattV"] = Convert.ToDouble(e.InputParameters["FattV"]);
|
|
}
|
|
/// <summary>
|
|
/// inserisce nuovo valore da footer
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lblIns_click(object sender, EventArgs e)
|
|
{
|
|
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
|
|
ods.Insert();
|
|
}
|
|
protected void ods_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
|
|
{
|
|
grView.ShowFooter = false;
|
|
}
|
|
protected void grView_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
string cmd = Request.QueryString["cmd"];
|
|
if (cmd == "sel")
|
|
{
|
|
try
|
|
{
|
|
|
|
if (((DS_Applicazione.VisGenRow)((DataRowView)e.Row.DataItem).Row).DataVisita == Convert.ToDateTime(memLayer.ML.StringSessionObj("DataVisita")))
|
|
{
|
|
memLayer.ML.setSessionVal("IdxRowVGen", e.Row.DataItemIndex);
|
|
Response.Redirect("VLab");
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
}
|
|
}
|
|
} |