当前位置: 首页>>代码示例>>C#>>正文


C# TaskType.ConvertToBinary方法代码示例

本文整理汇总了C#中TaskType.ConvertToBinary方法的典型用法代码示例。如果您正苦于以下问题:C# TaskType.ConvertToBinary方法的具体用法?C# TaskType.ConvertToBinary怎么用?C# TaskType.ConvertToBinary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TaskType的用法示例。


在下文中一共展示了TaskType.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;
        }
开发者ID:MaxWarren,项目名称:EECS-393-Project,代码行数:39,代码来源:SPMSViewModel.cs

示例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;
        }
开发者ID:MaxWarren,项目名称:EECS-393-Project,代码行数:40,代码来源:SPMSViewModel.cs


注:本文中的TaskType.ConvertToBinary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。