示例#1
0
        /// <summary>
        /// Perform a deep clone of an annotation table UserObject including the underlying data
        /// </summary>
        /// <param name="uo"></param>
        /// <returns></returns>

        public static UserObject DeepClone(UserObject uo)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                ServiceTypes.UserObjectNode serviceUONode =
                    ServiceFacade.TypeConversionHelper.Convert <UserObject, ServiceTypes.UserObjectNode>(uo);
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusAnnotationService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusAnnotationService.DeepClone,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { serviceUONode }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();

                if (resultObject == null)
                {
                    return(null);
                }

                ServiceTypes.UserObjectNode uoNode = (ServiceTypes.UserObjectNode)resultObject.Value;
                UserObject uo2 = ServiceFacade.TypeConversionHelper.Convert <ServiceTypes.UserObjectNode, UserObject>(uoNode);
                return(uo2);
            }

            else
            {
                return(UAL.AnnotationDao.DeepClone(uo));
            }
        }
示例#2
0
        /// <summary>
        /// Copy a list to another list
        /// </summary>
        /// <param name="sourceList"></param>
        /// <param name="destList"></param>
        /// <returns></returns>

        public static int CopyList(
            UserObject sourceList,
            UserObject destList)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                ServiceTypes.UserObjectNode destListNode =
                    ServiceFacade.TypeConversionHelper.Convert <UserObject, ServiceTypes.UserObjectNode>(destList);
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusCidListService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusCidListService.CopyList,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { sourceList.InternalName, destListNode }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();

                //update the destList uo in place
                destListNode = (ServiceTypes.UserObjectNode)resultObject.Value;
                UserObject updatedDestList =
                    ServiceFacade.TypeConversionHelper.Convert <ServiceTypes.UserObjectNode, UserObject>(destListNode);
                destList.Id               = updatedDestList.Id;
                destList.Name             = updatedDestList.Name;
                destList.Type             = updatedDestList.Type;
                destList.Owner            = updatedDestList.Owner;
                destList.AccessLevel      = updatedDestList.AccessLevel;
                destList.ParentFolder     = updatedDestList.ParentFolder;
                destList.ParentFolderType = updatedDestList.ParentFolderType;
                destList.Description      = updatedDestList.Description;
                destList.CreationDateTime = updatedDestList.CreationDateTime;
                destList.UpdateDateTime   = updatedDestList.UpdateDateTime;
                destList.Content          = updatedDestList.Content;
                destList.Count            = updatedDestList.Count;

                return(destList.Count);
            }
            else
            {
                return(UAL.CidListDao.CopyList(sourceList, destList));
            }
        }