public void UpdateRoadID(int lnversionid)
        {
            //select monitoring points with f-type as 'RAIN'
            try
            {
                //init spatial
                InitSpatial(lnversionid);

                //get dataset of deliverypoints
                dsRSM1.EnforceConstraints = false;
                dsRSM1.Clear();
                daDeliveryPoints.Fill(dsRSM1.rsm_DeliveryPoints);

                //begin edit on rsm_deliverypoints

                //for each deliverypoint feature
                IFeatureCursor delPts = DeliveryPoints.Search(null, false);
                IFeature       delPt  = delPts.NextFeature();
                while (delPt != null)
                {
                    //use search to find nearest road
                    IEnumIDs  roads      = Utility.SearchForFeatures(delPt.Shape, 20, 100, this.Roads, null, null);
                    int       road       = roads.Next();
                    ArrayList roadsArray = new ArrayList();
                    while (road > 0)
                    {
                        roadsArray.Add(road);
                        road = roads.Next();
                    }
                    IFeature closest;
                    //if more than one, get the closest
                    if (roadsArray.Count > 1)
                    {
                        IPoint pt = delPt.Shape as IPoint;
                        closest = Utility.FindClosestFeatureToPoint(pt, Roads, roads);
                    }
                    //else, use the one
                    else
                    {
                        closest = Roads.GetFeature(int.Parse(roadsArray[0].ToString()));
                    }

                    //get row in rsm_deliverypoints (dataset)
                    dsRSM.rsm_DeliveryPointsRow delpt =
                        dsRSM1.rsm_DeliveryPoints.FindByDeliveryPointIDLNVersionID(delPt.OID, lnversionid);

                    delpt.BeginEdit();
                    delpt.RoadID = closest.OID;                     //int.Parse(closest.OID.get_Value(closest.Fields.FindField("RoadID")).ToString());
                    delpt.EndEdit();
                    delPt = delPts.NextFeature();
                }

                //update rsm_deliveryoints with changes
                daDeliveryPoints.Update(dsRSM1.rsm_DeliveryPoints);
                dsRSM1.rsm_DeliveryPoints.AcceptChanges();
            }
            catch (Exception err)
            {
                throw err;
            }
            finally
            {
                connRSM.Close();
            }
        }
        public void UpdateHydroSegID(int lnversionid)
        {
            //select monitoring points with f-type as 'RAIN'
            try
            {
                //init spatial
                InitSpatial(lnversionid);

                //get dataset of deliverypoints
                dsRSM1.EnforceConstraints = false;
                dsRSM1.Clear();
                daDeliveryPoints.Fill(dsRSM1.rsm_DeliveryPoints);

                //begin edit on rsm_deliverypoints

                //for each deliverypoint feature
                IFeatureCursor delPts = DeliveryPoints.Search(null, false);
                IFeature       delPt  = delPts.NextFeature();
                while (delPt != null)
                {
                    //use search to find nearest road
                    IEnumIDs  hydros      = Utility.SearchForFeatures(delPt.Shape, 20, 100, this.Hydro, null, null);
                    int       hydro       = hydros.Next();
                    ArrayList hydrosArray = new ArrayList();
                    while (hydro > 0)
                    {
                        hydrosArray.Add(hydro);
                        hydro = hydros.Next();
                    }
                    IFeature closest;
                    //if more than one, get the closest
                    if (hydrosArray.Count > 1)
                    {
                        IPoint pt = delPt.Shape as IPoint;
                        closest = Utility.FindClosestFeatureToPoint(pt, this.Hydro, hydros);
                    }
                    //else, use the one
                    else
                    {
                        closest = Hydro.GetFeature(int.Parse(hydrosArray[0].ToString()));
                    }

                    //get row in rsm_deliverypoints (dataset)
                    dsRSM.rsm_DeliveryPointsRow delpt =
                        dsRSM1.rsm_DeliveryPoints.FindByDeliveryPointIDLNVersionID(delPt.OID, lnversionid);

                    delpt.BeginEdit();
                    delpt.HydroSegID = closest.get_Value(closest.Fields.FindField("ExternalID")).ToString();
                    delpt.EndEdit();
                    delPt = delPts.NextFeature();
                }

                //update rsm_deliveryoints with changes
                daDeliveryPoints.Update(dsRSM1.rsm_DeliveryPoints);
                dsRSM1.rsm_DeliveryPoints.AcceptChanges();

                //overwrite overlay values with those from rmap where valid
                connRSM.Open();
                cmdUpdateDelPtHydro.ExecuteNonQuery();
            }
            catch (Exception err)
            {
                throw err;
            }
            finally
            {
                connRSM.Close();
            }
        }