/*private void CreateNewVersion(string dst, int docNumber, string userID) { * var docObject = new PCDDocObjectClass(); * docObject.SetDST(dst); * docObject.SetObjectType("ENG_DRAW_P");//set profile form name * docObject.SetProperty("%TARGET_LIBRARY", dApp.CurrentLibrary.Name);//database * docObject.SetProperty("%OBJECT_IDENTIFIER", docNumber); * docObject.SetProperty("%VERSION_DIRECTIVE", "%PCD_NEW_VERSION"); * docObject.SetProperty("%VERSION_TYPIST", userID); * int result = docObject.Update(); * * if(result != S_OK || docObject.ErrNumber != 0) * throw new DMApiException(string.Format("PCDDocObjectClass.Update failed with error {0}: {1}", docObject.ErrNumber, docObject.ErrDescription)); * //versionID = docObject.GetReturnProperty("%VERSION_ID").ToString(); * }*/ public PCDPutStream GetPcdPutStream(DocumentInfo doc) { // TODO Check if checked-out / locked var pcdPutDoc = new PCDPutDocClass(); pcdPutDoc.SetDST(DocumentSecurityToken);//log into DM - set security token pcdPutDoc.AddSearchCriteria(PropertyTargetLibrary, LibraryName); pcdPutDoc.AddSearchCriteria("%DOCUMENT_NUMBER", doc.DocNumber); pcdPutDoc.AddSearchCriteria(PropertyVersionID, doc.VersionID); int result = pcdPutDoc.Execute(); if (result != S_OK || pcdPutDoc.ErrNumber != 0) { throw new DMApiException("PCDPutDocClass.Execute has failed.", pcdPutDoc.ErrNumber, pcdPutDoc.ErrDescription); } // TODO check result count pcdPutDoc.NextRow(); return((PCDPutStream)pcdPutDoc.GetPropertyValue("%CONTENT")); }
/*private void CreateNewVersion(string dst, int docNumber, string userID) { var docObject = new PCDDocObjectClass(); docObject.SetDST(dst); docObject.SetObjectType("ENG_DRAW_P");//set profile form name docObject.SetProperty("%TARGET_LIBRARY", dApp.CurrentLibrary.Name);//database docObject.SetProperty("%OBJECT_IDENTIFIER", docNumber); docObject.SetProperty("%VERSION_DIRECTIVE", "%PCD_NEW_VERSION"); docObject.SetProperty("%VERSION_TYPIST", userID); int result = docObject.Update(); if(result != S_OK || docObject.ErrNumber != 0) throw new DMApiException(string.Format("PCDDocObjectClass.Update failed with error {0}: {1}", docObject.ErrNumber, docObject.ErrDescription)); //versionID = docObject.GetReturnProperty("%VERSION_ID").ToString(); }*/ public PCDPutStream GetPcdPutStream(DocumentInfo doc) { // TODO Check if checked-out / locked var pcdPutDoc = new PCDPutDocClass(); pcdPutDoc.SetDST(Dst);//log into DM - set security token pcdPutDoc.AddSearchCriteria(PropertyTargetLibrary, Library); pcdPutDoc.AddSearchCriteria("%DOCUMENT_NUMBER", doc.DocNumber); pcdPutDoc.AddSearchCriteria(PropertyVersionID, doc.VersionID); int result = pcdPutDoc.Execute(); if(result != S_OK || pcdPutDoc.ErrNumber != 0) throw new DMApiException("PCDPutDocClass.Execute has failed.", pcdPutDoc.ErrNumber, pcdPutDoc.ErrDescription); // TODO check result count pcdPutDoc.NextRow(); return (PCDPutStream)pcdPutDoc.GetPropertyValue("%CONTENT"); }