Пример #1
0
        public static IEnumerable<TaskStatus> CreateDefaultTaskStatuses()
        {
            var taskStatuses = new List<TaskStatus>();

            var taskStatus = new TaskStatus
            {
                Id = Guid.NewGuid(),
                Name = "Created",
                Color = "#FFFFFF",
                DefaultTypeInt = ((int)StatusDetail.CreatedDefault),
                RemoveFromRoute = true,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };

            taskStatuses.Add(taskStatus);

            taskStatus = new TaskStatus
            {
                Id = Guid.NewGuid(),
                Name = "Routed",
                Color = "#0D9EFF",
                DefaultTypeInt = ((int)StatusDetail.RoutedDefault),
                RemoveFromRoute = false,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };

            taskStatuses.Add(taskStatus);

            taskStatus = new TaskStatus
            {
                Id = Guid.NewGuid(),
                Name = "On Hold",
                Color = "#FFCC44",
                RemoveFromRoute = false,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };

            taskStatuses.Add(taskStatus);

            taskStatus = new TaskStatus
            {
                Id = Guid.NewGuid(),
                Name = "Completed",
                Color = "#32CD32",
                DefaultTypeInt = ((int)StatusDetail.CompletedDefault),
                RemoveFromRoute = false,
                CreatedDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow
            };

            taskStatuses.Add(taskStatus);

            return taskStatuses.ToArray();
        }
 public void DeleteTaskStatus(TaskStatus taskStatus)
 {
     this.ObjectContext.DetachExistingAndAttach(taskStatus);
     this.ObjectContext.TaskStatuses.DeleteObject(taskStatus);
 }
        public void UpdateTaskStatus(TaskStatus taskStatus)
        {
            taskStatus.LastModified = DateTime.UtcNow;
            taskStatus.LastModifyingUserId = CurrentUserAccount().Id;

            this.ObjectContext.TaskStatuses.AttachAsModified(taskStatus);
        }
 public void InsertTaskStatus(TaskStatus taskStatus)
 {
     if ((taskStatus.EntityState != EntityState.Detached))
         this.ObjectContext.ObjectStateManager.ChangeObjectState(taskStatus, EntityState.Added);
     else
         this.ObjectContext.TaskStatuses.AddObject(taskStatus);
 }
Пример #5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TaskStatuses EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTaskStatuses(TaskStatus taskStatus)
 {
     base.AddObject("TaskStatuses", taskStatus);
 }
Пример #6
0
 /// <summary>
 /// Create a new TaskStatus object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="removeFromRoute">Initial value of the RemoveFromRoute property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 public static TaskStatus CreateTaskStatus(global::System.Guid id, global::System.Boolean removeFromRoute, global::System.DateTime createdDate)
 {
     TaskStatus taskStatus = new TaskStatus();
     taskStatus.Id = id;
     taskStatus.RemoveFromRoute = removeFromRoute;
     taskStatus.CreatedDate = createdDate;
     return taskStatus;
 }