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); }
/// <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; }
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; }
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 }; }
/// <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; } }
/// <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)); } }
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)); }
internal SortedEnumerator(IEnumerable <KeyValuePair <TKey, TValue> > enumerable, IterationType iterationType) { this._enumerable = enumerable; this._iterationType = iterationType; }
public SortedQueryResultSet(IComparer <KeyValuePair <TKey, TValue> > comparer, IEnumerable <KeyValuePair <TKey, TValue> > entries, IterationType iterationType) : base(entries, comparer) { this.entries = entries; this.iterationType = iterationType; }
//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() + ")")); }
/// <summary> /// Resets the predicate for reuse. /// </summary> public void Reset() { _iterationType = IterationType.KEY; _anchorList.Clear(); _page = 0; }
public List<Story> GetStories(long projectId, IterationType iterationType) { return m_storyRepository.FindAllByIterationType(projectId, (int)iterationType).ConvertAll(e=> (Story)e); }
public CustomComparator(int type = 0, IterationType iterationType = IterationType.Key) { _type = type; _iterationType = iterationType; }
public StoryRowViewModel(Story story,IterationType iterationType) { Story = story; IterationType = iterationType; }
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())); }
public static IComparer <KeyValuePair <TKey, TValue> > NewComparator <TKey, TValue>(IComparer <KeyValuePair <TKey, TValue> > comparator, IterationType iterationType) { return(new SortingComparer <TKey, TValue>(comparator, iterationType)); }
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)); }
public SortingComparer(IComparer <KeyValuePair <TKey, TValue> > comparer, IterationType iterationType) { this._comparer = comparer; this._iterationType = iterationType; }
public Story StartStory(long projectId, long storyId, IterationType iterationType) { return m_storyRepository.UpdateStoryStatus(storyId, (int)StoryStatus.Started); }
public Charcoal.Common.Entities.Story GetStory(long projectId, long storyId, IterationType iterationType) { return m_service.GetStory((int)projectId, (int)storyId).ConvertTo(iterationType); }
public ComparerImpl(IComparer <KeyValuePair <object, object> > comparer, IterationType iterationType) { _comparer = comparer; _iterationType = iterationType; }
public void ReadData(IObjectDataInput input) { _type = input.ReadInt(); _iterationType = (IterationType)input.ReadInt(); }
private static IComparer <KeyValuePair <object, object> > NewComparer(IComparer <KeyValuePair <object, object> > pagingPredicateComparer, IterationType iterationType) { return(new ComparerImpl(pagingPredicateComparer, iterationType)); }
public Story GetStory(long projectId, long storyId, IterationType iterationType) { return m_storyRepository.Find(storyId); }
public void SetIterationType(IterationType iterationType) { this._iterationType = iterationType; }
public PredicateComparer(int type = 0, IterationType iterationType = IterationType.Key) { Type = type; IterationType = iterationType; }
public ActionResult Add(long storyId, long projectId, IterationType iterationType) { return PartialView(new TaskViewModel(new Task { StoryId = storyId }, projectId, iterationType)); }
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); } }
/// <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); }
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())); }
public TaskViewModel(Task task, long projectId, IterationType iterationType) { m_projectId = projectId; Task = task; IterationType = iterationType; }
/// <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; }
private ActionResult GetStory(long storyId, long projectId, IterationType iterationType) { var story = service.GetStory(projectId, storyId, iterationType); return PartialView("StoryRow", new StoryRowViewModel(story,iterationType)); }