/// <summary> /// Creates a new ClimateNorm record using async /// </summary> public static async Task CreateAsync(ClimateNormDO DO) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); SqlParameter _AveragePrecipitationWinter = new SqlParameter("AveragePrecipitationWinter", SqlDbType.Decimal); SqlParameter _AveragePrecipitationSpring = new SqlParameter("AveragePrecipitationSpring", SqlDbType.Decimal); SqlParameter _AveragePrecipitationSummer = new SqlParameter("AveragePrecipitationSummer", SqlDbType.Decimal); SqlParameter _AveragePrecipitationFall = new SqlParameter("AveragePrecipitationFall", SqlDbType.Decimal); SqlParameter _SeasonalTemperatureRangeWinter = new SqlParameter("SeasonalTemperatureRangeWinter", SqlDbType.Decimal); SqlParameter _SeasonalTemperatureRangeSpring = new SqlParameter("SeasonalTemperatureRangeSpring", SqlDbType.Decimal); SqlParameter _SeasonalTemperatureRangeSummer = new SqlParameter("SeasonalTemperatureRangeSummer", SqlDbType.Decimal); SqlParameter _SeasonalTemperatureRangeFall = new SqlParameter("SeasonalTemperatureRangeFall", SqlDbType.Decimal); _PermitKey.Value = DO.PermitKey; _AveragePrecipitationWinter.Value = DO.AveragePrecipitationWinter; _AveragePrecipitationSpring.Value = DO.AveragePrecipitationSpring; _AveragePrecipitationSummer.Value = DO.AveragePrecipitationSummer; _AveragePrecipitationFall.Value = DO.AveragePrecipitationFall; _SeasonalTemperatureRangeWinter.Value = DO.SeasonalTemperatureRangeWinter; _SeasonalTemperatureRangeSpring.Value = DO.SeasonalTemperatureRangeSpring; _SeasonalTemperatureRangeSummer.Value = DO.SeasonalTemperatureRangeSummer; _SeasonalTemperatureRangeFall.Value = DO.SeasonalTemperatureRangeFall; SqlParameter[] _params = new SqlParameter[] { _PermitKey, _AveragePrecipitationWinter, _AveragePrecipitationSpring, _AveragePrecipitationSummer, _AveragePrecipitationFall, _SeasonalTemperatureRangeWinter, _SeasonalTemperatureRangeSpring, _SeasonalTemperatureRangeSummer, _SeasonalTemperatureRangeFall }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; await DataCommon.ExecuteNonQueryAsync("[dbo].[ClimateNorm_Insert]", _params, pid); }
public ClimatologicalDataBO WriteDataToTables(int PermitKey) { ClimatologicalDataBO data = new ClimatologicalDataBO(); data.AverageWindDirection = this.AverageWindDirection; data.AverageWindVelocity = this.AverageWindVelocity; data.PermitKey = PermitKey; if (data.ClimateNorm == null) { ClimateNormDO NewClimateDO = new ClimateNormDO(); NewClimateDO.PermitKey = PermitKey; data.ClimateNorm = NewClimateDO; } data.ClimateNorm.AveragePrecipitationFall = this.AveragePrecipitationFall; data.ClimateNorm.AveragePrecipitationWinter = this.AveragePrecipitationWinter; data.ClimateNorm.AveragePrecipitationSpring = this.AveragePrecipitationSpring; data.ClimateNorm.AveragePrecipitationSummer = this.AveragePrecipitationSummer; data.ClimateNorm.SeasonalTemperatureRangeFall = this.SeasonalTemperatureRangeFall; data.ClimateNorm.SeasonalTemperatureRangeWinter = this.SeasonalTemperatureRangeWinter; data.ClimateNorm.SeasonalTemperatureRangeSpring = this.SeasonalTemperatureRangeSpring; data.ClimateNorm.SeasonalTemperatureRangeSummer = this.SeasonalTemperatureRangeSummer; return data; }
/// <summary> /// Gets all ClimateNorm records /// </summary> public static ClimateNormDO[] GetAll() { string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[ClimateNorm_GetAll]", new SqlParameter[] { }, pid); List<ClimateNormDO> objs = new List<ClimateNormDO>(); while(sr.Read()){ ClimateNormDO obj = new ClimateNormDO(); obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey")); obj.AveragePrecipitationWinter = sr.GetDecimal(sr.GetOrdinal("AveragePrecipitationWinter")); obj.AveragePrecipitationSpring = sr.GetDecimal(sr.GetOrdinal("AveragePrecipitationSpring")); obj.AveragePrecipitationSummer = sr.GetDecimal(sr.GetOrdinal("AveragePrecipitationSummer")); obj.AveragePrecipitationFall = sr.GetDecimal(sr.GetOrdinal("AveragePrecipitationFall")); obj.SeasonalTemperatureRangeWinter = sr.GetDecimal(sr.GetOrdinal("SeasonalTemperatureRangeWinter")); obj.SeasonalTemperatureRangeSpring = sr.GetDecimal(sr.GetOrdinal("SeasonalTemperatureRangeSpring")); obj.SeasonalTemperatureRangeSummer = sr.GetDecimal(sr.GetOrdinal("SeasonalTemperatureRangeSummer")); obj.SeasonalTemperatureRangeFall = sr.GetDecimal(sr.GetOrdinal("SeasonalTemperatureRangeFall")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Selects ClimateNorm records by PK /// </summary> public static async Task<ClimateNormDO[]> GetByPKAsync(Int32 PermitKey) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); _PermitKey.Value = PermitKey; SqlParameter[] _params = new SqlParameter[] { _PermitKey }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[ClimateNorm_GetByPK]", _params, pid); List<ClimateNormDO> objs = new List<ClimateNormDO>(); while(sr.Read()) { ClimateNormDO obj = new ClimateNormDO(); obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey")); obj.AveragePrecipitationWinter = sr.GetDecimal(sr.GetOrdinal("AveragePrecipitationWinter")); obj.AveragePrecipitationSpring = sr.GetDecimal(sr.GetOrdinal("AveragePrecipitationSpring")); obj.AveragePrecipitationSummer = sr.GetDecimal(sr.GetOrdinal("AveragePrecipitationSummer")); obj.AveragePrecipitationFall = sr.GetDecimal(sr.GetOrdinal("AveragePrecipitationFall")); obj.SeasonalTemperatureRangeWinter = sr.GetDecimal(sr.GetOrdinal("SeasonalTemperatureRangeWinter")); obj.SeasonalTemperatureRangeSpring = sr.GetDecimal(sr.GetOrdinal("SeasonalTemperatureRangeSpring")); obj.SeasonalTemperatureRangeSummer = sr.GetDecimal(sr.GetOrdinal("SeasonalTemperatureRangeSummer")); obj.SeasonalTemperatureRangeFall = sr.GetDecimal(sr.GetOrdinal("SeasonalTemperatureRangeFall")); objs.Add(obj); } return objs.ToArray(); }
/// <summary> /// Deletes a ClimateNorm record /// </summary> public static async Task<int> DeleteAsync(ClimateNormDO DO) { SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int); _PermitKey.Value = DO.PermitKey; SqlParameter[] _params = new SqlParameter[] { _PermitKey }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return await DataCommon.ExecuteScalarAsync("[dbo].[ClimateNorm_Delete]", _params, pid); }