/// <summary>
        /// Changes the preferences to filter by the specified current status.
        /// </summary>
        /// <param name="statusValue">The status value to filter by.</param>
        public void ChangeCurrentStatusFilter(string statusValue)
        {
            if (!string.IsNullOrEmpty(statusValue))
            {
                var fColumn = FilterColumns.SingleOrDefault(fc => fc.ColumnName == "CurrentStatus");

                if (statusValue == "any")
                {
                    if (fColumn != null)
                    {
                        FilterColumns.Remove(fColumn);
                    }
                }
                else
                {
                    bool equality = (statusValue != "open");
                    if (fColumn == null)
                    {
                        fColumn = new TicketListFilterColumn("CurrentStatus");
                        FilterColumns.Add(fColumn);
                    }

                    fColumn.UseEqualityComparison = equality;
                    fColumn.ColumnValue           = (statusValue == "open") ? "closed" : statusValue;
                }
            }
        }
        /// <summary>
        /// Changes the preferences to filter by the specified owner.
        /// </summary>
        /// <param name="ownerValue">The owner name to filter by.</param>
        public void ChangeOwnerFilter(string ownerValue)
        {
            if (!string.IsNullOrEmpty(ownerValue))
            {
                var fColumn = FilterColumns.SingleOrDefault(fc => fc.ColumnName == "Owner");

                if (ownerValue == "anyone")
                {
                    if (fColumn != null)
                    {
                        FilterColumns.Remove(fColumn);
                    }
                }
                else
                {
                    if (fColumn == null)
                    {
                        fColumn = new TicketListFilterColumn("Owner");
                        FilterColumns.Add(fColumn);
                    }

                    fColumn.UseEqualityComparison = true;
                    fColumn.ColumnValue           = ownerValue;
                }
            }
        }
        /// <summary>
        /// Changes the preferences to filter by the specified assigned user.
        /// </summary>
        /// <param name="assigned">The assigned user to filter by.</param>
        public void ChangeAssignedFilter(string assigned)
        {
            if (!string.IsNullOrEmpty(assigned))
            {
                var fColumn = FilterColumns.SingleOrDefault(fc => fc.ColumnName == "AssignedTo");

                if (assigned == "anyone")
                {
                    if (fColumn != null)
                    {
                        FilterColumns.Remove(fColumn);
                    }
                }
                else
                {
                    if (fColumn == null)
                    {
                        fColumn = new TicketListFilterColumn("AssignedTo");
                        FilterColumns.Add(fColumn);
                    }

                    if (assigned == "unassigned")
                    {
                        fColumn.UseEqualityComparison = null;
                        fColumn.ColumnValue           = null;
                    }
                    else
                    {
                        fColumn.UseEqualityComparison = true;
                        fColumn.ColumnValue           = assigned;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        internal void FromAutoFilter(AutoFilter af)
        {
            SetAllNull();

            var iStartRowIndex    = 1;
            var iStartColumnIndex = 1;
            var iEndRowIndex      = 1;
            var iEndColumnIndex   = 1;
            var sRef = af.Reference.Value;

            if (sRef.IndexOf(":") > 0)
            {
                if (SLTool.FormatCellReferenceRangeToRowColumnIndex(sRef, out iStartRowIndex, out iStartColumnIndex,
                                                                    out iEndRowIndex, out iEndColumnIndex))
                {
                    StartRowIndex    = iStartRowIndex;
                    StartColumnIndex = iStartColumnIndex;
                    EndRowIndex      = iEndRowIndex;
                    EndColumnIndex   = iEndColumnIndex;
                }
            }
            else
            {
                if (SLTool.FormatCellReferenceToRowColumnIndex(sRef, out iStartRowIndex, out iStartColumnIndex))
                {
                    StartRowIndex    = iStartRowIndex;
                    StartColumnIndex = iStartColumnIndex;
                    EndRowIndex      = iStartRowIndex;
                    EndColumnIndex   = iStartColumnIndex;
                }
            }

            if (af.HasChildren)
            {
                SLFilterColumn fc;
                using (var oxr = OpenXmlReader.Create(af))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(FilterColumn))
                        {
                            fc = new SLFilterColumn();
                            fc.FromFilterColumn((FilterColumn)oxr.LoadCurrentElement());
                            FilterColumns.Add(fc);
                        }
                        else if (oxr.ElementType == typeof(SortState))
                        {
                            SortState = new SLSortState();
                            SortState.FromSortState((SortState)oxr.LoadCurrentElement());
                            HasSortState = true;
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void CreateFileterColumnsList()
        {
            Application.Current.Dispatcher.Invoke(() =>
            {
                FilterColumns.Clear();
                FilterColumns.Add(new SelectableObject <string>("<all>"));

                foreach (var remoteParameter in Config.UserQuerySet)
                {
                    if (RemoteParametersTypes[remoteParameter] == typeof(string))
                    {
                        FilterColumns.Add(new SelectableObject <string>(remoteParameter));
                    }
                }
            });
        }