コード例 #1
0
ファイル: frmCustomDate.cs プロジェクト: shine8319/DLS
 public frmCustomDate(Task task) {
     InitializeComponent();
     this.currentTask = task;
     if(task.StartDate.HasValue)
         dateEdit1.DateTime = task.StartDate.Value;
     if(task.DueDate.HasValue)
         dateEdit2.DateTime = task.DueDate.Value;
 }
コード例 #2
0
ファイル: frmEditTask.cs プロジェクト: shine8319/DLS
 public frmEditTask(Task task, IDXMenuManager menuManager) {
     InitializeComponent();
     this.task = task;
     this.bindingTask = task.Clone();
     InitEditors();
     InitMenuManager(menuManager);
     if(bindingTask.StartDate.HasValue)
         deStartDate.DateTime = bindingTask.StartDate.Value;
     if(bindingTask.DueDate.HasValue)
         deDueDate.DateTime = bindingTask.DueDate.Value;
     teSubject.DataBindings.Add("Text", bindingTask, "Subject");
     icbStatus.DataBindings.Add("EditValue", bindingTask, "Status");
     icbCategory.DataBindings.Add("EditValue", bindingTask, "Category");
     icbPriority.DataBindings.Add("EditValue", bindingTask, "Priority");
     sePercentComplete.DataBindings.Add("Value", bindingTask, "PercentComplete");
     richEditControl1.DataBindings.Add("HtmlText", bindingTask, "Description");
     UpdateCaption();
     InitValidationProvider();
     if(task.AssignTo != null) {
         ucContactInfo1.Init(task.AssignTo, string.Empty);
         splitContainerControl1.Collapsed = LayoutOption.TaskCollapsed;
     } else
         splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel1;
 }
コード例 #3
0
ファイル: Tasks.cs プロジェクト: rexad/media-plan
 DialogResult EditTask(Task task)
 {
     if(task == null) return DialogResult.Ignore;
     DialogResult ret = DialogResult.Cancel;
     Cursor.Current = Cursors.WaitCursor;
     using(frmEditTask frm = new frmEditTask(task, OwnerForm.Ribbon)) {
         ret = frm.ShowDialog(OwnerForm);
     }
     Cursor.Current = Cursors.Default;
     return ret;
 }
コード例 #4
0
ファイル: Tasks.cs プロジェクト: rexad/media-plan
 void DoEditTaskButtonClick(string tag)
 {
     switch(tag) {
         case TagResources.TaskDelete:
             if(CurrentTask == null) return;
             int index = gridView1.FocusedRowHandle;
             gridView1.BeginDataUpdate();
             try {
                 foreach(List<Task> list in tasks.Values)
                     list.Remove(CurrentTask);
             } finally {
                 gridView1.EndDataUpdate();
             }
             if(index > gridView1.DataRowCount - 1) index--;
             gridView1.FocusedRowHandle = index;
             break;
         case TagResources.TaskNew:
             if(CurrentKey != null) {
                 Task task = new Task(Properties.Resources.NewTaskName, TaskCategory.Office);
                 task.AssignTo = CurrentKey.Contact;
                 if(EditTask(task) == DialogResult.OK) {
                     gridControl1.MainView.BeginDataUpdate();
                     try {
                         ((List<Task>)tasks[CurrentKey]).Add(task);
                     } finally {
                         gridControl1.MainView.EndDataUpdate();
                     }
                     ColumnView view = gridControl1.MainView as ColumnView;
                     if(view != null) {
                         GridHelper.GridViewFocusObject(view, task);
                     }
                 }
             }
             break;
         case TagResources.TaskEdit:
             EditTask(CurrentTask);
             break;
     }
 }
コード例 #5
0
ファイル: Data.cs プロジェクト: rexad/media-plan
 public Task Clone()
 {
     Task task = new Task(this.Subject, this.Category);
     task.Assign(this);
     return task;
 }
コード例 #6
0
ファイル: Data.cs プロジェクト: rexad/media-plan
 public void Assign(Task task)
 {
     this.subject = task.Subject;
     this.priority = task.Priority;
     this.percentComplete = task.PercentComplete;
     this.createdDate = task.CreatedDate;
     this.startDate = task.StartDate;
     this.dueDate = task.DueDate;
     this.completedDate = task.CompletedDate;
     this.description = task.Description;
     this.category = task.Category;
     this.status = task.Status;
     this.assignTo = task.AssignTo;
 }
コード例 #7
0
ファイル: Data.cs プロジェクト: rexad/media-plan
        public static Task CreateTask(string subject, TaskCategory category)
        {
            Task task = new Task(subject, category, DateTime.Now.AddHours(-rndGenerator.Next(96)));
            int rndStatus = rndGenerator.Next(10);
            if(task.TimeDiff.TotalHours > 12) {
                if(task.TimeDiff.TotalHours > 80) {
                    task.Status = TaskStatus.Completed;

                } else {
                    task.Status = TaskStatus.InProgress;
                    task.PercentComplete = rndGenerator.Next(9) * 10;
                }
                task.StartDate = task.CreatedDate.AddMinutes(rndGenerator.Next(720)).Date;
            }
            if(rndStatus != 5) task.DueDate = task.CreatedDate.AddHours((90 - rndStatus * 9) + 24).Date;
            if(rndStatus > 8) task.Priority = 2;
            if(rndStatus < 3) task.Priority = 0;
            if(rndStatus == 6 && task.Status == TaskStatus.InProgress) task.Status = TaskStatus.Deferred;
            if(rndStatus == 4 && task.Status == TaskStatus.InProgress && task.PercentComplete < 40) task.Status = TaskStatus.WaitingOnSomeoneElse;
            if(task.Category == TaskCategory.Office && rndStatus != 7 && Customers.Count > 0)
                task.AssignTo = Customers[rndGenerator.Next(Customers.Count)];
            if(task.Status == TaskStatus.Completed) {
                if(task.StartDate.Value == null) task.StartDate = task.CreatedDate.AddHours(12).Date;
                task.CompletedDate = task.StartDate.Value.AddHours(rndGenerator.Next(48) + 24);
            }
            return task;
        }
コード例 #8
0
ファイル: frmMain.cs プロジェクト: shine8319/DLS
 internal void EnabledFlagButtons(bool enabledCurrentTask, bool enabledEdit, Task task) {
     List<BarButtonItem> list = new List<BarButtonItem> { bbiTodayFlag, bbiTomorrowFlag, bbiThisWeekFlag, 
         bbiNextWeekFlag, bbiNoDateFlag, bbiCustomFlag };
     foreach(BarButtonItem item in list) {
         item.Enabled = enabledCurrentTask;
         if(task != null)
             item.Down = task.FlagStatus.Equals(item.Tag);
         else item.Down = false;
     }
     bbiDeleteDevice.Enabled = enabledCurrentTask;
     bbiEditDevice.Enabled = enabledEdit;
 }