示例#1
0
        public void EnableArchivingOnClass(ref IFeatureClass ifeatureClass_0)
        {
            bool flag  = false;
            bool flag2 = false;
            IVersionedObject3 versionedObject = (IVersionedObject3)ifeatureClass_0;

            versionedObject.GetVersionRegistrationInfo(out flag, out flag2);
            if (!flag)
            {
                versionedObject.RegisterAsVersioned3(false);
            }
            else if (flag2)
            {
                versionedObject.UnRegisterAsVersioned3(false);
                versionedObject.RegisterAsVersioned3(false);
            }
            IArchivableObject archivableObject = (IArchivableObject)versionedObject;

            if (archivableObject.IsArchiving)
            {
                archivableObject.DisableArchiving(true, true);
                archivableObject.EnableArchiving(null, null, true);
            }
            else
            {
                archivableObject.EnableArchiving(null, null, true);
            }
        }
示例#2
0
 public override void OnClick()
 {
     try
     {
         IArchivableObject archivableObject = (IArchivableObject)this.iversionedObject3_0;
         archivableObject.EnableArchiving(null, null, true);
     }
     catch (Exception ex)
     {
         MessageService.Current.Warn(ex.Message);
     }
 }
示例#3
0
        public static bool EnableAchive(string name, IFeatureWorkspace featureWorkspace)
        {
            IVersionedObject3 pVersionedObject  = null;
            IArchivableObject pArchivableObject = null;
            bool bRegistered                    = false;
            bool bMovingEditsToBase             = false;
            IFeatureWorkspace pFeatureWorkspace = featureWorkspace;

            try
            {
                pVersionedObject = pFeatureWorkspace.OpenFeatureClass(name) as IVersionedObject3;
                pVersionedObject.GetVersionRegistrationInfo(out bRegistered, out bMovingEditsToBase);

                //如果数据没有注册为版本,则进行注册
                if (!bRegistered)
                {
                    pVersionedObject.RegisterAsVersioned3(false);
                }
                else
                {
                    if (bMovingEditsToBase)
                    {
                        pVersionedObject.UnRegisterAsVersioned3(false);
                        pVersionedObject.RegisterAsVersioned3(false);
                    }
                }
                //获取归档对象、判断数据是否归档
                pArchivableObject = pVersionedObject as IArchivableObject;
                if (!pArchivableObject.IsArchiving)
                {
                    pArchivableObject.EnableArchiving(null, null, false);
                }
                return(true);
            }
            catch (Exception)
            {
            }
            return(false);
        }