/// <summary>
 /// Implementation of IComparable.
 /// </summary>
 /// <param name="o"></param>
 /// <returns></returns>
 public int CompareTo(object o)
 {
     if (o is HansoftEnumValue)
     {
         HansoftEnumValue other = (HansoftEnumValue)o;
         return(other.ToInt() - ToInt());
     }
     else
     {
         throw new ArgumentException();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Set the value of a built in column for this task.
        /// </summary>
        /// <param name="eHPMProjectDefaultColumn">The column to set the value for.</param>
        /// <param name="sourceValue">The value to be set. Can be of any form that reasonably can be converted to a suitable value for the column.</param>
        public void SetDefaultColumnValue(EHPMProjectDefaultColumn eHPMProjectDefaultColumn, object sourceValue)
        {
            switch (eHPMProjectDefaultColumn)
            {
            case EHPMProjectDefaultColumn.Risk:
                Risk = HansoftEnumValue.FromObject(MainProjectID, eHPMProjectDefaultColumn, sourceValue);
                break;

            case EHPMProjectDefaultColumn.BacklogPriority:
                Priority = HansoftEnumValue.FromObject(MainProjectID, eHPMProjectDefaultColumn, sourceValue);
                break;

            case EHPMProjectDefaultColumn.EstimatedIdealDays:
                EstimatedDays = Convert.ToDouble(sourceValue, new System.Globalization.CultureInfo("en-US"));
                break;

            case EHPMProjectDefaultColumn.BacklogCategory:
                Category = HansoftEnumValue.FromObject(MainProjectID, eHPMProjectDefaultColumn, sourceValue);
                break;

            case EHPMProjectDefaultColumn.ComplexityPoints:
                Points = Convert.ToInt32(sourceValue);
                break;

            case EHPMProjectDefaultColumn.ItemStatus:
                Status = HansoftEnumValue.FromObject(MainProjectID, eHPMProjectDefaultColumn, sourceValue);
                break;

            case EHPMProjectDefaultColumn.Confidence:
                Confidence = HansoftEnumValue.FromObject(MainProjectID, eHPMProjectDefaultColumn, sourceValue);
                break;

            case EHPMProjectDefaultColumn.Hyperlink:
                Hyperlink = sourceValue.ToString();
                break;

            case EHPMProjectDefaultColumn.ItemName:
                Name = sourceValue.ToString();
                break;

            case EHPMProjectDefaultColumn.WorkRemaining:
                WorkRemaining = Convert.ToDouble(sourceValue, new System.Globalization.CultureInfo("en-US"));
                break;

            default:
                throw new ArgumentException("Unsupported default column in GetDefaultColumnValue/1: " + eHPMProjectDefaultColumn);
            }
        }
        private void updateFromTask(Task task)
        {
            totalStories += 1;
            completedStories += ((task.Status.Equals(EHPMTaskStatus.Completed)) ? 1 : 0);

            totalPoints += task.Points;
            completedPoints += ((task.Status.Equals(EHPMTaskStatus.Completed)) ? task.Points : 0);
            HansoftEnumValue taskStatus = getAggregatedStatus(task);
            status = CalculateNewStatus(task, status, taskStatus);

            if (!taskGroup.ContainsKey(taskStatus.Text))
            {
                taskGroup.Add(taskStatus.Text, new TaskCollection(taskStatus.Text, 0, 0));
            }
            taskGroup[taskStatus.Text].addTaskInformation(task);
        }
 public static HansoftEnumValue CalculateNewStatus(Task task, HansoftEnumValue prevStatus, HansoftEnumValue newStatus)
 {
     HansoftEnumValue finalStatus = null;
     // If either prevStatus or newStatus is null, the result is "the other value" (which can be null)
     if (prevStatus == null)
     {
         finalStatus = newStatus;
     }
     else if (newStatus == null)
     {
         finalStatus = prevStatus;
     }
     else if (prevStatus.Text.Equals(newStatus.Text))
     {
         finalStatus = prevStatus;
     }
     // If any story is Blocked the feature is Blocked
     else if (prevStatus.Text.Equals("Blocked") || newStatus.Text.Equals("Blocked"))
     {
         finalStatus = HansoftEnumValue.FromString(task.ProjectID, EHPMProjectDefaultColumn.ItemStatus, "Blocked");
     }
     // For all other combinations the result is InProgress
     else
     {
         finalStatus = HansoftEnumValue.FromString(task.ProjectID, EHPMProjectDefaultColumn.ItemStatus, "In progress");
     }
     return finalStatus;
 }