Beispiel #1
0
        /// <summary>
        /// Return List editor tracking fields, If not enable return empty list.
        /// </summary>
        /// <param name="layerPath">example: D:\Data.gdb\PointLayer, D:\Data.sde\myDataset\PointLayer </param>
        /// <param name="createUserField"></param>
        /// <param name="createDateField"></param>
        /// <param name="lastEditUserField"></param>
        /// <param name="lastEditDateField"></param>
        /// <returns>List editor tracking field, order in this order (createUserField, createDateField, lastEditUserField, lastEditDateField)</returns>
        public static List <string> GetEditorTrackingFieldNames(string layerPath
                                                                , out string createUserField, out string createDateField
                                                                , out string lastEditUserField, out string lastEditDateField)
        {
            List <string> editorTrackingFields = new List <string>();

            createUserField   = "";
            createDateField   = "";
            lastEditUserField = "";
            lastEditDateField = "";

            Geoprocessor      GP           = new Geoprocessor();
            object            DataType     = "";
            IDataElement      DataElement  = GP.GetDataElement(layerPath, ref DataType);
            IDEEditorTracking ideEditTrack = (IDEEditorTracking)DataElement;

            if (ideEditTrack.EditorTrackingEnabled == true)
            {
                createUserField   = ideEditTrack.CreatorFieldName;
                createDateField   = ideEditTrack.CreatedAtFieldName;
                lastEditUserField = ideEditTrack.EditorFieldName;
                lastEditDateField = ideEditTrack.EditedAtFieldName;
            }

            return(editorTrackingFields);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="layerPath">example: D:\Data.gdb\PointLayer, D:\Data.sde\myDataset\PointLayer </param>
        /// <returns></returns>
        public static bool IsEnableEditorTrackingByLayerPath(string layerPath)
        {
            // Example : @"D:\Data.gdb\PointLayer";

            // Case connection in ArcMap
            // Example : @"Database Connections\mySdeDB.sde\ShopPoint";

            Geoprocessor      GP           = new Geoprocessor();
            object            DataType     = "";
            IDataElement      DataElement  = GP.GetDataElement(layerPath, ref DataType);
            IDEEditorTracking ideEditTrack = (IDEEditorTracking)DataElement;

            if (ideEditTrack.EditorTrackingEnabled == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }