Exemple #1
0
        /// <summary>
        /// 初始化看板
        /// </summary>
        private void InitKanbanData(Boolean assigned)
        {
            this.customAppointments.Clear();
            this.customAppointments = CustomAppointmentService.getAssignedTasksByTaskTemplateId(this.taskTemplateId, assigned, this.currentEmpId);

            this.tasksData.Clear();
            this.taskIdAndIndexes.Clear();
            int i = 0;

            foreach (CustomAppointment customAppointment in this.customAppointments)
            {
                this.taskIdAndIndexes.Add(i, customAppointment.TaskId);   //  task id和看板id kv
                this.tasksData.Add(customAppointment.buildTaskRecord(i));
                i++;
            }

            //  循环添加新选项卡
            //foreach (int v in Enum.GetValues(typeof(TaskStatus)))
            //{
            //    AddEmptyItem((TaskStatus)v);
            //}
            //tasksData = KanbanHelper.LoadTasks();
            //employeesData = KanbanHelper.LoadEmployees();
            //membersData = KanbanHelper.LoadMembers();
            //checklistData = KanbanHelper.LoadChecklist();
            //KanbanHelper.ProcessMembersPhoto(employeesData);
            gridControl.DataSource = tasksData;
            gridControl.ForceInitialize();
            //  循环添加新选项卡
            foreach (int v in Enum.GetValues(typeof(TaskStatus)))
            {
                AddEmptyItem((TaskStatus)v);
            }
        }
Exemple #2
0
        private void barTaskTracing_ItemClick(object sender, XtraBars.ItemClickEventArgs e)
        {
            int     handle   = 0;
            DataRow drhandle = this.tileView1.GetDataRow(handle);

            if (this.xtraTabControl1.SelectedTabPage == this.xtraTabPage1)
            {
                handle   = this.tileView1.FocusedRowHandle;
                drhandle = this.tileView1.GetDataRow(handle);
                new Frm我创建的任务预览(
                    CustomAppointmentService.getById(drhandle["task_id"].ToString())
                    , drhandle["emp_id"].ToString()
                    , true
                    ).ShowDialog();
            }
            if (this.xtraTabControl1.SelectedTabPage == this.xtraTabPage2)
            {
                handle   = this.gridView2.FocusedRowHandle;
                drhandle = this.gridView2.GetDataRow(handle);
                new Frm我指派的任务预览(
                    this
                    , CustomAppointmentService.getById(drhandle["task_id"].ToString())
                    , drhandle["delegate_id"].ToString()
                    ).ShowDialog();
            }
        }
Exemple #3
0
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            String taskId         = this.schedulerService.TaskId;
            String taskTemplateId = CustomAppointmentService.getTaskTemplateIdByTaskId(taskId);

            new Frm新建申报(taskId, taskTemplateId).ShowDialog();
        }
 /// <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;    //  任务一览绑定任务
 }
Exemple #5
0
        /// <summary>
        /// 通过任务信息初始化任务预览
        /// </summary>
        /// <param name="customAppointment"></param>
        /// <param name="empId"></param>
        /// <param name="isOwner">是否负责人</param>
        public Frm我指派的任务预览(Frm任务S frm, CustomAppointment customAppointment, String delegateId)
        {
            InitializeComponent();
            this.customAppointment = customAppointment;
            this.delegateId        = delegateId;

            //  补充参与者信息
            CustomAppointmentService.buildAssignee(customAppointment);
            CustomAppointmentService.taskRead(customAppointment);
            this.frm = frm;
            this.frm.RefrashGridcontrol();

            this.initViewData();    //  初始化视图的值

            this.getTaskAchievement();
            this.getTaskWorkIntensity();    //  工作强度

            //  任务分解一览
            this.treeListTask.DataSource = CustomAppointmentService.getAllById(customAppointment.TaskId);
            this.gridControl2.DataSource = this.GetDataTable();

            //  业务委托人
            //显示的数据
            this.comboBoxDelegate.DisplayMember = "Name"; //name为类A的字段名
            //隐藏的数据(对于多个数据,可以用逗号隔开。例:id,name)
            this.comboBoxDelegate.ValueMember = "Id";     //id为类A的字段名(对于隐藏对个数据,把数据放到一个字段用逗号隔开)
            this.comboBoxDelegate.DataSource  = EmpService.findAll();
        }
Exemple #6
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            int               handle            = this.gridView1.FocusedRowHandle;
            DataRow           drhandle          = this.gridView1.GetDataRow(handle);
            CustomAppointment customAppointment = CustomAppointmentService.getById(drhandle["task_id"].ToString());

            new Frm我创建的任务预览(customAppointment, customAppointment.OwnerId, false).ShowDialog();
        }
Exemple #7
0
        private void gridControl1_DoubleClick(object sender, EventArgs e)
        {
            int     handle   = this.tileView1.FocusedRowHandle;
            DataRow drhandle = this.tileView1.GetDataRow(handle);

            new Frm我创建的任务预览(
                CustomAppointmentService.getById(drhandle["task_id"].ToString())
                , drhandle["emp_id"].ToString()
                , true
                ).ShowDialog();
        }
        public void Storage_AppointmentDeleted(object sender, PersistentObjectsEventArgs e)
        {
            Appointment apt = e.Objects[0] as Appointment;

            if (apt != null && apt.Id != null)
            {
                if (MessageBox.Show("您确认要删除该记录吗", "删除提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    CustomAppointmentService.Delete((String)apt.Id);
                }
            }
        }
Exemple #9
0
        private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
        {
            //  校验
            if (DateTime.Compare(this.edtEndDate.DateTime.Date, this.edtStartDate.DateTime.Date) < 0)
            {
                MessageBox.Show("结束时间早于开始时间!");
                return;
            }
            if (this.barTaskTemplate.EditValue == null)
            {
                MessageBox.Show("任务模板不能为空!");
                return;
            }
            if (String.IsNullOrEmpty(this.tbSubject.Text))
            {
                MessageBox.Show("任务名称不能为空!");
                return;
            }
            if (this.comboBoxEmp.SelectedValue == null)
            {
                MessageBox.Show("负责人不能为空!");
                return;
            }
            if (this.barEditItem3.EditValue == null)
            {
                MessageBox.Show("难度系数不能为空!");
                return;
            }
            String   ParentTaskId    = System.Guid.NewGuid().ToString("N");
            String   PlanId          = System.Guid.NewGuid().ToString("N");
            DateTime StartTime       = this.edtStartDate.DateTime.Date;
            DateTime EndTime         = this.edtEndDate.DateTime.Date;
            String   Subject         = this.tbSubject.Text;
            String   OwnerId         = this.comboBoxEmp.SelectedValue.ToString();
            int      PercentComplete = 0;
            String   delegate_id     = this.comboBoxDelegate.SelectedValue.ToString(); //  业务委托人
            String   TaskLevel       = this.barEditItem任务级别.EditValue.ToString();
            String   Description     = this.tbDescription.Text;
            int      Label           = 1;

            CustomAppointment customAppointment = new CustomAppointment(ParentTaskId, PlanId, StartTime, EndTime, Subject, OwnerId, PercentComplete, this.taskTemplateId, Description, Label, 1, this.appointmentModel.TaskWorkIntensity, delegate_id, TaskLevel);

            if (CustomAppointmentService.InsertAndTaskWorkIntensity(customAppointment))
            {
                this.form.RefrashGridcontrol();
                this.Close();
            }
            else
            {
                MessageBox.Show("保存失败");
            }
        }
Exemple #10
0
 private void barButtonItem1_ItemClick(object sender, XtraBars.ItemClickEventArgs e)
 {
     if (customAppointment.Assignee.Count > 0)
     {
         FileService.uploadTaskFile(customAppointment.TaskId, this.delegateId);   //  TODO
         //  生成日志
         CustomAppointmentService.genereateCustomAppointmentlog(customAppointment.TaskId, this.delegateId, EnumTaskAction.完成);
         this.getTaskAchievement();
     }
     else
     {
         //  TODO
     }
 }
Exemple #11
0
        private void barButtonItem1_ItemClick(object sender, XtraBars.ItemClickEventArgs e)
        {
            int     handle   = 0;
            DataRow drhandle = this.gridView1.GetDataRow(handle);

            handle   = this.gridView1.FocusedRowHandle;
            drhandle = this.gridView1.GetDataRow(handle);

            new Frm我创建的任务预览(
                CustomAppointmentService.getById(drhandle["task_id"].ToString())
                , drhandle["emp_id"].ToString()
                , true
                ).ShowDialog();
        }
        /// <summary>
        /// 更新方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void Storage_AppointmentChanged(object sender, PersistentObjectsEventArgs e)
        {
            if (this.currentBreakDown)
            {
                Appointment       apt = e.Objects[0] as Appointment;
                CustomAppointment customAppointment = new CustomAppointment(apt, this.planId, false);

                //  更新数据
                bool success = CustomAppointmentService.Update(customAppointment);
            }
            else
            {
                //  不是当前部门不能编辑任务
                MessageBox.Show("只能编辑当前部门的任务");
            }
            //e.Cancel = !success;
        }
        /// <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();
            }
        }
Exemple #14
0
        void tileView_ItemDrop(object sender, ItemDropEventArgs e)
        {
            var    task       = tileView.GetRow(e.RowHandle) as TaskRecord;
            String taskId     = this.taskIdAndIndexes[Convert.ToInt32(task.Id.ToString())]; //  task id
            var    newStatus  = (TaskStatus)e.GroupColumnValue;
            var    prevStatus = (TaskStatus)e.PrevGroupColumnValue;

            if (!prevStatus.Equals(newStatus))
            {
                tileView.BeginDataUpdate();
                RemoveEmptyItem(newStatus);
                AddEmptyItem(prevStatus);
                tileView.EndDataUpdate();
            }
            int status = (int)newStatus;

            //  更新数据库状态
            CustomAppointmentService.UpdateStatus(taskId, status);
            //  更新数据源状态
            this.updateAppointmentStatus(taskId, status);
        }
Exemple #15
0
        private Boolean isOwner;                     //  是否负责人

        /// <summary>
        /// 通过任务信息初始化任务预览
        /// </summary>
        /// <param name="customAppointment"></param>
        /// <param name="empId"></param>
        /// <param name="isOwner">是否负责人</param>
        public Frm我创建的任务预览(CustomAppointment customAppointment, String empId, Boolean isOwner)
        {
            InitializeComponent();
            this.customAppointment = customAppointment;
            this.isOwner           = isOwner;
            this.empId             = empId;

            //  补充参与者信息
            CustomAppointmentService.buildAssignee(customAppointment);

            this.initViewData();    //  初始化视图的值

            if (this.customAppointment.OwnerId.Equals(empId))
            {
                //  负责人视图
                this.负责人视图();
            }
            else
            {
                //  参与者视图,可以上传成果物
                this.参与者视图();
            }
            this.getTaskAchievement();
            this.getTaskWorkIntensity();    //  工作强度

            //  任务分解一览
            this.treeListTask.DataSource = CustomAppointmentService.getAllById(customAppointment.TaskId);
            this.gridControl2.DataSource = this.GetDataTable();

            //  业务委托人
            //显示的数据
            this.comboBoxDelegate.DisplayMember = "Name"; //name为类A的字段名
            //隐藏的数据(对于多个数据,可以用逗号隔开。例:id,name)
            this.comboBoxDelegate.ValueMember = "Id";     //id为类A的字段名(对于隐藏对个数据,把数据放到一个字段用逗号隔开)
            this.comboBoxDelegate.DataSource  = EmpService.findAll();
        }
Exemple #16
0
 private BindingList <CustomAppointment> getData()
 {
     return(CustomAppointmentService.getAllTasksByTaskTemplateId(this.taskTemplateId));
 }
Exemple #17
0
 /// <summary>
 /// 取数据
 /// </summary>
 /// <returns></returns>
 BindingList <CustomAppointment> getData()
 {
     return(CustomAppointmentService.getAllTasksByTaskTemplateId("4"));
 }
Exemple #18
0
 private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     this.customAppointments = CustomAppointmentService.getAllTasksByTaskTemplateId(this.taskTemplateId);
 }
Exemple #19
0
        private void searchLookUpEdit1View_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
        {
            var a = this.searchLookUpEdit1.Properties.View.GetSelectedRows();
            var v = luValues.Find(b => b.FindText == this.searchLookUpEdit1.Properties.View.FindFilterText);

            if (v == null)
            {
                v                  = new LookUpMultSelectValues();
                v.FindText         = this.searchLookUpEdit1.Properties.View.FindFilterText;
                v.SelectedValues   = new List <string>();
                v.SelectedDisplays = new List <string>();
                luValues.Add(v);
            }
            if (a.Length > 0)
            {
                //新增状态时
                if (e.Action == CollectionChangeAction.Add)
                {
                    foreach (int rowHandle in a)
                    {
                        var vv = this.searchLookUpEdit1.Properties.View.GetRowCellValue(rowHandle, "Id").ToString();//id 是 Value Member
                        if (string.IsNullOrEmpty(v.SelectedValues.Find(b => b == vv)))
                        {
                            v.SelectedValues.Add(vv);
                            v.SelectedDisplays.Add(this.searchLookUpEdit1.Properties.View.GetRowCellValue(rowHandle, "Name").ToString());//name 是 Display Member
                        }
                    }
                }
            }
            //删除状态时
            if (e.Action == CollectionChangeAction.Remove)
            {
                List <string> dels = new List <string>();
                List <string> deld = new List <string>();

                for (int i = 0; i < v.SelectedValues.Count; i++)
                {
                    bool finded = false;
                    foreach (int rowHandle in a)
                    {
                        var vv = this.searchLookUpEdit1.Properties.View.GetRowCellValue(rowHandle, "Id").ToString();   //id 是 Value Member
                        var vn = this.searchLookUpEdit1.Properties.View.GetRowCellValue(rowHandle, "Name").ToString(); //name 是 Display Member
                        if (v.SelectedValues[i] == vv)
                        {
                            finded = true;
                            break;
                        }
                    }

                    if (!finded)
                    {
                        dels.Add(v.SelectedValues[i]);
                        deld.Add(v.SelectedDisplays[i]);
                    }
                }

                v.SelectedValues.RemoveAll(b => dels.Contains(b));
                v.SelectedDisplays.RemoveAll(b => deld.Contains(b));

                for (int i = 0; i < luValues.Count; i++)
                {
                    var ev = luValues[i];

                    ev.SelectedValues.RemoveAll(b => dels.Contains(b));
                    ev.SelectedDisplays.RemoveAll(b => deld.Contains(b));
                }
            }

            this.customAppointment.Assignee = v.SelectedValues;
            CustomAppointmentService.insertCustomAppointmentAssignee(customAppointment);    //  TODO
            getTaskAchievement();
            this.frm.RefrashGridcontrol();
        }
Exemple #20
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     this.customAppointment.DelegateId = this.comboBoxDelegate.SelectedValue.ToString();
     CustomAppointmentService.updateTaskDelegate(this.customAppointment);
     this.gridControl2.DataSource = this.GetDataTable();
 }