Exemple #1
0
        // Output information about each file in a folder along with its properties
        //===========================================================================
        static void PrintChildren(Vault.Currency.Connections.Connection connection,
                                  Vault.Currency.Entities.Folder parentFolder)
        {
            //MessageBox.Show(parentFolder.FullName);

            IEnumerable <Vault.Currency.Entities.IEntity> entities = connection
                                                                     .EntityOperations.GetBrowseChildren(parentFolder);

            if (entities != null && entities.Count <Vault.Currency.Entities.IEntity>() > 0)
            {
                foreach (var ent in entities)
                {
                    if (ent is Vault.Currency.Entities.FileIteration)
                    {
                        Vault.Currency.Entities.FileIteration fileIteration
                            = ent as Vault.Currency.Entities.FileIteration;

                        //Now print the properties of the file
                        //PrintProperties(connection, fileIteration);

                        collectionLVI.Add(fileIteration);
                    }
                    else if (ent is Vault.Currency.Entities.Folder)
                    {
                        // Recursively print info about subfolders and files in them
                        //-------------------------------------------------------------------------

                        Vault.Currency.Entities.Folder folder
                            = ent as Vault.Currency.Entities.Folder;
                        PrintChildren(connection, folder);
                    }
                }
            }
        }
Exemple #2
0
        public static bool uploadFiletoVaultFolder(VDF.Vault.Currency.Connections.Connection connection, string destinationTempFolder, string folderID, string comment, string fileName, byte[] fileBytes)
        {
            try
            {
                VDF.Vault.Currency.Entities.Folder fld   = FolderHelper.getFolderusingID(connection, folderID);
                List <FileAssocParam> fileAssocParamList = new List <FileAssocParam>();
                FileAssocParam        fileAssocArray     = new FileAssocParam();
                FileAssocParam[]      paramArray         = fileAssocParamList.ToArray();
                BOM _bom = new BOM();
                //string destinationFile = System.IO.Path.GetTempPath() + fileName;
                System.IO.File.WriteAllBytes(destinationTempFolder, fileBytes);
                VDF.Currency.FilePathAbsolute FPA = new VDF.Currency.FilePathAbsolute(destinationTempFolder);
                FileIteration FI = connection.FileManager.AddFile(fld, comment, paramArray, _bom, FileClassification.None, false, FPA);

                //cehck if file exists
                if (FI.FolderId.ToString() == folderID)
                {
                    ZGHCC.writeLog("File uplaoded and it Exists: " + folderID + " | " + comment);
                    boolRes = true;
                }
                else
                {
                    boolRes = false;
                }
            }
            catch (SystemException ex)
            {
                ZGHCC.writeLog("uploadFiletoVaultFolder EX: " + ex.ToString());
                statusMess = null;
                Debug.Write("\nError: " + ex.ToString());
                statusMess = "Error: \n" + ex.ToString();
                boolRes    = false;
            }
            return(boolRes);
        }
Exemple #3
0
        private void m_addFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Vault.Currency.Entities.Folder parent = m_model.Parent as Vault.Currency.Entities.Folder;
            if (parent != null)
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Multiselect = true;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    string[] filePaths = openFileDialog.FileNames;
                    foreach (string filePath in filePaths)
                    {
                        AddFileCommand.Execute(filePath, parent, m_conn);
                    }
                    m_model.Reload();
                }
            }
        }
Exemple #4
0
        private void CreateFolder()
        {
            FolderNameForm form = new FolderNameForm();

            form.ShowDialog();
            if (form.DialogResult != DialogResult.OK)
            {
                return;
            }
            try
            {
                Vault.Currency.Entities.Folder         parent   = m_model.Parent as Vault.Currency.Entities.Folder;
                Vault.Currency.Entities.EntityCategory category = Vault.Currency.Entities.EntityCategory.EmptyCategory;
                m_conn.FolderManager.CreateFolder(parent, form.folderName, false, category);
                m_model.Reload();
            }
            catch (Exception)
            {
            }
        }