private void btnImport_Click(object sender, EventArgs e)
        {
            IFeatureClass SelShapeFile, SurveyBoundaryFC;
            string ErrorMessage="" ,Comments, Park, SurveyName;
            ESRI.ArcGIS.Geometry.ISpatialReference DefaultSpatRef, ImportSpatRef;
            IFeatureCursor ThisFCursor;
            IFeatureBuffer ThisFBuffer;
            IFeature ImportFeature;
            IFeatureCursor ImportCursor;
            int CommentsImpIndex, ParkImpIndex, SurveyNameImpIndex,
                CommentsIndex, ParkIndex, SurveyNameIndex, SurveyIDIndex,
                NextSurveyID,ImportCount;
            NewSurveyBoundaryForm form;

            //make sure we have a shapefile path
            if (string.IsNullOrEmpty(txtShapeFilePath.Text.Trim()))
            {
                MessageBox.Show("Please provide the path to the polygon ShapeFile containing the survey areas to import.");
                return;
            }

            //get the shape file at the specified path - make sure it's good
            SelShapeFile = Util.GetShapeFile(txtShapeFilePath.Text, ref ErrorMessage);
            if (string.IsNullOrEmpty(ErrorMessage) == false)
            {
                MessageBox.Show(ErrorMessage);
                return;
            }

            //make sure shapefile contains polygons
            if (SelShapeFile.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon)
            {
                MessageBox.Show("The selected ShapeFile is not a polygon shapefile");
                return;
            }

            //make sure there are features to import
            if (SelShapeFile.FeatureCount(null) == 0)
            {
                MessageBox.Show("There are no features in this ShapeFile");
                return;
            }

            //make sure the shapefile has the same spatial reference as the NPS geodatabase featureclasses
            DefaultSpatRef = Util.GetDefaultSpatialReference();
            ImportSpatRef = ((IGeoDataset)SelShapeFile).SpatialReference;
            if (Util.CompareSpatialReference(DefaultSpatRef, ImportSpatRef)==false)
            {
                MessageBox.Show("(Err) The selected ShapeFile has the coordinate system '"
                + ImportSpatRef.Name + "' which is different "
                + "from that of the NPS database coordinate system which is '"
                + DefaultSpatRef.Name + "'.");
                return;
            }

            //make sure we have the survey boundary feature class
            SurveyBoundaryFC = Util.GetFeatureClass(m_NPS.LYR_SURVEY_BOUNDARY,
                m_NPS.Workspace, ref ErrorMessage);
            if (string.IsNullOrEmpty(ErrorMessage) == false)
            {
                MessageBox.Show(ErrorMessage);
                return;
            }

            //get boundary fc survey field indexes
            SurveyIDIndex = SurveyBoundaryFC.FindField("SurveyID");
            SurveyNameIndex = SurveyBoundaryFC.FindField("SurveyName");
            ParkIndex = SurveyBoundaryFC.FindField("Park");
            CommentsIndex = SurveyBoundaryFC.FindField("Comments");

            //missing valid fields - can't go futher
            if (SurveyIDIndex == -1 || SurveyNameIndex == -1 || ParkIndex == -1 || CommentsIndex == -1)
            {
                MessageBox.Show("Survey Boundary FeatureClass is missing important fields needed for import");
                return;
            }

            //get import survey field indexes - may or may not have fields
            CommentsImpIndex = SelShapeFile.FindField("Comments");
            ParkImpIndex = SelShapeFile.FindField("Park");
            SurveyNameImpIndex = SelShapeFile.FindField("SurveyName");

            //insert cursor for survey boundary
            ThisFCursor = SurveyBoundaryFC.Insert(true);
            ThisFBuffer = SurveyBoundaryFC.CreateFeatureBuffer();

            form = new NewSurveyBoundaryForm();

            //try to get the next valid survey id
            NextSurveyID = Util.NextSurveyID(ref ErrorMessage);
            if (string.IsNullOrEmpty(ErrorMessage) == false)
            {
                MessageBox.Show(ErrorMessage);
                return;
            }

            ImportCount = 0;

            //loop through each shapefile boundary and inport it into database
            ImportCursor = SelShapeFile.Search(null, false);
            while ((ImportFeature = ImportCursor.NextFeature()) != null)
            {
                if (ImportFeature.Shape == null) continue;

                ThisFBuffer.Shape = ImportFeature.ShapeCopy;

                Comments = "";
                Park = "";
                SurveyName = "";

                //if the shapefile has fields for the boundary fc get, their values
                SurveyName = SurveyNameImpIndex == -1 ? "" :
                    (string)Util.SafeConvert(ImportFeature.get_Value(SurveyNameImpIndex), typeof(string));
                SurveyName = SurveyName.Trim();

                Comments = CommentsImpIndex == -1 ? "" :
                    (string)Util.SafeConvert(ImportFeature.get_Value(CommentsImpIndex), typeof(string));
                Comments = Comments.Trim();

                Park = ParkImpIndex == -1 ? "" :
                    (string)Util.SafeConvert(ImportFeature.get_Value(ParkImpIndex), typeof(string));
                Park = Park.Trim();

                //if user didn't check don't ask again and there isn't a survey name field or valid survey name
                //value, we will show the form to get user data
                if (form.ckbDontAskAgain.Checked == false && string.IsNullOrEmpty(SurveyName) == true)
                {
                    form.txtPark.Text = Park;
                    form.txtComments.Text = Comments;
                    form.txtSurveyName.Text = SurveyName;
                    form.txtSurveyID.Text = Convert.ToString(NextSurveyID);

                    form.ShowDialog();

                    Comments = form.txtComments.Text;
                    Park = form.txtPark.Text;
                    SurveyName = form.txtSurveyName.Text;
                }

                //if we don't have a survey name, the survey id will stand in for the
                //survey name
                SurveyName = string.IsNullOrEmpty(SurveyName.Trim()) ? Convert.ToString(NextSurveyID) : SurveyName;

                //set values for new boundary
                ThisFBuffer.set_Value(CommentsIndex,Comments);
                ThisFBuffer.set_Value(ParkIndex, Park);
                ThisFBuffer.set_Value(SurveyNameIndex, SurveyName);
                ThisFBuffer.set_Value(SurveyIDIndex, NextSurveyID);

                //insert boundary
                ThisFCursor.InsertFeature(ThisFBuffer);

                //get next valid surveyid
                NextSurveyID++;

                //count the number of features imported
                ImportCount++;
            }

            ImportCursor = null;
            ThisFCursor = null;

            MessageBox.Show("Import completed successfully. " + ImportCount + " feature(s) imported.");
        }
        /// <summary>
        /// handler for Editor feature creation event 
        /// </summary>
        public static void OnCreateFeature(ESRI.ArcGIS.Geodatabase.IObject pObject)
        {
            IFeature ThisFeature = null;
            NPSGlobal NPS;
            ILayer CurrentLayer;
            int SurveyIDIndex, CommentsIndex, ParkIndex, SurveyNameIndex, NextSurveyID;
            string ErrorMessage = "", SurveyName;

            NPS = NPSGlobal.Instance;

            //make sure the tools are active
            if (NPS.IsInitialized == false) return;

            //make sure object is IFeature
            if (!(pObject is IFeature))
                return;

            //get created feature
            ThisFeature = (IFeature)pObject;

            //make sure we have a reference to the local editor
            if (NPS.Editor == null)
                return;

            //get the current layer being edited
            CurrentLayer = ((IEditLayers)NPS.Editor).CurrentLayer;

            //not really necessary to check
            if ((CurrentLayer is IFeatureLayer) == false || (CurrentLayer as IFeatureLayer).FeatureClass == null) return;

            //we only care when new survey boundaries are created and created by the user, not in code
            if (((IDataset)(CurrentLayer as IFeatureLayer).FeatureClass).Name != NPS.LYR_SURVEY_BOUNDARY
                || NPS.ProgramaticFeatureEdit == true)
                return;

            //get indexes of fields we need to set for the new survey boundary feature
            SurveyIDIndex = ThisFeature.Fields.FindField("SurveyID");
            SurveyNameIndex = ThisFeature.Fields.FindField("SurveyName");
            ParkIndex = ThisFeature.Fields.FindField("Park");
            CommentsIndex = ThisFeature.Fields.FindField("Comments");

            if (SurveyIDIndex == -1 || SurveyNameIndex == -1 || ParkIndex == -1 || CommentsIndex == -1)
                return;

            //try to get the next valid survey id
            NextSurveyID = Util.NextSurveyID(ref ErrorMessage);
            if (string.IsNullOrEmpty(ErrorMessage) == false)
                return;

            //get the user to enter info for the new survey boundary and save the
            //form data to the new survey
            using (NewSurveyBoundaryForm form = new NewSurveyBoundaryForm())
            {
                form.ckbDontAskAgain.Visible = false;
                form.txtSurveyID.Text = Convert.ToString(NextSurveyID);
                form.ShowDialog();

                //if we don't have a survey name, the survey id will stand in for the
                //survey name
                SurveyName = string.IsNullOrEmpty(form.txtSurveyName.Text.Trim()) ?
                    Convert.ToString(NextSurveyID) : form.txtSurveyName.Text;

                ThisFeature.set_Value(SurveyIDIndex, NextSurveyID);
                ThisFeature.set_Value(SurveyNameIndex, SurveyName);
                ThisFeature.set_Value(ParkIndex, form.txtPark.Text);
                ThisFeature.set_Value(CommentsIndex, form.txtComments.Text);
                ThisFeature.Store();
            }
        }