public void init(int[] taskStateArray, TaskGridShownStyle style)
        {
            this._taskStateArray = taskStateArray;
            this._style          = style;
            var classList         = CodeCache.getClass();
            var brandList         = CodeCache.getBrand();
            var modelList         = CodeCache.getModel();
            var taskList          = TaskCache.getCache();
            var tasklifecycleList = TaskLifecycleCache.getCache();
            var taskModelMapList  = TaskModelMapCache.getCache();

            taskModelAllList = (from task in taskList
                                from classCode in classList
                                from tasklifecycle in tasklifecycleList
                                                                                                                                                      //from brandCode in brandList
                                                                                                                                                      //from taskModelMap in taskModelMapList
                                                                                                                                                      //where (taskStateArray == (int)TaskStateEnum.Completed ?
                                                                                                                                                      //    (task.taskState == taskStateArray || task.taskState == (int)TaskStateEnum.Rejected || task.taskState == (int)TaskStateEnum.Closed)
                                                                                                                                                      //    : (task.taskState == taskStateArray))//如果是展示已完成任务,则需要附带已关闭、已驳回的任务
                                where taskStateArray.Contains(task.taskState) &&
                                task.taskClass == classCode.id                                                                                        //&& taskModelMap.taskId == task.id && taskModelMap.brandId == brandCode.id
                                                                                                                                                      //todo 跟当前用户相关
                                && task.id == tasklifecycle.taskId && tasklifecycle.taskState == 5001 &&
                                (task.taskExecutor.Contains(User.currentUser.name) || tasklifecycle.taskStateChangeExecutor == User.currentUser.name) //当前用户创建或测试人包含当前用户
                                orderby task.createTime descending
                                select new TaskModel
            {
                taskId = task.id,
                taskName = task.taskName,
                taskStateId = task.taskState,
                taskStateName = taskStateDic[task.taskState],
                taskBrandModelName = string.Join(Environment.NewLine, from brandCode in brandList
                                                 from modelCode in modelList
                                                 from taskModelMap in taskModelMapList
                                                 where taskModelMap.taskId == task.id && taskModelMap.brandId == brandCode.id && taskModelMap.ModelId == modelCode.id
                                                 select brandCode.codeName + "    " + modelCode.codeName),
                taskClassName = classCode.codeName,
                taskStartTime = task.createTime,
                taskCode = task.taskCode,
                percent = task.percent,
                taskRound = task.taskRound
            }).ToList();
            doQuery(new TaskQueryItem());
            showStyle(style);
        }
        public void showStyle(TaskGridShownStyle style)
        {
            switch (style)
            {
            case TaskGridShownStyle.HideAll:
                break;

            case TaskGridShownStyle.NewTask:
                //foreach (DataGridViewRow item in dgv_taskList.Rows)
                //{
                //    if (item.Cells[7].Value.ToString() == "未审批" )
                //    {
                //        item.Cells[11].Value = "";
                //        //dgv_taskList.Columns["btn_open"].Visible = false;
                //    }
                //    else
                //    {
                //        item.Cells[11].Value = "打开任务";
                //        //item.Cells[11].Visible = true;
                //    }
                //}
                dgv_taskList.Columns["btn_open"].Visible = true;
                //dgv_taskList.Rows
                //dgv_taskList.Columns["btn_open"].Visible = true;
                dgv_taskList.ReadOnly = true;
                break;

            case TaskGridShownStyle.RunningTask:
                dgv_taskList.Columns["btn_open"].Visible = true;
                break;

            case TaskGridShownStyle.DoneTask:
                break;

            case TaskGridShownStyle.CloseTask:
                break;

            default:
                break;
            }
        }
Exemplo n.º 3
0
 public void init(int[] taskStateIdArray, TaskGridShownStyle style)
 {
     taskGridPanel.OnDgvRowCountChange += TaskGridPanel_OnDgvRowCountChange;
     taskGridPanel.init(taskStateIdArray, style);
     taskQueryPanel.setTaskQuery(taskGridPanel);
 }