本文整理汇总了C#中TaskState.ConvertToBinary方法的典型用法代码示例。如果您正苦于以下问题:C# TaskState.ConvertToBinary方法的具体用法?C# TaskState.ConvertToBinary怎么用?C# TaskState.ConvertToBinary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskState
的用法示例。
在下文中一共展示了TaskState.ConvertToBinary方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTask
/// <summary>
/// Creates a new task
/// </summary>
/// <param name="text">The text of this task</param>
/// <param name="size">The size complexity of this task</param>
/// <param name="value">The business value of this task</param>
/// <param name="owner">The user who owns this task</param>
/// <param name="type">The type of this task</param>
/// <param name="state">The state of this task</param>
/// <returns>True if creating the task succeeds, false otherwise</returns>
public bool CreateTask(string text, int size, int value, UserView owner, TaskType type, TaskState state, Nullable<DateTime> completionDate)
{
if (!_isLoggedIn || CurrStory == null)
{
throw new InvalidOperationException("User must be logged in");
}
else if (owner == null && state != TaskState.Unassigned) // Giving an unassigned task any state but unassigned is not allowed
{
throw new InvalidOperationException("A task without an owner must be marked Unassigned");
}
else if (!EnumValues.businessValue.Contains(value) || !EnumValues.sizeComplexity.Contains(size))
{
throw new ArgumentOutOfRangeException("Invalid complexity value");
}
else if ((state == TaskState.Completed && !completionDate.HasValue) || (state != TaskState.Completed && completionDate.HasValue))
{
throw new InvalidOperationException("A task has a completion date iff it is completed");
}
else if (text == null)
{
throw new ArgumentNullException("Arguments to AddTask must not be null");
}
bool result = _dataModel.CreateTask(text, size, value, owner == null ? null : new int?(owner.UserID), type.ConvertToBinary(), state.ConvertToBinary(), CurrStory.StoryID, completionDate);
updateTasksForStory();
updateTasksForUser();
return result;
}
示例2: ChangeCurrTask
/// <summary>
/// Updates the current task
/// </summary>
/// <param name="text">The text of this task</param>
/// <param name="size">The size complexity of this task</param>
/// <param name="value">The business value of this task</param>
/// <param name="owner">The user who owns this task</param>
/// <param name="type">The type of this task</param>
/// <param name="state">The state of this task</param>
/// <param name="completion">The date this task was completed</param>
/// <returns>True if the changes succeed, false otherwise</returns>
public bool ChangeCurrTask(string text, int size, int value, UserView owner, TaskType type, TaskState state, Nullable<DateTime> completion)
{
if (!_isLoggedIn || CurrTask == null)
{
throw new InvalidOperationException("User must be logged in");
}
else if (owner == null && state != TaskState.Unassigned) // Giving an unassigned task any state but unassigned is not allowed
{
throw new InvalidOperationException("A task without an owner must be marked Unassigned");
}
else if (!EnumValues.businessValue.Contains(value) || !EnumValues.sizeComplexity.Contains(size))
{
throw new ArgumentOutOfRangeException("Invalid complexity value");
}
else if (text == null)
{
throw new ArgumentNullException("Arguments to AddTask must not be null");
}
bool result = _dataModel.ChangeTask(CurrTask.TaskID, text, size, value, owner == null ? null : new int?(owner.UserID), type.ConvertToBinary(), state.ConvertToBinary(), completion);
if (result)
{
updateTasksForStory();
updateTasksForUser();
CurrTask = new TaskView(_dataModel.GetTaskByID(CurrTask.TaskID));
}
return result;
}