/// <summary> /// 得到区间值,实体形式 /// </summary> /// <returns></returns> public static bool CheckEntityForScore(ECTagEntity ltone) { try { List <KPI_ScoreEntity> lts = new List <KPI_ScoreEntity>(); string scoreexp = ltone.ECScoreExp; string ecid = ltone.ECID; DataTable dtScore = GetScoreExp(scoreexp); for (int i = 0; i < dtScore.Rows.Count; i++) { KPI_ScoreEntity entity = new KPI_ScoreEntity(); entity.ScoreID = Guid.NewGuid().ToString(); entity.ECID = ecid; entity.ScoreCalcExp = dtScore.Rows[i]["ScoreCalcExp"].ToString(); entity.ScoreGainExp = dtScore.Rows[i]["ScoreGainExp"].ToString(); entity.ScoreOptimal = int.Parse(dtScore.Rows[i]["ScoreOptimal"].ToString()); entity.ScoreAlarm = int.Parse(dtScore.Rows[i]["ScoreAlarm"].ToString()); entity.ScoreIsValid = int.Parse(dtScore.Rows[i]["ScoreIsValid"].ToString()); lts.Add(entity); } return(true); } catch (Exception) { return(false); } }
/// <summary> /// 得到区间值,实体形式 /// </summary> /// <returns></returns> public static List <KPI_ScoreEntity> GetAllScoreEntity() { List <KPI_ScoreEntity> Result = new List <KPI_ScoreEntity>(); string SqlText = @"SELECT ECID, ECScoreExp FROM KPI_ECTag WHERE ECIsValid=1"; IDataReader Reader = DBAccess.GetRelation().ExecuteReader(SqlText); try { DataTable dtScore; while (Reader.Read()) { string ecid = Reader.GetString(0); string scoreexp = Reader.GetString(1); dtScore = GetScoreExp(scoreexp); foreach (DataRow dr in dtScore.Rows) { KPI_ScoreEntity entity = new KPI_ScoreEntity(); entity.ScoreID = Guid.NewGuid().ToString(); entity.ECID = ecid; entity.ScoreCalcExp = dr["ScoreCalcExp"].ToString(); entity.ScoreGainExp = dr["ScoreGainExp"].ToString(); entity.ScoreOptimal = int.Parse(dr["ScoreOptimal"].ToString()); entity.ScoreAlarm = int.Parse(dr["ScoreAlarm"].ToString()); entity.ScoreIsValid = int.Parse(dr["ScoreIsValid"].ToString()); Result.Add(entity); } dtScore.Rows.Clear(); dtScore.Dispose(); } } finally { Reader.Close(); Reader.Dispose(); } return(Result); //DataTable dt = DBAccess.GetRelation().ExecuteDataset(SqlText).Tables[0]; //foreach (DataRow dr in dt.Rows) { // string scoreexp = dr["ECScoreExp"].ToString(); // string ecid = dr["ECID"].ToString(); // DataTable dtScore = GetScoreExp(scoreexp); // for (int i = 0; i < dtScore.Rows.Count; i++) { // KPI_ScoreEntity entity = new KPI_ScoreEntity(); // entity.ScoreID = Guid.NewGuid().ToString(); // entity.ECID = ecid; // entity.ScoreCalcExp = dtScore.Rows[i]["ScoreCalcExp"].ToString(); // entity.ScoreGainExp = dtScore.Rows[i]["ScoreGainExp"].ToString(); // entity.ScoreOptimal = int.Parse(dtScore.Rows[i]["ScoreOptimal"].ToString()); // entity.ScoreAlarm = int.Parse(dtScore.Rows[i]["ScoreAlarm"].ToString()); // entity.ScoreIsValid = int.Parse(dtScore.Rows[i]["ScoreIsValid"].ToString()); // lts.Add(entity); // } //} //return lts; }