/// <summary> /// 获取所有供电能耗月线信息。 /// </summary> /// <returns></returns> public List<MonthConsumeInfo> GetMonthConsume(out string errMsg) { DataTable dts = dc.GetMonthConsume(out errMsg); List<MonthConsumeInfo> infoList = new List<MonthConsumeInfo>(); //转化为list,筛选。 if (dts.Rows.Count > 0) { for (int i = 0; i < dts.Rows.Count; i++) { MonthConsumeInfo info = new MonthConsumeInfo(); info.year = String.IsNullOrEmpty(dts.Rows[i]["T_YEAR"].ToString()) ? 0 : Convert.ToInt32(dts.Rows[i]["T_YEAR"].ToString()); info.month = String.IsNullOrEmpty(dts.Rows[i]["T_MONTH"].ToString()) ? 0 : Convert.ToInt32(dts.Rows[i]["T_MONTH"].ToString()); info.values = String.IsNullOrEmpty(dts.Rows[i]["T_VALUE"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["T_VALUE"].ToString()); infoList.Add(info); } } return infoList; }
/// <summary> /// 更新指定时间供电能耗月线信息。 /// </summary> /// <returns></returns> public bool UpdateMonthConsumeByTime(MonthConsumeInfo info, out string errMsg) { return dc.UpdateMonthConsumeByTime(info, out errMsg); }
/// <summary> /// 更新指定时间供电能耗月线信息。 /// </summary> /// <returns></returns> public bool UpdateMonthConsumeByTime(MonthConsumeInfo info, out string errMsg) { this.init(); errMsg = ""; bool flag = false; string sql = "update T_INFO_MONTHCONSUME SET T_VALUE=" + info.values + " where T_YEAR='" + info.year + "' and T_MONTH='" + info.month + "'"; if (rlDBType == "SQL") { // sql = "select ID_KEY,班次名,起始时间,结束时间 from 班次时间表 order by ID_KEY"; //dt = DBsql.RunDataTable(sql, out errMsg); } else { flag = DBdb2.RunNonQuery(sql, out errMsg); } return flag; }