or
var Pattern = new RecurrencePattern();Pattern.Frequency = Frequency_v;Pattern.DayOrdinal = DayOrdinal_i;Pattern.DaysOfWeekMask = DaysofWeekMask_v;Pattern.FirstDayOfWeek = FirstDayofWeek_d;Pattern.Frequency = Frequency_v;Pattern.Interval = Convert.ToInt32(tasks_dr.Field<Int64>("Interval"));Pattern.MaxOccurrences = Convert.ToInt32(tasks_dr.Field<Int64>("MaxOccurrences"));Pattern.MonthOfYear = Convert.ToInt32(tasks_dr.Field<Int64>("MonthofYear"));Pattern.DayOfMonth = Convert.ToInt32(tasks_dr.Field<Int64>("DayofMonth"));System.DateTime? RecursUntil_d;if (tasks_dr.Field<String>("RecursUntil") != "") { RecursUntil_d = Convert.ToDateTime(tasks_dr.Field<String>("RecursUntil")); } else { RecursUntil_d = DateTime.Now; } Pattern.RecursUntil = RecursUntil_d; appointment.RecurrenceRule = new RecurrenceRule(Pattern);public void ItemsRequest(object sender, ItemsRequestEventArgs e){ IList<SqlGeometry> geometryList = new List<SqlGeometry>(); LocationRect currentRegion = new LocationRect(e.UpperLeft, e.LowerRight); string sql = string.Format("SELECT the_geom FROM Locations WHERE the_geom.STIntersects(geometry::STGeomFromText('POLYGON(({0} {1}, {2} {3}, {4} {5}, {6} {7}, {0} {1}))', 0)) = 1 ", currentRegion.Southwest.Longitude, currentRegion.Southwest.Latitude, currentRegion.Northwest.Longitude, currentRegion.Northwest.Latitude, currentRegion.Northeast.Longitude, currentRegion.Northeast.Latitude, currentRegion.Southeast.Longitude, currentRegion.Southeast.Latitude); using (SqlConnection sqlConnection = new SqlConnection(connectionString)) { sqlConnection.Open(); using (SqlCommand sqlCommand = new SqlCommand(geographicalBoundsSQL, sqlConnection)) { using (SqlDataReader reader = sqlCommand.ExecuteReader()) { while (reader.Read()) { SqlGeometry sqlGeometry = (SqlGeometry)reader["the_geom"]; geometryList.Add(sqlGeometry); } } } }