Пример #1
0
        /// <summary>
        /// This method executes a query and displays the results.
        /// </summary>
        void ExecuteQuery()
        {
            var queryClauses = BuildQuery();

            if (queryClauses.Count > 0)
            {
                try
                {
                    var sortColumns = new List <KeyValuePair <string, string> >();

                    var sorter = ctlDisplayIssues.SortString;

                    if (sorter.Trim().Length.Equals(0))
                    {
                        sorter = "iv.[IssueId] DESC";
                    }

                    foreach (var sort in sorter.Split(','))
                    {
                        var args = sort.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                        if (args.Length.Equals(2))
                        {
                            sortColumns.Add(new KeyValuePair <string, string>(args[0], args[1]));
                        }
                    }

                    // add the disabled query filter since the UI cannot add this
                    queryClauses.Insert(0, new QueryClause("AND", "iv.[Disabled]", "=", "0", SqlDbType.Int));

                    var colIssues = IssueManager.PerformQuery(queryClauses, sortColumns, ProjectId);
                    ctlDisplayIssues.DataSource = colIssues;
                    Results.Visible             = true;
                    ctlDisplayIssues.DataBind();
                }
                catch
                {
                    Message1.ShowErrorMessage(GetLocalResourceObject("RunQueryError").ToString());
                }
            }
            else
            {
                Message1.ShowWarningMessage(GetLocalResourceObject("SelectOneQueryClause").ToString());
            }
        }