private static void SetOption(CheckBox cb, ref DeleteOptions currentOption, DeleteOptions option)
 {
     if (cb.IsChecked != null && cb.IsChecked.Value)
     {
         currentOption |= option;
     }
 }
        private static void SetPolicies(ComboBox item, string keepValue, ref DeleteOptions options, ref int keep)
        {
            bool result = int.TryParse(keepValue, out keep);
            if (!result)
            {
                // 2147483647 == keep all
                keep = 2147483647;
            }

            string tag = ((ComboBoxItem)item.SelectedItem).Tag.ToString();
            options = SetDeleteOptions(tag);
        }
        public Task<IReadOnlyCollection<IProjectSourceItem>> RemoveOwnedSourceItemsAsync(
            IReadOnlyCollection<IProjectSourceItem> projectItems, DeleteOptions deleteOptions) {
            var projectDirectory = _unconfiguredProject.GetProjectDirectory();
            List<IProjectSourceItem> itemsInProjectFolder = projectItems
                .Where(item => !PathHelper.IsOutsideProjectDirectory(projectDirectory, item.EvaluatedIncludeAsFullPath))
                .ToList();

            return
                Task.FromResult(itemsInProjectFolder.Count == 0
                    ? projectItems
                    : projectItems.Except(itemsInProjectFolder).ToImmutableArray());
        }
        private void OnDelete(object sender, RoutedEventArgs e)
        {
            DeleteOptions options = new DeleteOptions();
            SetOption(this.cbDetails, ref options, DeleteOptions.Details);
            SetOption(this.cbDrop, ref options, DeleteOptions.DropLocation);
            SetOption(this.cbTestResults, ref options, DeleteOptions.TestResults);
            SetOption(this.cbLabel, ref options, DeleteOptions.Label);
            SetOption(this.cbSymbols, ref options, DeleteOptions.Symbols);

            this.Option = options;
            this.DialogResult = true;
            this.Close();
        }
        public static void Run()
        {
            // ExStart:UpdateReferenceInWorksheets
            // Create workbook
            Workbook wb = new Workbook();

            // Add second sheet with name Sheet2
            wb.Worksheets.Add("Sheet2");

            // Access first sheet and add some integer value in cell C1
            // Also add some value in any cell to increase the number of blank rows and columns
            Worksheet sht1 = wb.Worksheets[0];
            sht1.Cells["C1"].PutValue(4);
            sht1.Cells["K30"].PutValue(4);

            // Access second sheet and add formula in cell E3 which refers to cell C1 in first sheet
            Worksheet sht2 = wb.Worksheets[1];
            sht2.Cells["E3"].Formula = "'Sheet1'!C1";

            // Calculate formulas of workbook
            wb.CalculateFormula();

            // Print the formula and value of cell E3 in second sheet before deleting blank columns and rows in Sheet1.
            Console.WriteLine("Cell E3 before deleting blank columns and rows in Sheet1.");
            Console.WriteLine("--------------------------------------------------------");
            Console.WriteLine("Cell Formula: " + sht2.Cells["E3"].Formula);
            Console.WriteLine("Cell Value: " + sht2.Cells["E3"].StringValue);

            // If you comment DeleteOptions.UpdateReference property below, then the formula in cell E3 in second sheet will not be updated
            DeleteOptions opts = new DeleteOptions();
            opts.UpdateReference = true;

            // Delete all blank rows and columns with delete options
            sht1.Cells.DeleteBlankColumns(opts);
            sht1.Cells.DeleteBlankRows(opts);

            // Calculate formulas of workbook
            wb.CalculateFormula();

            // Print the formula and value of cell E3 in second sheet after deleting blank columns and rows in Sheet1.
            Console.WriteLine("");
            Console.WriteLine("");
            Console.WriteLine("Cell E3 after deleting blank columns and rows in Sheet1.");
            Console.WriteLine("--------------------------------------------------------");
            Console.WriteLine("Cell Formula: " + sht2.Cells["E3"].Formula);
            Console.WriteLine("Cell Value: " + sht2.Cells["E3"].StringValue);
            // ExEnd:UpdateReferenceInWorksheets
        }
	public void Delete(DeleteOptions options) {}
Exemple #7
0
        /// <summary>
        ///     Remove all contents, subdirectories and files, from a directory.
        /// </summary>
        public static void ClearDirectory(this IAbsFileSystem fileSystem, AbsolutePath path, DeleteOptions deleteOptions)
        {
            Contract.Requires(fileSystem != null);
            Contract.Requires(path != null);

            if (fileSystem.FileExists(path))
            {
                throw new IOException("not a directory");
            }

            var subDirectories = fileSystem.EnumerateDirectories(path, EnumerateOptions.None);

            if ((deleteOptions & DeleteOptions.Recurse) != 0)
            {
                foreach (AbsolutePath directoryPath in subDirectories)
                {
                    fileSystem.DeleteDirectory(directoryPath, deleteOptions);
                }
            }
            else if (subDirectories.Any())
            {
                throw new IOException("subdirectories not deleted without recurse option");
            }

            foreach (FileInfo fileInfo in fileSystem.EnumerateFiles(path, EnumerateOptions.None))
            {
                fileSystem.DeleteFile(fileInfo.FullPath);
            }
        }
Exemple #8
0
        /// <summary>
        /// Deletes items from the project, and optionally from disk.
        /// Note: Delete and Remove commands are handled via IVsHierarchyDeleteHandler3, not by
        /// IAsyncCommandGroupHandler and first asks us we CanRemove nodes. If yes then RemoveAsync is called.
        /// We can remove only nodes that are standard and based on project items, i.e. nodes that
        /// are created by default IProjectDependenciesSubTreeProvider implementations and have
        /// DependencyNode.GenericDependencyFlags flags and IRule with Context != null, in order to obtain
        /// node's itemSpec. ItemSpec then used to remove a project item having same Include.
        /// </summary>
        /// <param name="nodes">The nodes that should be deleted.</param>
        /// <param name="deleteOptions">A value indicating whether the items should be deleted from disk as well as
        /// from the project file.
        /// </param>
        /// <exception cref="InvalidOperationException">Thrown when <see cref="IProjectTreeProvider.CanRemove"/>
        /// would return <c>false</c> for this operation.</exception>
        public override async Task RemoveAsync(IImmutableSet <IProjectTree> nodes,
                                               DeleteOptions deleteOptions = DeleteOptions.None)
        {
            if (deleteOptions.HasFlag(DeleteOptions.DeleteFromStorage))
            {
                throw new NotSupportedException();
            }

            // Get the list of shared import nodes.
            IEnumerable <IProjectTree> sharedImportNodes = nodes.Where(node =>
                                                                       node.Flags.Contains(DependencyTreeFlags.SharedProjectFlags));

            // Get the list of normal reference Item Nodes (this excludes any shared import nodes).
            IEnumerable <IProjectTree> referenceItemNodes = nodes.Except(sharedImportNodes);

            await ProjectLockService.WriteLockAsync(async access =>
            {
                Project project = await access.GetProjectAsync(ActiveConfiguredProject);

                // Handle the removal of normal reference Item Nodes (this excludes any shared import nodes).
                foreach (IProjectTree node in referenceItemNodes)
                {
                    if (node.BrowseObjectProperties?.Context == null)
                    {
                        // if node does not have an IRule with valid ProjectPropertiesContext we can not
                        // get its itemsSpec. If nodes provided by custom IProjectDependenciesSubTreeProvider
                        // implementation, and have some custom IRule without context, it is not a problem,
                        // since they would not have DependencyNode.GenericDependencyFlags and we would not
                        // end up here, since CanRemove would return false and Remove command would not show
                        // up for those nodes.
                        continue;
                    }

                    IProjectPropertiesContext nodeItemContext = node.BrowseObjectProperties.Context;
                    ProjectItem unresolvedReferenceItem       = project.GetItemsByEvaluatedInclude(nodeItemContext.ItemName)
                                                                .FirstOrDefault(
                        (item, t) => string.Equals(item.ItemType, t, StringComparisons.ItemTypes),
                        nodeItemContext.ItemType);

                    Report.IfNot(unresolvedReferenceItem != null, "Cannot find reference to remove.");
                    if (unresolvedReferenceItem != null)
                    {
                        await access.CheckoutAsync(unresolvedReferenceItem.Xml.ContainingProject.FullPath);
                        project.RemoveItem(unresolvedReferenceItem);
                    }
                }

                IDependenciesSnapshot snapshot = _dependenciesSnapshotProvider.CurrentSnapshot;
                Requires.NotNull(snapshot, nameof(snapshot));
                if (snapshot == null)
                {
                    return;
                }

                // Handle the removal of shared import nodes.
                ProjectRootElement projectXml = await access.GetProjectXmlAsync(UnconfiguredProject.FullPath);
                foreach (IProjectTree sharedImportNode in sharedImportNodes)
                {
                    string sharedFilePath = UnconfiguredProject.GetRelativePath(sharedImportNode.FilePath);
                    if (string.IsNullOrEmpty(sharedFilePath))
                    {
                        continue;
                    }

                    IDependency sharedProjectDependency = snapshot.FindDependency(sharedFilePath, topLevel: true);
                    if (sharedProjectDependency != null)
                    {
                        sharedFilePath = sharedProjectDependency.Path;
                    }

                    // Find the import that is included in the evaluation of the specified ConfiguredProject that
                    // imports the project file whose full path matches the specified one.
                    IEnumerable <ResolvedImport> matchingImports = from import in project.Imports
                                                                   where import.ImportingElement.ContainingProject == projectXml &&
                                                                   PathHelper.IsSamePath(import.ImportedProject.FullPath, sharedFilePath)
                                                                   select import;
                    foreach (ResolvedImport importToRemove in matchingImports)
                    {
                        ProjectImportElement importingElementToRemove = importToRemove.ImportingElement;
                        Report.IfNot(importingElementToRemove != null,
                                     "Cannot find shared project reference to remove.");
                        if (importingElementToRemove != null)
                        {
                            await access.CheckoutAsync(importingElementToRemove.ContainingProject.FullPath);
                            importingElementToRemove.Parent.RemoveChild(importingElementToRemove);
                        }
                    }
                }
            });
        }
 public async Task DeleteAsync(DeleteOptions deleteOptions) =>
 await Delete(deleteOptions).CastTask();
Exemple #10
0
        /// <summary>
        /// Deletes an object model from the table indicated by the class's Table attribute.
        /// </summary>
        /// <typeparam name="TArgument"></typeparam>
        /// <param name="argumentValue">The argument value.</param>
        /// <param name="options">The delete options.</param>
        /// <returns></returns>
        public ObjectDbCommandBuilder <OleDbCommand, OleDbParameter, TArgument> Delete <TArgument>(TArgument argumentValue, DeleteOptions options = DeleteOptions.None) where TArgument : class
        {
            var table = DatabaseMetadata.GetTableOrViewFromClass <TArgument>();

            if (!AuditRules.UseSoftDelete(table))
            {
                return(new OleDbSqlServerDeleteObject <TArgument>(this, table.Name, argumentValue, options));
            }

            UpdateOptions effectiveOptions = UpdateOptions.SoftDelete;

            if (options.HasFlag(DeleteOptions.UseKeyAttribute))
            {
                effectiveOptions = effectiveOptions | UpdateOptions.UseKeyAttribute;
            }

            return(new OleDbSqlServerUpdateObject <TArgument>(this, table.Name, argumentValue, effectiveOptions));
        }
Exemple #11
0
 /// <summary>
 /// Delete a record by its primary key.
 /// </summary>
 /// <param name="tableName">Name of the table.</param>
 /// <param name="key">The key.</param>
 /// <param name="options">The options.</param>
 /// <returns>MultipleRowDbCommandBuilder&lt;OleDbCommand, OleDbParameter&gt;.</returns>
 public SingleRowDbCommandBuilder <OleDbCommand, OleDbParameter> DeleteByKey(SqlServerObjectName tableName, string key, DeleteOptions options = DeleteOptions.None)
 {
     return(DeleteByKeyList(tableName, new List <string> {
         key
     }, options));
 }
Exemple #12
0
 /// <remarks/>
 public void DeleteAsync(DeleteOptions Options, APIObject[] Objects, object userState) {
     if ((this.DeleteOperationCompleted == null)) {
         this.DeleteOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteOperationCompleted);
     }
     this.InvokeAsync("Delete", new object[] {
                 Options,
                 Objects}, this.DeleteOperationCompleted, userState);
 }
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // 1. Create/checkin new document

                // Initialize Sord object
                EditInfo ed = ix.Ix.createDoc("1", "0", null, EditInfoC.mbSordDocAtt);
                ed.sord.name = "C# example CheckinNewDocument";

                // Create test file
                String testFile = internalCreateTestFile("CheckinNewDocument example file", "txt");

                // Supply the extension of the document
                ed.document.docs                  = new DocVersion[1];
                ed.document.docs[0]               = new DocVersion();
                ed.document.docs[0].ext           = ix.GetFileExt(testFile);
                ed.document.docs[0].pathId        = ed.sord.path;
                ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;

                // CheckinDocBegin: let IndexServer generate an URL to upload the document
                ed.document = ix.Ix.checkinDocBegin(ed.document);
                Logger.instance().log("prepared upload URL=" + ed.document.docs[0].url + ", doc-guid=" + ed.document.docs[0].guid);

                // Upload the document
                String uploadResult = ix.Upload(ed.document.docs[0].url, testFile);
                ed.document.docs[0].uploadResult = uploadResult;
                Logger.instance().log("upload succeeded");

                // CheckinDocEnd: uploadResult contains the document information from ELODM.
                // Pass this information to
                ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);
                Logger.instance().log("inserted document:");
                Logger.instance().log("  objId=" + ed.document.objId);
                Logger.instance().log("  docId=" + ed.document.docs[0].id);
                Logger.instance().log("  doc-guid=" + ed.document.docs[0].guid);
                Logger.instance().log("  URL=" + ed.document.docs[0].url);

                // 2. Checkout and show document
                ed = ix.Ix.checkoutDoc(ed.sord.guid, null, EditInfoC.mbAll, LockC.NO);
                String tempName2 = internalMakeTempFileName(ed.document.docs[0].ext);
                ix.Download(ed.document.docs[0].url, tempName2);

                // Uncomment this to show document in notepad:
                //System.Diagnostics.Process.Start("notepad.exe", tempName2);
                //System.Threading.Thread.Sleep(10 * 1000);

                System.IO.File.Delete(tempName2);

                bool cleanUp = true;
                if (cleanUp)
                {
                    // Delete Document
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ix.Ix.deleteSord(null, ed.sord.guid, LockC.NO, null);
                    ix.Ix.deleteSord(null, ed.sord.guid, LockC.NO, delOpts);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    //ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemple #14
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // create Sord s1
                Sord s1 = ix.Ix.createSord("1", null, EditInfoC.mbSord).sord;
                s1.name = "s1 C# Example LinkSord";
                s1.id   = ix.Ix.checkinSord(s1, SordC.mbAll, LockC.NO);
                Logger.instance().log("s1.id=" + s1.id);

                // create Sord o1
                Sord o1 = ix.Ix.createSord(s1.guid, null, EditInfoC.mbSord).sord;
                o1.name = "o1";
                o1.id   = ix.Ix.checkinSord(o1, SordC.mbAll, LockC.NO);
                Logger.instance().log("o1.id=" + o1.id);

                // create Sord o2
                Sord o2 = ix.Ix.createSord(s1.guid, null, EditInfoC.mbSord).sord;
                o2.name = "o2";
                o2.id   = ix.Ix.checkinSord(o2, SordC.mbAll, LockC.NO);
                Logger.instance().log("o2.id=" + o2.id);

                // create Sord o3
                Sord o3 = ix.Ix.createSord(s1.guid, null, EditInfoC.mbSord).sord;
                o3.name = "o3";
                o3.id   = ix.Ix.checkinSord(o3, SordC.mbAll, LockC.NO);
                Logger.instance().log("o3.id=" + o3.id);

                // Link o1 to o2 and o3
                Logger.instance().log("link Sords...");
                ix.Ix.linkSords(o1.guid, new String[] { o2.guid, o3.guid }, CONST.LINK_SORD.NOTHING);
                Logger.instance().log("link Sords OK");

                // Dump links
                internalDumpLinks(ix, CONST, o1.guid);
                internalDumpLinks(ix, CONST, o2.guid);
                internalDumpLinks(ix, CONST, o3.guid);

                // Delete link o1 -> o2
                Logger.instance().log("unlink Sords...");
                ix.Ix.unlinkSords(o1.guid, new String[] { o2.guid }, CONST.LINK_SORD.NOTHING);
                Logger.instance().log("unlink Sords OK");

                // Dump links
                internalDumpLinks(ix, CONST, o1.guid);
                internalDumpLinks(ix, CONST, o2.guid);
                internalDumpLinks(ix, CONST, o3.guid);

                // Delete Sords
                Logger.instance().log("delete Sords...");
                DeleteOptions delOpts = new DeleteOptions();
                delOpts.deleteFinally = true;
                ix.Ix.deleteSord(null, s1.guid, LockC.NO, null);
                ix.Ix.deleteSord(null, s1.guid, LockC.NO, delOpts);
                Logger.instance().log("delete Sords OK");
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
 public void Delete(ManagementOperationObserver watcher, DeleteOptions options)
 {
 }
 public void Delete(DeleteOptions options)
 {
 }
 IObjectDbCommandBuilder <TArgument> IClass1DataSource.Delete <TArgument>(TArgument argumentValue, DeleteOptions options)
 {
     return(Delete(argumentValue, options));
 }
 IObjectDbCommandBuilder <TArgument> IClass1DataSource.Delete <TArgument>(string tableName, TArgument argumentValue, DeleteOptions options)
 {
     return(Delete(tableName, argumentValue, options));
 }
 IMultipleRowDbCommandBuilder IClass1DataSource.DeleteByKeyList <TKey>(string tableName, IEnumerable <TKey> keys, DeleteOptions options)
 {
     return(DeleteByKeyList(tableName, keys, options));
 }
 public IBuildDeletionResult Delete(DeleteOptions options)
 {
     throw new NotImplementedException();
 }
 ISingleRowDbCommandBuilder IClass1DataSource.DeleteByKey(string tableName, string key, DeleteOptions options)
 {
     return(DeleteByKey(tableName, key, options));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PostgreSqlDeleteObject{TArgument}"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="table">The table.</param>
 /// <param name="argumentValue">The argument value.</param>
 /// <param name="options">The options.</param>
 public PostgreSqlDeleteObject(PostgreSqlDataSourceBase dataSource, PostgreSqlObjectName table, TArgument argumentValue, DeleteOptions options)
     : base(dataSource, table, argumentValue)
 {
     m_Options = options;
 }
Exemple #23
0
 public void DeleteDirectory(AbsolutePath path, DeleteOptions deleteOptions)
 {
     throw new NotImplementedException();
 }
Exemple #24
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // 1. Create a Sord with index attribute
                Sord sord = ix.Ix.createSord("1", "0", EditInfoC.mbSord).sord;
                sord.name            = "C# example CheckoutByIndex";
                sord.objKeys         = new ObjKey[1];
                sord.objKeys[0]      = new ObjKey();
                sord.objKeys[0].name = "VENDOR";
                sord.objKeys[0].data = new String[] { "ELO Digital Office GmbH" };
                sord.id = ix.Ix.checkinSord(sord, SordC.mbAll, LockC.NO);
                Logger.instance().log("created sord: id=" + sord.id);

                // 2. Checkout Sord by index attribute
                sord = ix.Ix.checkoutSord("OKEY:VENDOR=ELO digital OFFICE gmbh",
                                          EditInfoC.mbSord, LockC.NO).sord;
                Logger.instance().log("checkout sord, id=" + sord.id);

                bool cleanUp = true;
                if (cleanUp)
                {
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ix.Ix.deleteSord(null, sord.guid, LockC.NO, null);
                    ix.Ix.deleteSord(null, sord.guid, LockC.NO, delOpts);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemple #25
0
        public MultipleRowDbCommandBuilder <OleDbCommand, OleDbParameter> DeleteByKeyList <TKey>(SqlServerObjectName tableName, IEnumerable <TKey> keys, DeleteOptions options = DeleteOptions.None)
        {
            var primaryKeys = DatabaseMetadata.GetTableOrView(tableName).Columns.Where(c => c.IsPrimaryKey).ToList();

            if (primaryKeys.Count != 1)
            {
                throw new MappingException($"DeleteByKey operation isn't allowed on {tableName} because it doesn't have a single primary key.");
            }

            var keyList        = keys.AsList();
            var columnMetadata = primaryKeys.Single();

            string where;
            if (keys.Count() > 1)
            {
                where = columnMetadata.SqlName + " IN (" + string.Join(", ", keyList.Select((s, i) => "?")) + ")";
            }
            else
            {
                where = columnMetadata.SqlName + " = ?";
            }

            var parameters = new List <OleDbParameter>();

            for (var i = 0; i < keyList.Count; i++)
            {
                var param = new OleDbParameter("@Param" + i, keyList[i]);
                if (columnMetadata.DbType.HasValue)
                {
                    param.OleDbType = columnMetadata.DbType.Value;
                }
                parameters.Add(param);
            }

            var table = DatabaseMetadata.GetTableOrView(tableName);

            if (!AuditRules.UseSoftDelete(table))
            {
                return(new OleDbSqlServerDeleteMany(this, tableName, where, parameters));
            }

            UpdateOptions effectiveOptions = UpdateOptions.SoftDelete | UpdateOptions.IgnoreRowsAffected;

            if (options.HasFlag(DeleteOptions.UseKeyAttribute))
            {
                effectiveOptions = effectiveOptions | UpdateOptions.UseKeyAttribute;
            }

            return(new OleDbSqlServerUpdateMany(this, tableName, null, where, parameters, parameters.Count, effectiveOptions));
        }
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // 1. Create a root folder
                Sord sordRoot = ix.Ix.createSord("1", null, EditInfoC.mbSord).sord;
                sordRoot.name = "C# example FindFirstFindNext";
                sordRoot.id   = ix.Ix.checkinSord(sordRoot, SordC.mbAll, LockC.NO);

                // 2. Create 30 sords under the root folder with a name that contains the search term
                Logger.instance().log("create " + nbOfSords + " sords...");
                for (int i = 0; i < nbOfSords; i++)
                {
                    String namePrefix = "" + i;
                    while (namePrefix.Length < 4)
                    {
                        namePrefix = "0" + namePrefix;
                    }
                    Sord sord = ix.Ix.createSord(sordRoot.guid, null, EditInfoC.mbSord).sord;
                    sord.name = namePrefix + "-" + searchTerm + "-" + namePrefix;
                    sord.id   = ix.Ix.checkinSord(sord, SordC.mbAll, LockC.NO);
                }
                Logger.instance().log("create sords OK");

                // 3. Execute find
                Logger.instance().log("find...");

                // Prepare FindInfo object
                FindInfo findInfo = new FindInfo();
                findInfo.findByIndex      = new FindByIndex();
                findInfo.findByIndex.name = "*" + searchTerm + "*";

                // find
                int maxSordsPerLoop = 9;
                int idx             = 0;

                SordZ sordZ = new SordZ();

                FindResult findResult = ix.Ix.findFirstSords(findInfo, maxSordsPerLoop, SordC.mbAll);

                do
                {
                    // log find results
                    Logger.instance().log("found #=" + findResult.sords.Length);
                    for (int i = 0; i < findResult.sords.Length; i++)
                    {
                        Logger.instance().log("sord.id=" + findResult.sords[i].id + ", sord.name=" + findResult.sords[i].name);
                    }

                    // more results?
                    if (!findResult.moreResults)
                    {
                        break;
                    }

                    // next results
                    idx       += findResult.sords.Length;
                    findResult = ix.Ix.findNextSords(findResult.searchId, idx, maxSordsPerLoop, SordC.mbAll);
                } while (true);

                // release find result buffer in IndexServer
                ix.Ix.findClose(findResult.searchId);
                Logger.instance().log("find OK");

                // clean up
                bool cleanUp = true;
                if (cleanUp)
                {
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ix.Ix.deleteSord(null, sordRoot.guid, LockC.NO, null);
                    ix.Ix.deleteSord(null, sordRoot.guid, LockC.NO, delOpts);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemple #27
0
 /// <summary>
 /// Delete a record by its primary key.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="tableName">Name of the table.</param>
 /// <param name="key">The key.</param>
 /// <param name="options">The options.</param>
 /// <returns>MultipleRowDbCommandBuilder&lt;OleDbCommand, OleDbParameter&gt;.</returns>
 public SingleRowDbCommandBuilder <OleDbCommand, OleDbParameter> DeleteByKey <T>(SqlServerObjectName tableName, T key, DeleteOptions options = DeleteOptions.None)
     where T : struct
 {
     return(DeleteByKeyList(tableName, new List <T> {
         key
     }, options));
 }
Exemple #28
0
 public DeleteResult DeleteOne(FilterDefinition <TModel> filter, DeleteOptions options, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(_collection.DeleteOne(filter, options, cancellationToken));
 }
Exemple #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteDeleteObject{TArgument}"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="tableName">The table.</param>
 /// <param name="argumentValue">The argument value.</param>
 /// <param name="options">The options.</param>
 public SQLiteDeleteObject(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, TArgument argumentValue, DeleteOptions options)
     : base(dataSource, tableName, argumentValue)
 {
     m_Options = options;
 }
Exemple #30
0
 public Task <DeleteResult> DeleteManyAsync(FilterDefinition <TModel> filter, DeleteOptions options, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(_collection.DeleteManyAsync(filter, options, cancellationToken));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AccessDeleteObject{TArgument}"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="tableName">The table.</param>
 /// <param name="argumentValue">The argument value.</param>
 /// <param name="options">The options.</param>
 public AccessDeleteObject(AccessDataSourceBase dataSource, AccessObjectName tableName, TArgument argumentValue, DeleteOptions options)
     : base(dataSource, tableName, argumentValue)
 {
     m_Options = options;
 }
Exemple #32
0
 public Task <DeleteResult> DeleteManyAsync(IClientSessionHandle session, FilterDefinition <TModel> filter, DeleteOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(_collection.DeleteManyAsync(session, filter, options, cancellationToken));
 }
Exemple #33
0
 public bool CanRemove(IImmutableSet <IProjectTree> nodes, DeleteOptions deleteOptions = DeleteOptions.None)
 {
     throw new NotImplementedException();
 }
Exemple #34
0
 public override Task Delete(DeleteOptions options)
 {
     return(LiveTvManager.DeleteRecording(this));
 }
	public void Delete(ManagementOperationObserver watcher, DeleteOptions options) {}
        public void DeleteBuildDefinitions(IEnumerable<Uri> buildDefinitions, DeleteOptions deleteOptions)
        {
            Uri[] buildDefinitionUris = buildDefinitions.ToArray();
            var bds = this.buildServer.QueryBuildDefinitionsByUri(buildDefinitionUris);
            foreach (var bd in bds)
            {
                var builds = bd.QueryBuilds();
                this.buildServer.DeleteBuilds(builds, deleteOptions);
            }

            this.buildServer.DeleteBuildDefinitions(buildDefinitionUris);
        }
Exemple #37
0
 ObjectDbCommandBuilder <OleDbCommand, OleDbParameter, TArgument> OnDeleteObject <TArgument>(AccessObjectName tableName, TArgument argumentValue, DeleteOptions options) where TArgument : class
 {
     return(new AccessDeleteObject <TArgument>(this, tableName, argumentValue, options));
 }
 public IBuildDeletionResult Delete(DeleteOptions options)
 {
     throw new NotImplementedException();
 }
 private static void UpdateRetentionPolicy(IBuildDefinition bd, BuildReason reason, int keep, DeleteOptions options, BuildStatus status)
 {
     var rp = bd.RetentionPolicyList.FirstOrDefault(r => r.BuildReason == reason && r.BuildStatus == status);
     if (rp == null)
     {
         bd.AddRetentionPolicy(reason, BuildStatus.Stopped, keep, options);
     }
     else
     {
         rp.NumberToKeep = keep;
         rp.DeleteOptions = options;
     }
 }
Exemple #40
0
 public DeleteResult[] Delete(DeleteOptions Options, [System.Xml.Serialization.XmlElementAttribute("Objects")] APIObject[] Objects, out string RequestID, out string OverallStatus) {
     object[] results = this.Invoke("Delete", new object[] {
                 Options,
                 Objects});
     RequestID = ((string)(results[1]));
     OverallStatus = ((string)(results[2]));
     return ((DeleteResult[])(results[0]));
 }
Exemple #41
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                String fritzName = "Fritz";                 // [X]

                // 1. Create Sord
                Sord sord = ix.Ix.createSord("1", "0", EditInfoC.mbSord).sord;
                sord.name = "C# example SordACL";

                // 2. Create a new test user (if nessesary)
                UserInfo uiFritz = ix.Ix.createUser(null);
                uiFritz.name  = fritzName;
                uiFritz.pwd   = fritzName + " password";
                uiFritz.flags = AccessC.FLAG_EDITSTRUCTURE;                 // Fritz is allowed to edit structure elements in general
                int[] uids = ix.Ix.checkinUsers(new UserInfo[] { uiFritz }, CheckinUsersC.PASSWORD, LockC.NO);
                uiFritz.id = uids[0];
                Logger.instance().log("created account for " + uiFritz.name + ", uid=" + uids[0]);

                // 3. Assign read access to Sord for user "Fritz"
                AclItem aclItemFritz = new AclItem();
                aclItemFritz.name = uiFritz.name;
                // alternative: aclItem.id = uiFritz.id
                aclItemFritz.access = AccessC.LUR_READ;

                // assign all access for current user
                AclItem aclItemCu = new AclItem();
                aclItemCu.name   = userName;
                aclItemCu.access = AccessC.LUR_ALL;

                // checkin
                sord.aclItems = new AclItem[] { aclItemFritz, aclItemCu };
                sord.id       = ix.Ix.checkinSord(sord, SordC.mbAll, LockC.NO);
                Logger.instance().log("created sord with read access for Fritz: id=" + sord.id);

                // 4. Login as "Fritz" and try to read Sord
                IXConnection ixFritz = connFact.Create(uiFritz.name, uiFritz.pwd, "myComputer", null);
                Logger.instance().log(uiFritz.name + " logged in successfully");

                // read Sord
                Sord sordForFritz = ixFritz.Ix.checkoutSord(sord.guid, EditInfoC.mbSord, LockC.NO).sord;
                Logger.instance().log(uiFritz.name + " read sord successfully");

                // 5. Try to lock, write and delete as "Fritz" (exception expected)
                try
                {
                    // lock
                    sord = ixFritz.Ix.checkoutSord(sord.guid, EditInfoC.mbSord, LockC.YES).sord;
                    Logger.instance().log("ERROR: " + uiFritz.name + " must not be able to checkout sord");
                }
                catch (Exception e)
                {
                    Logger.instance().log("OK, " + uiFritz.name + " is not allowed to lock sord, exception=" + formatException(e));
                }
                try
                {
                    // write
                    sord      = ixFritz.Ix.checkoutSord(sord.guid, EditInfoC.mbSord, LockC.NO).sord;
                    sord.desc = "changed by Fritz";
                    ixFritz.Ix.checkinSord(sord, SordC.mbAll, LockC.NO);
                    Logger.instance().log("ERROR: " + uiFritz.name + " must not be able to write sord");
                }
                catch (Exception e)
                {
                    Logger.instance().log("OK, " + uiFritz.name + " is not allowed to write sord, exception=" + formatException(e));
                }
                try
                {
                    // delete
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ixFritz.Ix.deleteSord(null, sord.guid, LockC.NO, delOpts);
                    Logger.instance().log("ERROR: " + uiFritz.name + " must not be able to delete sord");
                }
                catch (Exception e)
                {
                    Logger.instance().log("OK, " + uiFritz.name + " is not allowed to delete sord, exception=" + formatException(e));
                }

                // logout Fritz
                ixFritz.Logout();
                ix.Ix.deleteUsers(new String[] { uiFritz.name }, LockC.NO);

                bool cleanUp = true;
                if (cleanUp)
                {
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ix.Ix.deleteSord(null, sord.guid, LockC.NO, delOpts);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Exemple #42
0
 /// <remarks/>
 public void DeleteAsync(DeleteOptions Options, APIObject[] Objects) {
     this.DeleteAsync(Options, Objects, null);
 }
 public IRetentionPolicy AddRetentionPolicy(BuildReason reason, BuildStatus status, int numberToKeep, DeleteOptions deleteOptions)
 {
     throw new NotImplementedException();
 }
Exemple #44
0
 public IRetentionPolicy AddRetentionPolicy(BuildReason reason, BuildStatus status, int numberToKeep, DeleteOptions deleteOptions)
 {
     throw new NotImplementedException();
 }