Example #1
0
        /// <summary>
        /// 加载画面数据
        /// Created:2017.04.06(Xuxb)
        /// </summary>
        private void LoadPageData()
        {
            //日常工作取得
            DomainDLL.Trouble obj = troubleBLL.GetTroubleObject(TroubleId, _nodeID);
            if (!string.IsNullOrEmpty(obj.ID))
            {
                PNode parentNode = new WBSBLL().GetParentNode(obj.NodeID); //日常工作挂靠的节点
                //节点
                DataHelper.SetComboxTreeSelectByValue(cmbNode, parentNode.ID);
                TroubleId = obj.ID;
                _nodeID   = obj.NodeID;
                //问题名称
                txtTroubleName.Text = obj.Name;
                //问题描述
                txtTroubleDesc.Text = obj.Desc;
                //处理结果
                txtTroubleResult.Text = obj.HandleResult;
                //开始日期
                if (obj.StarteDate.HasValue)
                {
                    txtStartDate.Text = obj.StarteDate.Value.ToShortDateString();
                }
                //结束日期
                if (obj.EndDate.HasValue)
                {
                    txtEndDate.Text = obj.EndDate.Value.ToShortDateString();
                }
                //工作量
                intWorkload.Value = (int)obj.Workload;
                //加载责任人列表
                var list = troubleBLL.GetTroubleWorkList(obj.ID);
                gridManager.PrimaryGrid.DataSource = list;
                //问题级别
                DataHelper.SetComboBoxSelectItemByValue(cmbTroubleLevel, obj.Level.ToString());
                //处理情况
                DataHelper.SetComboBoxSelectItemByValue(cmbHandleStatus, obj.HandleStatus.ToString());
                //处理日期
                //if (obj.HandleDate.HasValue)
                //    txtHandleDate.Text = obj.HandleDate.Value.ToShortDateString();
                //添加日期
                txtCreated.Text = obj.CREATED.ToShortDateString();

                //附件列表加载
                LoadFileList(obj.ID.Substring(0, 36));
                LoadSpecFiles(obj.ID.Substring(0, 36));

                txtFilePath.Text = string.Empty;
                txtFileName.Text = string.Empty;
                txtFileDesc.Text = string.Empty;
            }
        }
Example #2
0
        /// <summary>
        /// 项目问题保存按钮按下时
        /// Created:2017.04.06(Xuxb)
        /// Updated:20170414(Xuxb)保存后刷新首页问题图表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            //保存前检查
            if (!TroubleCheck())
            {
                return;
            }

            List <TroubleWork> listWork = new List <TroubleWork>();

            if (!GetEditManager(ref listWork, true))
            {
                return;                                     //责任人如果填写无误
            }
            DomainDLL.Trouble obj = new DomainDLL.Trouble();

            #region 赋值
            //项目问题ID
            obj.ID = TroubleId;
            //NodeID
            //节点(如果关联结点未选择时,默认设定为项目结点)
            if (cmbNode.SelectedIndex < 0 || string.IsNullOrEmpty(cmbNode.SelectedNode.Name))
            {
                obj.NodeID = DataHelper.GetNodeIdByProjectId(ProjectId);
            }
            else
            {
                obj.NodeID = cmbNode.SelectedNode.Name.Substring(0, 36);
            }
            //问题名称
            obj.Name = txtTroubleName.Text;
            //问题描述
            obj.Desc = txtTroubleDesc.Text;
            //处理结果
            obj.HandleResult = txtTroubleResult.Text;
            //开始日期
            if (!string.IsNullOrEmpty(txtStartDate.Text))
            {
                obj.StarteDate = DateTime.Parse(txtStartDate.Text);
            }
            //结束日期
            if (!string.IsNullOrEmpty(txtEndDate.Text))
            {
                obj.EndDate = DateTime.Parse(txtEndDate.Text);
            }
            //工作量
            obj.Workload = intWorkload.Value;
            //状态
            obj.Status = 1;

            //问题级别
            if (cmbTroubleLevel.SelectedIndex > -1)
            {
                obj.Level = int.Parse(((ComboItem)cmbTroubleLevel.SelectedItem).Value.ToString());
            }
            //处理情况
            if (cmbHandleStatus.SelectedIndex > -1)
            {
                obj.HandleStatus = int.Parse(((ComboItem)cmbHandleStatus.SelectedItem).Value.ToString());
            }
            #endregion

            bool   IsEdit  = false;
            string oldPath = "";//旧的文件存放路径
            // 判断是否为修改状态 节点是否改变
            if (!string.IsNullOrEmpty(_nodeID))
            {
                IsEdit  = true;
                oldPath = FileHelper.GetWorkdir() + FileHelper.GetUploadPath(UploadType.Trouble, ProjectId, _nodeID);
            }

            //保存
            JsonResult result = troubleBLL.SaveTrouble(ProjectId, obj, listWork);
            MessageHelper.ShowRstMsg(result.result);
            if (result.result)
            {
                //一览重新加载
                Search();
                //清空当前编辑
                ClearTrouble();
                //主框更新
                MainFrame mainForm = (MainFrame)this.Parent.TopLevelControl;
                mainForm.RelaodTree();
                //重新加载首页的成果列表
                startPage.LoadProjectTrouble();
                startPage.LoadProjectTroubleList();
                #region  结点改变时,移动文件到新的节点
                if (IsEdit)
                {
                    FileHelper.MoveFloder(oldPath, FileHelper.GetWorkdir() + FileHelper.GetUploadPath(UploadType.Trouble, ProjectId, _nodeID));
                }
                #endregion
            }
        }