private void BindGrid() { List<ParameterProcessView> table = new List<ParameterProcessView>(); for (int i = 0; i < 10; i++) { ParameterProcessView row = new ParameterProcessView(); row.Number = i; row.Parameter = ""; row.ParameterId = 0; row.ParameterXPlot = false; row.ParameterYPlot = false; row.ParameterYPlotRange = 0; row.Unit = ""; row.Value = 0; table.Add(row); } GridView.DataSource = table; GridView.DataBind(); }
/*Funcion: obtener parametros por procesos Param: processID Return: Lista ParameterProcessView */ public List<ParameterProcessView> getParameterByProcess(String processID) { ParameterDao Dao = new ParameterDao(); DataTable DaoResult = Dao.getParameterByProcess(processID); List<ParameterProcessView> ViewList = new List<ParameterProcessView>(); foreach (DataRow row in DaoResult.Rows) { ParameterProcessView x = new ParameterProcessView(); if (DaoResult.Columns.Contains("ParameterId") && row["ParameterId"] != DBNull.Value) { x.ParameterId = Convert.ToInt32(row["ParameterId"]); } if (DaoResult.Columns.Contains("ParameterYPlotRange") && row["ParameterYPlotRange"] != DBNull.Value) { x.ParameterYPlotRange = Convert.ToInt32(row["ParameterYPlotRange"]); } if (DaoResult.Columns.Contains("Parameter") && row["Parameter"] != DBNull.Value) { x.Parameter = row["Parameter"].ToString(); } if (DaoResult.Columns.Contains("Unit") && row["Unit"] != DBNull.Value) { x.Unit = row["Unit"].ToString(); } if (DaoResult.Columns.Contains("ParameterXPlot") && row["ParameterXPlot"] != DBNull.Value) { x.ParameterXPlot = (bool)row["ParameterXPlot"]; } if (DaoResult.Columns.Contains("ParameterYPlot") && row["ParameterYPlot"] != DBNull.Value) { x.ParameterYPlot = (bool)row["ParameterYPlot"]; } if (DaoResult.Columns.Contains("Value") && row["Value"] != DBNull.Value) { x.Value = Convert.ToDouble(row["Value"]); } ViewList.Add(x); } return ViewList; }