Пример #1
0
 private void CreateTask(int userId)
 {
     var task = new Task()
     {
         AssignedId = userId,
         Status = Status.InProgress,
         Summary = "Explain the visions that inspire you",
         Priority = Priority.High,
         CreatedId = userId,
     };
     using (var db = new TrackerDataContext { Log = Console.Out })
     {
         db.Task.InsertOnSubmit(task);
         db.SubmitChanges();
         TaskId = task.Id;
     }
 }
Пример #2
0
        public void Test_Auditing()
        {
            using (var db = new TrackerDataContext { Log = Console.Out })
            {
                var user = db.User.GetByKey(SpockId);
                user.Comment = "I love my mom, but I hate Winona Ryder.";

                var task = new Task()
                {
                    AssignedId = SpockId,
                    CreatedId = SpockId,
                    Status = Status.NotStarted,
                    Priority = Priority.High,
                    Summary = "Punch Kirk in the face!"
                };
                db.Task.InsertOnSubmit(task);
                db.SubmitChanges();
                Console.Write(db.LastAudit.ToXml());
            }
        }
 partial void OnTaskChanging(Task value);
 private void OnCreatedTaskListRemove(Task entity)
 {
     SendPropertyChanging(null);
     entity.CreatedUser = null;
     SendPropertyChanged(null);
 }
 private void OnCreatedTaskListAdd(Task entity)
 {
     SendPropertyChanging(null);
     entity.CreatedUser = this;
     SendPropertyChanged(null);
 }
        public TaskViewData GetData(Task task)
        {
            var taskViewData = new TaskViewData();

            if( null == task)
                task = new Task();

            taskViewData.Task = task;

            taskViewData.AssignedUsers = UIHelper.GetUserSelectList(task.AssignedId);
            taskViewData.CreatedUsers = UIHelper.GetUserSelectList(task.CreatedId);
            taskViewData.Statuses = UIHelper.GetStatusSelectList(task.Status);
            taskViewData.Priorities = UIHelper.GetPrioritySelectList(task.Priority);

            using (var db = new TrackerDataContext())
            {
                db.ObjectTrackingEnabled = false;
                taskViewData.Audits = UIHelper.TransformAudits(db.Audit.ByTaskId(task.Id).OrderByDescending(a => a.Date).ToList());
            }
            return taskViewData;
        }