private int LoadTechnology(int id) { DBWorker dbConnection = new DBWorker(); if (dbConnection.isConnected) { DataTable modelTable = dbConnection.LoadModel(DbSelect.SelectTech, id); if (W.task == null) { W.task = new DataPlavka(dbConnection.GetPlavka(DbSelect.Columns, null)); //берем список параметров } if (modelTable == null) { return(-1); } if (modelTable.Rows.Count == 0) { return(0); } W.technology = new Technology(id); W.technology.date = Convert.ToDateTime(modelTable.Rows[0]["DATE_TECH"]); string[] markInfo = dbConnection.GetMark(Convert.ToInt32(modelTable.Rows[0]["STE_ID"])); W.technology.GOST = markInfo[0]; W.technology.mark = markInfo[1] + " " + markInfo[2]; W.technology.rmserror = Convert.ToDouble(modelTable.Rows[0]["RMSERROR"]); if (W.technology.rmserror == 0) { W.technology.rmserror = 1.0e-16; } W.technology.descretID = Convert.ToInt32(modelTable.Rows[0]["DES_ID"]); W.technology.regressID = Convert.ToInt32(modelTable.Rows[0]["REG_ID"]); W.technology.baseTechnologyID = Convert.ToInt32(modelTable.Rows[0]["BASE_ID"]); if (W.technology.baseTechnologyID != -1) { W.technology.isCorrected = true; } //формируем массив факторов Х for (int i = 0; i < W.task.xAll.Count; i++) { if (modelTable.Rows[0][W.task.xAll[i].name] != System.DBNull.Value) { W.technology.x.Add(i); } } //формируем массив факторов Y for (int i = 0; i < W.task.yAll.Count; i++) { if (modelTable.Rows[0][W.task.yAll[i].name] != System.DBNull.Value) { W.technology.y.Add(i); } } for (int i = 0; i < W.technology.x.Count; i++) { W.technology.xOpt.Add(Convert.ToDouble(modelTable.Rows[0][W.task.xAll[W.technology.x[i]].name])); } for (int i = 0; i < W.technology.y.Count; i++) { W.technology.yOpt.Add(Convert.ToDouble(modelTable.Rows[0][W.task.yAll[W.technology.y[i]].name])); } } dbConnection.CloseConnection(); return(1); }