/// <summary>
 /// 显示任务
 /// </summary>
 /// <param name="eventList"></param>
 private void GenerateTasks()
 {
     this.CustomEventList = CustomAppointmentService.getByPlanId(this.planId, this.showAll);   //  根据计划id查询
     this.schedulerDataStorage1.Appointments.DataSource = this.CustomEventList;
     this.schedulerControl1.RefreshData();
     this.treeListTask.DataSource = this.CustomEventList;    //  任务一览绑定任务
 }
        /// <summary>
        /// 插入事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Storage_AppointmentInserting(object sender, PersistentObjectCancelEventArgs e)
        {
            Appointment       apt = e.Object as Appointment;
            CustomAppointment customAppointment;

            if (this.canWBS)
            {
                //  任务分解模式
                customAppointment = new CustomAppointment(apt, this.planId, taskId);
            }
            else
            {
                //  新插入模式
                customAppointment = new CustomAppointment(apt, this.planId, true);
            }

            bool success = true;    //  插入成功

            if (String.IsNullOrEmpty(customAppointment.Subject))
            {
                MessageBox.Show("标题不能为空!");
                success = false;
            }
            if (String.IsNullOrEmpty(customAppointment.OwnerId))
            {
                MessageBox.Show("负责人不能为空!");
                success = false;
            }

            if (success)
            {
                success = CustomAppointmentService.Insert(customAppointment);   //  插入数据库
            }
            e.Cancel = !success;

            if (success)
            {
                this.customAppointment = customAppointment; //  给当前任务赋值
                this.taskId            = this.customAppointment.TaskId;

                this.CustomEventList         = CustomAppointmentService.getByPlanId(this.planId, this.showAll); //  根据计划id查询
                this.treeListTask.DataSource = this.CustomEventList;
                this.treeListTask.ExpandAll();
            }
        }