Пример #1
0
        public ComplexTask(Task task)
        {
            this.RecordTime = task.RecordTime.ToShortDateString();
            this.TaskType = task.TaskType;
            this.TaskCategory = task.TaskCategory;
            this.ProjectID = task.ProjectID;
            this.TaskTitle = task.TaskTitle;
            this.SecondLevelTitle = task.SecondLevelTitle;
            this.TaskContent = task.TaskContent;
            this.TaskFinishStandard = task.TaskFinishStandard;
            this.ScheduledBonus = task.ScheduledBonus;
            this.Bonus = task.Bonus;
            this.UsedHours = task.UsedHours;
            this.TaskerId = task.TaskerID;
            this.ScheduledStartTime = task.ScheduledStartTime.ToString();
            this.ScheduledFinishTime = task.ScheduledFinishTime.ToString();
            this.ConfirmedFinishTime = (task.ConfirmedFinishTime == null)? "" :task.ConfirmedFinishTime.ToString();
            this.Month = task.Month;
            this.Week = task.Week;
            this.ID = task.ID;
            this.UsedHours = task.UsedHours;
           // this.CheckerName = task.CheckerName;
            //this.TaskerName = task.TaskerName;
            this.CheckerId = task.CheckerID;
            this.Memo = task.Memo;
            this.QualityFactor = task.QualityFactor;
            //下面处理不能直接得到的属性
            this.proName = task.Project.ProjectName;
            this.ProNO = task.Project.ProjectID;
            this.TaskStatus = task.TaskStatus;
            this.TaskProcessStatus = task.TaskProcessStatus;

        }
Пример #2
0
 /// <summary>
 /// 更新一个具有全属性的Task
 /// 这是此项目中属性最多最具体的Task类型
 /// </summary>
 /// <param name="taskStr"></param>
 /// <returns></returns>
 public string UpdateAFullAttrTask(string taskStr)
 {
     AllAttrTask ttask = (AllAttrTask)JsonConvert.DeserializeObject(taskStr, typeof(AllAttrTask));
     Task tsk = new Task();
     TaskService ts = new TaskService();
     Task t = ts.FindById(ttask.ID);
     //以下开始遍历赋值t的各种属性
     t.Bonus = ttask.Bonus;
     t.CheckerID = ttask.CheckerNameId;
     t.ConfirmedFinishTime = ttask.ConfirmedFinishTime;
     t.Memo = ttask.Memo;
     t.Month =ttask.Month;
     t.ProjectID = ttask.ProjectID;
     t.QualityFactor = ttask.QualityFactor;
     t.ScheduledBonus = ttask.ScheduledBonus;
     t.ScheduledFinishTime = ttask.ScheduledFinishTime;
     t.ScheduledStartTime = ttask.ScheduledStartTime;
     t.SecondLevelTitle = ttask.SecondLevelTitle;
     t.TaskContent = ttask.TaskContent;
     t.TaskerID = ttask.TaskerNameId;
     t.TaskFinishStandard = ttask.TaskFinishStandard;
     t.TaskStatus =  ttask.TaskStatus;
     t.TaskTitle = ttask.TaskTitle;
     t.TaskType = ttask.TaskType;
     t.UsedHours = ttask.UsedHours;
     t.Week = ttask.Week;
     //属性遍历完毕
     ts.Repository.Update(t);
     return "success";
 }
Пример #3
0
   /// <summary>
   /// 确认一条任务的方法
   /// </summary>
   /// <param name="task"></param>
   /// <returns></returns>
 public string ConfirmTask(string task) {
     Task tsk = new Task();
     TempTask ttask = (TempTask)JsonConvert.DeserializeObject(task, typeof(TempTask));
     //下面根据传入的TaskId查到此条Task ,然后更改传进来的属性,最后更新Task
     TaskService ts = new TaskService();
     Task t = ts.FindById(ttask.ID);
     if (t != null)
     {
         t.ID = ttask.ID;
         t.ConfirmedFinishTime = ttask.ConfirmedFinishTime;
         t.UsedHours = ttask.UsedHours;
         t.Memo = ttask.Memo;
         t.TaskProcessStatus = EnumTaskProcessStatus.Confirmed;
         t.TaskStatus = (EnumTaskStatus)Enum.Parse(typeof(EnumTaskStatus),ttask.taskStatus);
     }
     ts.Repository.Update(t);
     return "success";
 }
Пример #4
0
  /// <summary>
  ///    不正常情况下,审核一条任务
  ///    用于 当此任务 是 “延期” 或者“增加时间”的情况下
  /// </summary>
  /// <param name="task"></param>
 public string MidifyTaskUnnormal(string task) {
     Task tsk = new Task();
     TempTask ttask = (TempTask)JsonConvert.DeserializeObject(task, typeof(TempTask));
     //下面根据传入的TaskId查到此条Task ,然后更改传进来的属性,最后更新Task
     TaskService ts = new TaskService();
     Task t = ts.FindById(ttask.ID);
     if (t != null)
     {
         t.ConfirmedFinishTime = ttask.ConfirmedFinishTime;
         t.UsedHours = ttask.UsedHours;
         t.Memo = ttask.Memo;
         t.Bonus = ttask.Bonus;
         t.QualityFactor = ttask.QualityFactor;
         t.ScheduledFinishTime = ttask.ScheduledFinishTime;
         t.TaskProcessStatus = EnumTaskProcessStatus.Checked;
     }
     ts.Repository.Update(t);
     return "success";
 }
Пример #5
0
 /// <summary>
 /// 新增一条任务 
 /// </summary>
 /// <param name="taskStr"></param>
 public string AddTask(string taskStr)
 {
     Task task = new Task();
     TempTask ttask = (TempTask)JsonConvert.DeserializeObject(taskStr, typeof(TempTask));
     //下面是两行很有水准的枚举类型强制转换
     task.TaskType = (EnumTaskType)Enum.Parse(typeof(EnumTaskType), ttask.TaskType.ToString());
     task.TaskCategory = (EnumTaskCategory)Enum.Parse(typeof(EnumTaskCategory), ttask.TaskCategory);
     task.Week = ttask.Week;
     task.Month = Int32.Parse(ttask.Month);
     task.QualityFactor = 0;
     task.ScheduledStartTime = ttask.ScheduledStartTime;
     task.ScheduledFinishTime = ttask.ScheduledFinishTime;
     task.ScheduledBonus = ttask.ScheduledBonus;
     task.TaskFinishStandard = ttask.TaskFinishStandard;
     task.TaskContent = ttask.TaskContent;
     task.TaskTitle = ttask.TaskTitle;
     task.CheckerName = ttask.CheckerName;
     task.SecondLevelTitle = ttask.SecondLevelTitle;
     task.ProjectID = ttask.ProjectID;
     task.TaskerID = ttask.TaskerNameId;
     task.CheckerID = ttask.CheckerNameId;
     task.Memo = ttask.Memo;
     TaskService ts = new TaskService();
     ts.New(task);
     return "success";
 }