Example #1
0
        public static int CompareByCreatedOn(VersionListItem item1, VersionListItem item2)
        {
            var data1 = item1.DataContext.CreatedOn;
            var data2 = item2.DataContext.CreatedOn;

            return(data1.CompareTo(data2));
        }
Example #2
0
        public static int CompareByStatus(VersionListItem item1, VersionListItem item2)
        {
            var data1 = item1.DataContext.Status;
            var data2 = item2.DataContext.Status;

            return(data1.CompareTo(data2));
        }
Example #3
0
        public static int CompareByDueDate(VersionListItem item1, VersionListItem item2)
        {
            var data1 = item1.DataContext.DueDate;
            var data2 = item2.DataContext.DueDate;

            if (data1 == data2)
            {
                return(0);
            }
            if (!data1.HasValue)
            {
                return(1);
            }
            else if (!data2.HasValue)
            {
                return(-1);
            }
            return(data1.Value.CompareTo(data2.Value));
        }
Example #4
0
        public static int CompareByDescription(VersionListItem item1, VersionListItem item2)
        {
            var data1 = item1.DataContext.Description;
            var data2 = item2.DataContext.Description;

            if (data1 == data2)
            {
                return(0);
            }
            if (data1 == null)
            {
                return(1);
            }
            else if (data2 == null)
            {
                return(-1);
            }
            return(string.Compare(data1, data2));
        }
Example #5
0
        private bool TestItem(VersionListItem item, VersionsSearchOptions search)
        {
            var version = item.DataContext;

            if (version.Name.Contains(search.Text))
            {
                return(true);
            }
            if (version.Description.Contains(search.Text))
            {
                return(true);
            }
            int id;

            if (int.TryParse(search.Text, NumberStyles.Integer, CultureInfo.InvariantCulture, out id))
            {
                if (version.Id == id)
                {
                    return(true);
                }
            }
            return(false);
        }