示例#1
0
        public static List <WeatherStationCrop> GetYields(int zoneId, int CropId)
        {
            List <WeatherStationCrop> yields = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.WeatherStationCrops_GetYieldByZoneandCropId"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@zoneId", zoneId);
                paramCollection.AddWithValue("@cropId", CropId);
            }, map : delegate(IDataReader reader, short set)
            {
                if (yields == null)
                {
                    yields = new List <WeatherStationCrop>();
                }
                int startingIndex    = 0;
                WeatherStationCrop y = new WeatherStationCrop();
                y.Yield            = reader.GetSafeDecimal(startingIndex++);
                y.WeatherStationId = reader.GetSafeInt32(startingIndex++);
                y.CropId           = reader.GetSafeInt32(startingIndex++);
                y.LocationName     = reader.GetSafeString(startingIndex++);


                yields.Add(y);
            });

            return(yields);
        }
示例#2
0
        public static WeatherStationCrop GetYield(int WeatherStation, int Crop)
        {
            WeatherStationCrop yield = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.WeatherStationCrops_GetYield"
                                    , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@weatherStationId", WeatherStation);
                paramCollection.AddWithValue("@cropId", Crop);
            }, map : delegate(IDataReader reader, short set)
            {
                if (yield == null)
                {
                    yield = new WeatherStationCrop();
                }

                int startingIndex      = 0;
                yield.Yield            = reader.GetSafeDecimal(startingIndex++);
                yield.WeatherStationId = reader.GetSafeInt32(startingIndex++);
                yield.LocationName     = reader.GetSafeString(startingIndex++);
            });
            return(yield);
        }