コード例 #1
0
 public ActionResult AddTask(long projectId, long storyId, string description, string initials, IterationType iterationType)
 {
     var task = new Task { Description = description, StoryId = storyId };
     task.Description = AddInitialsToDescription(task, initials,projectId, iterationType);
     service.AddNewTask(task, projectId);
     return GetStory(storyId, projectId, iterationType);
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IterationCount"/> struct.
        /// </summary>
        /// <param name="value">The size of the IterationCount.</param>
        /// <param name="type">The unit of the IterationCount.</param>
        public IterationCount(ulong value, IterationType type)
        {
            if (type > IterationType.Infinite)
            {
                throw new ArgumentException("Invalid value", nameof(type));
            }

            _type  = type;
            _value = value;
        }
コード例 #3
0
ファイル: Extensions.cs プロジェクト: Charcoals/Charcoal
        public static Common.Entities.Iteration ConvertTo(this Iteration iteration, IterationType type)
        {
            var convertedIteration = new Common.Entities.Iteration
                                {
                                    Id = iteration.Id,
                                    Finish = iteration.FinishDate,
                                    Start = iteration.StartDate
                                };

            convertedIteration.Stories.AddRange(iteration.Stories.Select(e => e.ConvertTo(type)));
            return convertedIteration;
        }
コード例 #4
0
ファイル: Extensions.cs プロジェクト: Charcoals/Charcoal
 public static Charcoal.Common.Entities.Story ConvertTo(this Story story, IterationType type)
 {
     return new Charcoal.Common.Entities.Story
     {
         Id = story.Id,
         Description = story.Description,
         Title = story.Name,
         IterationType = type,
         Estimate = story.Estimate,
         Status = ConvertTo(story.CurrentState),
         StoryType = ConvertTo(story.StoryType),
         Tasks = story.Tasks.Select(e => e.ConvertTo()).ToList(),
         ProjectId = story.ProjectId,
      //   AcceptedOn = story.AcceptedOn,
        // CreatedOn = story.CreatedOn.Value
     };
 }
コード例 #5
0
ファイル: Interactor.cs プロジェクト: condmaker/timefall
    /// <summary>
    /// Method responsible for invoking the specific event
    /// based on the IterationType
    /// </summary>
    /// <param name="iter">Iteration type to iterate to</param>
    private void RunIteration(IterationType iter)
    {
        switch (iter)
        {
        case IterationType.Last:
            OnGoToLast?.Invoke();
            break;

        case IterationType.Next:
            OnGoToNext?.Invoke(iteration.Iter);
            break;

        case IterationType.Previous:
            OnGoToNext?.Invoke(iteration.Iter);
            break;
        }
    }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        public void ReadData(IObjectDataInput input)
        {
            _predicate     = input.ReadObject <IPredicate <TKey, TValue> >();
            _comparer      = input.ReadObject <IComparer <KeyValuePair <TKey, TValue> > >();
            _page          = input.ReadInt();
            _pageSize      = input.ReadInt();
            _iterationType = (IterationType)Enum.Parse(typeof(IterationType), input.ReadUTF(), true);
            int size = input.ReadInt();

            _anchorList = new List <KeyValuePair <int, KeyValuePair <TKey, TValue> > > (size);
            for (int i = 0; i < size; i++)
            {
                int anchorPage = input.ReadInt();
                KeyValuePair <TKey, TValue> anchorEntry = new KeyValuePair <TKey, TValue>(input.ReadObject <TKey>(), input.ReadObject <TValue>());
                _anchorList.Add(new KeyValuePair <int, KeyValuePair <TKey, TValue> >(anchorPage, anchorEntry));
            }
        }
コード例 #7
0
ファイル: PTStoryProvider.cs プロジェクト: Charcoals/Charcoal
 public List<Charcoal.Common.Entities.Story> GetStories(long projectId, IterationType iterationType)
 {
     var stories = new List<Story>();
     switch (iterationType)
     {
         case IterationType.Current:
             stories = m_service.GetCurrentStories((int)projectId);
             break;
         case IterationType.Icebox:
             stories = m_service.GetIceboxStories((int)projectId);
             break;
         case IterationType.Backlog:
             stories = m_service.GetBacklogStories((int)projectId);
             break;
     }
     return stories.ConvertAll(e => e.ConvertTo(iterationType));
 }
コード例 #8
0
 internal SortedEnumerator(IEnumerable <KeyValuePair <TKey, TValue> > enumerable, IterationType iterationType)
 {
     this._enumerable    = enumerable;
     this._iterationType = iterationType;
 }
コード例 #9
0
 public SortedQueryResultSet(IComparer <KeyValuePair <TKey, TValue> > comparer, IEnumerable <KeyValuePair <TKey, TValue> > entries, IterationType iterationType) : base(entries, comparer)
 {
     this.entries       = entries;
     this.iterationType = iterationType;
 }
コード例 #10
0
 //TODO: this is duplicated from task controller, put somewhere better
 private string AddInitialsToDescription(Task task, string initials, long projectId, IterationType iterationType)
 {
     return new TaskViewModel(task, projectId,iterationType).GetDescriptionWithoutOwners() + (string.IsNullOrEmpty(initials) ? "" : (" (" + initials.ToUpper() + ")"));
 }
コード例 #11
0
 /// <summary>
 /// Resets the predicate for reuse.
 /// </summary>
 public void Reset()
 {
     _iterationType = IterationType.KEY;
     _anchorList.Clear();
     _page = 0;
 }
コード例 #12
0
 public List<Story> GetStories(long projectId, IterationType iterationType)
 {
     return m_storyRepository.FindAllByIterationType(projectId, (int)iterationType).ConvertAll(e=> (Story)e);
 }
コード例 #13
0
 public CustomComparator(int type = 0, IterationType iterationType = IterationType.Key)
 {
     _type          = type;
     _iterationType = iterationType;
 }
コード例 #14
0
 public StoryRowViewModel(Story story,IterationType iterationType)
 {
     Story = story;
     IterationType = iterationType;
 }
コード例 #15
0
        public static int Compare <TKey, TValue>(IComparer <KeyValuePair <TKey, TValue> > comparer, IterationType iterationType,
                                                 KeyValuePair <TKey, TValue> entry1, KeyValuePair <TKey, TValue> entry2)
        {
            if (comparer != null)
            {
                int compareResults = comparer.Compare(entry1, entry2);
                if (compareResults != 0)
                {
                    return(compareResults);
                }
                return(Comparer <int> .Default.Compare(entry1.Key.GetHashCode(), entry2.Key.GetHashCode()));
            }

            object comparable1;
            object comparable2;

            switch (iterationType)
            {
            case IterationType.KEY:
                comparable1 = entry1.Key;
                comparable2 = entry2.Key;
                break;

            case IterationType.VALUE:
                comparable1 = entry1.Value;
                comparable2 = entry2.Value;
                break;

            default:
                // Possibly ENTRY
                // If entries are comparable, we can compare them
                if (entry1 is IComparable && entry2 is IComparable)
                {
                    comparable1 = entry1;
                    comparable2 = entry2;
                }
                else
                {
                    // Otherwise, comparing entries directly is not meaningful.
                    // So keys can be used instead of map entries.
                    comparable1 = entry1.Key;
                    comparable2 = entry2.Key;
                }
                break;
            }

            checkIfComparable(comparable1);
            checkIfComparable(comparable2);

            int result = ((IComparable)comparable1).CompareTo(comparable2);

            if (result != 0)
            {
                return(result);
            }
            return(Comparer <int> .Default.Compare(entry1.Key.GetHashCode(), entry2.Key.GetHashCode()));
        }
コード例 #16
0
 public static IComparer <KeyValuePair <TKey, TValue> > NewComparator <TKey, TValue>(IComparer <KeyValuePair <TKey, TValue> > comparator,
                                                                                     IterationType iterationType)
 {
     return(new SortingComparer <TKey, TValue>(comparator, iterationType));
 }
コード例 #17
0
        public static SortedQueryResultSet <TKey, TValue> GetSortedQueryResultSet <TKey, TValue>(ISet <KeyValuePair <TKey, TValue> > list,
                                                                                                 PagingPredicate <TKey, TValue> pagingPredicate, IterationType iterationType)
        {
            if (list == null || list.Count == 0)
            {
                return(new SortedQueryResultSet <TKey, TValue>());
            }
            IComparer <KeyValuePair <TKey, TValue> > comparer   = SortingUtil.NewComparator(pagingPredicate.GetComparator(), iterationType);
            List <KeyValuePair <TKey, TValue> >      sortedList = new List <KeyValuePair <TKey, TValue> >();

            sortedList.AddRange(list);
            sortedList.Sort(comparer);

            KeyValuePair <int, KeyValuePair <TKey, TValue> > nearestAnchorEntry = pagingPredicate.GetNearestAnchorEntry();
            int nearestPage = nearestAnchorEntry.Key;
            int page        = pagingPredicate.GetPage();
            int pageSize    = pagingPredicate.GetPageSize();
            int begin       = pageSize * (page - nearestPage - 1);
            int size        = sortedList.Count;

            if (begin > size)
            {
                return(new SortedQueryResultSet <TKey, TValue>());
            }
            int end = begin + pageSize;

            if (end > size)
            {
                pageSize = size - begin;
            }

            SetAnchor(sortedList, pagingPredicate, nearestPage);
            List <KeyValuePair <TKey, TValue> > subList = sortedList.GetRange(begin, pageSize);

            return(new SortedQueryResultSet <TKey, TValue>(comparer, subList, iterationType));
        }
コード例 #18
0
 public SortingComparer(IComparer <KeyValuePair <TKey, TValue> > comparer, IterationType iterationType)
 {
     this._comparer      = comparer;
     this._iterationType = iterationType;
 }
コード例 #19
0
 public Story StartStory(long projectId, long storyId, IterationType iterationType)
 {
     return m_storyRepository.UpdateStoryStatus(storyId, (int)StoryStatus.Started);
 }
コード例 #20
0
ファイル: PTStoryProvider.cs プロジェクト: Charcoals/Charcoal
 public Charcoal.Common.Entities.Story GetStory(long projectId, long storyId, IterationType iterationType)
 {
     return m_service.GetStory((int)projectId, (int)storyId).ConvertTo(iterationType);
 }
コード例 #21
0
 public ComparerImpl(IComparer <KeyValuePair <object, object> > comparer, IterationType iterationType)
 {
     _comparer      = comparer;
     _iterationType = iterationType;
 }
コード例 #22
0
 public void ReadData(IObjectDataInput input)
 {
     _type          = input.ReadInt();
     _iterationType = (IterationType)input.ReadInt();
 }
コード例 #23
0
 private static IComparer <KeyValuePair <object, object> > NewComparer(IComparer <KeyValuePair <object, object> >
                                                                       pagingPredicateComparer, IterationType iterationType)
 {
     return(new ComparerImpl(pagingPredicateComparer, iterationType));
 }
コード例 #24
0
 public Story GetStory(long projectId, long storyId, IterationType iterationType)
 {
     return m_storyRepository.Find(storyId);
 }
コード例 #25
0
 public void SetIterationType(IterationType iterationType)
 {
     this._iterationType = iterationType;
 }
コード例 #26
0
 public PredicateComparer(int type = 0, IterationType iterationType = IterationType.Key)
 {
     Type          = type;
     IterationType = iterationType;
 }
コード例 #27
0
ファイル: TaskController.cs プロジェクト: Charcoals/Charcoal
 public ActionResult Add(long storyId, long projectId, IterationType iterationType)
 {
     return PartialView(new TaskViewModel(new Task { StoryId = storyId }, projectId, iterationType));
 }
コード例 #28
0
        public static IEnumerable GetSortedQueryResultSet <TKey, TValue>(List <KeyValuePair <object, object> > list,
                                                                         PagingPredicate pagingPredicate, IterationType iterationType)
        {
            if (list.Count == 0)
            {
                return(new List <KeyValuePair <TKey, TValue> >());
            }

            var comparator = NewComparer(pagingPredicate.Comparer, iterationType);

            list.Sort(comparator);

            var nearestAnchorEntry = pagingPredicate.GetNearestAnchorEntry();
            var nearestPage        = nearestAnchorEntry.Key;
            var page     = pagingPredicate.Page;
            var pageSize = pagingPredicate.PageSize;
            var begin    = pageSize * (page - nearestPage - 1);
            var size     = list.Count;

            if (begin > size)
            {
                return(new List <KeyValuePair <TKey, TValue> >());
            }

            SetAnchor(list, pagingPredicate, nearestPage);

            var subList = list.GetRange(begin, Math.Min(pageSize, list.Count - begin));

            switch (iterationType)
            {
            case IterationType.Key:
                return(subList.Select(pair => pair.Key));

            case IterationType.Value:
                return(subList.Select(pair => pair.Value));

            case IterationType.Entry:
                return(subList.Select(pair => new KeyValuePair <TKey, TValue>((TKey)pair.Key, (TValue)pair.Value)));

            default:
                throw new ArgumentOutOfRangeException("iterationType", iterationType, null);
            }
        }
コード例 #29
0
    /// <summary>
    /// Method responsible for changing to the next state following
    /// the iteration
    /// </summary>
    /// <param name="iteration">Iteration Type to follow</param>
    private void ChangeToNext(IterationType iteration)
    {
        short newState = (short)(State + (short)iteration);

        ChangeToState(newState);
    }
コード例 #30
0
        private static int Compare(IComparer <KeyValuePair <object, object> > comparer, IterationType iterationType,
                                   KeyValuePair <object, object> x, KeyValuePair <object, object> y)
        {
            int result;

            if (comparer != null)
            {
                result = comparer.Compare(x, y);
                return(result != 0 ? result : CompareIntegers(x.Key.GetHashCode(), y.Key.GetHashCode()));
            }

            switch (iterationType)
            {
            case IterationType.Key:
                result = ((IComparable)x.Key).CompareTo(y.Key);
                break;

            case IterationType.Value:
                result = ((IComparable)x.Value).CompareTo(y.Value);
                break;

            default:
                // Possibly ENTRY
                // Entries are not comparable, we cannot compare them
                // So keys can be used instead of map entries.
                result = ((IComparable)x.Key).CompareTo(y.Key);
                break;
            }
            return(result != 0 ? result : CompareIntegers(x.Key.GetHashCode(), y.Key.GetHashCode()));
        }
コード例 #31
0
ファイル: TaskViewModel.cs プロジェクト: Charcoals/Charcoal
 public TaskViewModel(Task task, long projectId, IterationType iterationType)
 {
     m_projectId = projectId;
     Task = task;
     IterationType = iterationType;
 }
コード例 #32
0
ファイル: Iteration.cs プロジェクト: condmaker/timefall
 /// <summary>
 /// Constructor of the struct Iteration
 /// </summary>
 /// <param name="iter">Iteration Type</param>
 public Iteration(IterationType iter = IterationType.Next)
 {
     iteration     = iter;
     specificState = 0;
     specific      = false;
 }
コード例 #33
0
 private ActionResult GetStory(long storyId, long projectId, IterationType iterationType)
 {
     var story = service.GetStory(projectId, storyId, iterationType);
     return PartialView("StoryRow", new StoryRowViewModel(story,iterationType));
 }