Ejemplo n.º 1
0
        /// <summary>
        /// 加载日常工作内容
        /// Created:20170606(ChengMengjia)
        /// </summary>
        private void LoadContent()
        {
            DomainDLL.Routine obj        = routineBLL.GetRoutineObject(WorkId, _nodeID);
            PNode             parentNode = new WBSBLL().GetParentNode(obj.NodeID); //日常工作挂靠的节点

            DataHelper.SetComboxTreeSelectByValue(cmbNode, parentNode.ID);
            _nodeID          = obj.NodeID;
            WorkId           = obj.ID;
            txtWorkName.Text = obj.Name;
            txtDesc.Text     = obj.Desc;       //工作描述
            txtResult.Text   = obj.DealResult; //处理结果
            if (obj.StartDate.HasValue)        //开始日期
            {
                txtStartDate.Text = obj.StartDate.Value.ToShortDateString();
            }
            if (obj.EndDate.HasValue)//结束日期
            {
                txtEndDate.Text = obj.EndDate.Value.ToShortDateString();
            }
            DataHelper.SetComboBoxSelectItemByValue(cmbResultStatus, obj.FinishStatus.ToString()); //完成情况
            txtCreateDate.Text = obj.CREATED.ToShortDateString();                                  //添加日期
            intWorkload.Value  = (int)obj.Workload;                                                //工作量

            //加载责任人列表
            var list = routineBLL.GetRoutinWorkList(obj.ID);

            gridManager.PrimaryGrid.DataSource = list;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 文件保存时
        /// Created:2017.03.31(Xuxb)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFileSave_Click(object sender, EventArgs e)
        {
            //保存前检查
            if (!FileCheck())
            {
                return;
            }

            RoutineFiles file = new RoutineFiles();

            //文件ID
            file.ID = _fileId;
            //日常工作ID
            file.RoutineID = WorkId.Substring(0, 36);
            //文件路径
            file.Name = txtFileName.Text;
            //文件描述
            file.Desc = txtFileDesc.Text;

            DomainDLL.Routine routine = routineBLL.GetRoutineObject(WorkId, "");//需要获取日常工作作为节点的ID

            //上传文件名
            if (_fileSelectFlg)
            {
                file.Path = FileHelper.UploadFile(txtFilePath.Text, UploadType.Routine, ProjectId, routine.NodeID);
            }
            else
            {
                file.Path = _filePath;
            }

            //如果返回文件名为空,不保存数据库
            if (string.IsNullOrEmpty(file.Path))
            {
                return;
            }

            //保存
            JsonResult result = routineBLL.SaveRoutineFile(file);

            _fileId = result.result ? (string)result.data : _fileId;
            if (result.result)
            {
                //附件列表加载
                LoadFileList();
            }
            MessageHelper.ShowRstMsg(result.result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 日常工作保存时
        /// Created:2017.03.31(Xuxb)
        /// Updated:20170414(Xuxb)保存后刷新首页问题列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnWorkSave_Click(object sender, EventArgs e)
        {
            #region 保存前检查
            //项目ID是否存在
            if (string.IsNullOrEmpty(ProjectId))
            {
                MessageHelper.ShowMsg(MessageID.W000000002, MessageType.Alert, "项目");
                return;
            }
            //结点是否选择
            //if (string.IsNullOrEmpty(cmbNode.SelectedNode.Name))
            //{
            //    MessageHelper.ShowMsg(MessageID.W000000002, MessageType.Alert, "结点");
            //    return
            //}
            //工作名称是否输入
            if (string.IsNullOrEmpty(txtWorkName.Text))
            {
                MessageHelper.ShowMsg(MessageID.W000000001, MessageType.Alert, "工作名称");
                return;
            }
            //完成情况是否选择
            if (cmbResultStatus.SelectedItem != null && string.IsNullOrEmpty(((ComboItem)cmbResultStatus.SelectedItem).Value.ToString()))
            {
                MessageHelper.ShowMsg(MessageID.W000000002, MessageType.Alert, "完成情况");
                return;
            }
            #endregion
            List <RoutineWork> listWork = new List <RoutineWork>();
            if (!GetEditManager(ref listWork, true))
            {
                return;                                     //如果填写无误
            }
            DomainDLL.Routine obj = new DomainDLL.Routine();
            obj.ID = WorkId;//日常工作ID
            #region 赋值
            //节点(如果关联结点未选择时,默认设定为项目结点)
            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 = txtWorkName.Text;
            //工作描述
            obj.Desc = txtDesc.Text;
            //处理结果
            obj.DealResult = txtResult.Text;
            //预期工作量
            obj.Workload = intWorkload.Value;
            //开始日期
            if (!string.IsNullOrEmpty(txtStartDate.Text))
            {
                obj.StartDate = DateTime.Parse(txtStartDate.Text);
            }
            //结束日期
            if (!string.IsNullOrEmpty(txtEndDate.Text))
            {
                obj.EndDate = DateTime.Parse(txtEndDate.Text);
            }
            //完成情况
            if (cmbResultStatus.SelectedIndex > -1)
            {
                obj.FinishStatus = int.Parse(((ComboItem)cmbResultStatus.SelectedItem).Value.ToString());
            }
            #endregion

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

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