/// <summary> /// 增加一条数据 /// </summary> public long Add(Model.EsHour model) { int rowsAffected; IDataParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 8), new SqlParameter("@StatId", SqlDbType.Int, 4), new SqlParameter("@TP", SqlDbType.Float, 8), new SqlParameter("@DB", SqlDbType.Float, 8), new SqlParameter("@UpdateTime", SqlDbType.DateTime), new SqlParameter("@DataStatus", SqlDbType.Char, 1), new SqlParameter("@ValidDataNum", SqlDbType.Int, 4), new SqlParameter("@DevId", SqlDbType.Int, 4), new SqlParameter("@Country", SqlDbType.VarChar, 20), new SqlParameter("@Pm25", SqlDbType.Float, 8), new SqlParameter("@Pm100", SqlDbType.Float, 8) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.StatId; parameters[2].Value = model.Tp; parameters[3].Value = model.Db; parameters[4].Value = model.UpdateTime; parameters[5].Value = model.DataStatus; parameters[6].Value = model.ValidDataNum; parameters[7].Value = model.DevId; parameters[8].Value = model.Country; parameters[9].Value = model.Pm25; parameters[10].Value = model.Pm100; DbHelperSql.RunProcedure("T_ESHour_ADD", parameters, out rowsAffected); return((long)parameters[0].Value); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.EsHour model) { int rowsAffected; IDataParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 8), new SqlParameter("@StatId", SqlDbType.Int, 4), new SqlParameter("@TP", SqlDbType.Float, 8), new SqlParameter("@DB", SqlDbType.Float, 8), new SqlParameter("@UpdateTime", SqlDbType.DateTime), new SqlParameter("@DataStatus", SqlDbType.Char, 1), new SqlParameter("@ValidDataNum", SqlDbType.Int, 4), new SqlParameter("@DevId", SqlDbType.Int, 4), new SqlParameter("@Country", SqlDbType.VarChar, 20), new SqlParameter("@Pm25", SqlDbType.Float, 8), new SqlParameter("@Pm100", SqlDbType.Float, 8) }; parameters[0].Value = model.Id; parameters[1].Value = model.StatId; parameters[2].Value = model.Tp; parameters[3].Value = model.Db; parameters[4].Value = model.UpdateTime; parameters[5].Value = model.DataStatus; parameters[6].Value = model.ValidDataNum; parameters[7].Value = model.DevId; parameters[8].Value = model.Country; parameters[9].Value = model.Pm25; parameters[10].Value = model.Pm100; DbHelperSql.RunProcedure("T_ESHour_Update", parameters, out rowsAffected); if (rowsAffected > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.EsHour model) { return(_dal.Update(model)); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.EsHour DataRowToModel(DataRow row) { var model = new Model.EsHour(); if (row != null) { if (row["Id"] != null && row["Id"].ToString() != "") { model.Id = long.Parse(row["Id"].ToString()); } if (row["StatId"] != null && row["StatId"].ToString() != "") { model.StatId = int.Parse(row["StatId"].ToString()); } if (row["TP"] != null && row["TP"].ToString() != "") { model.Tp = double.Parse(row["TP"].ToString()); } if (row["DB"] != null && row["DB"].ToString() != "") { model.Db = double.Parse(row["DB"].ToString()); } if (row["UpdateTime"] != null && row["UpdateTime"].ToString() != "") { model.UpdateTime = DateTime.Parse(row["UpdateTime"].ToString()); } if (row["DevId"] != null && row["DevId"].ToString() != "") { model.DevId = int.Parse(row["DevId"].ToString()); } if (row["Country"] != null) { model.Country = row["Country"].ToString(); } if (row["DataStatus"] != null) { model.DataStatus = row["DataStatus"].ToString(); } if (row["ValidDataNum"] != null && row["ValidDataNum"].ToString() != "") { model.ValidDataNum = int.Parse(row["ValidDataNum"].ToString()); } if (row["DevId"] != null && row["DevId"].ToString() != "") { model.DevId = int.Parse(row["DevId"].ToString()); } if (row["Country"] != null) { model.Country = row["Country"].ToString(); } if (row["PM25"] != null) { model.Pm25 = double.Parse(row["PM25"].ToString()); } if (row["PM100"] != null) { model.Pm100 = double.Parse(row["PM100"].ToString()); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public long Add(Model.EsHour model) { return(_dal.Add(model)); }