コード例 #1
0
 /// <summary>
 /// 交付物基本信息-更新
 /// Created:20170329(ChengMengjia)
 /// Updated:20170414(Xuxb)保存后刷新首页成果图表
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UpdateJBXX(List <DeliverablesWork> listWork)
 {
     //交付物节点的修改
     _jbxx.Name       = txtJFW.Text;
     _jbxx.StarteDate = dtStart.Value;
     _jbxx.EndDate    = dtEnd.Value;
     _jbxx.Workload   = intWorkload.Value;
     _jbxx.Desc       = txtDesc.Text;
     _jbxx.Weight     = sdWeight.Value;
     #region 检查
     if (string.IsNullOrEmpty(_jbxx.Name))
     {
         MessageHelper.ShowMsg(MessageID.W000000001, MessageType.Alert, "交付物名称");
         return;
     }
     #endregion
     JsonResult result = bll.UpdateJBXX(_jbxx, listWork);
     MessageBox.Show(result.msg);
     if (result.result)
     {
         CurrentNode.Name = _jbxx.Name;
         CurrentNode.ID   = result.data.ToString();
         txtNode.Text     = _jbxx.Name;
         FileHelper.WBSMoveFloder(UploadType.WBS, CurrentNode.ID);//迁移文件夹
         //主框更新
         MainFrame mainForm = (MainFrame)this.Parent.TopLevelControl;
         mainForm.RelaodTree();
         //重新加载首页的成果列表
         startPage.LoadProjectResult();
     }
     else
     {
         _jbxx = bll.GetJBXX(CurrentNode.ID);//恢复原有数据
     }
 }
コード例 #2
0
        /// <summary>
        /// 交付物基本信息-获得
        /// </summary>
        /// <returns></returns>
        public DeliverablesJBXX GetJBXX(string NodeID)
        {
            DeliverablesJBXX entity = new DeliverablesJBXX();

            NodeID = NodeID.Substring(0, 36);
            if (!string.IsNullOrEmpty(NodeID))
            {
                List <QueryField> qf = new List <QueryField>();
                qf.Add(new QueryField()
                {
                    Name = "NodeID", Comparison = QueryFieldComparison.like, Type = QueryFieldType.String, Value = NodeID
                });
                qf.Add(new QueryField()
                {
                    Name = "Status", Type = QueryFieldType.Numeric, Value = 1
                });
                SortField sf = new SortField()
                {
                    Name = "CREATED", Direction = SortDirection.Desc
                };
                List <DeliverablesJBXX> list = new Repository <DeliverablesJBXX>().GetList(qf, sf) as List <DeliverablesJBXX>;
                if (list.Count > 0)
                {
                    entity = list[0];
                }
            }
            return(entity);
        }
コード例 #3
0
ファイル: WBS.cs プロジェクト: xuxb2008/ProjectManage
        /// <summary>
        /// 交付物信息加载(作为当前节点信息展示)
        /// Created:20170401(ChengMengjia)
        /// Updated:20170526(ChengMengjia) 责任人变为列表加载
        /// </summary>
        void LoadJFW()
        {
            DevComponents.AdvTree.Node JFW_Node = advTree1.SelectedNode;
            panelNode.Enabled = false;

            _SelectJBXX = new WBSBLL().GetJBXX(_SelectNode.ID);

            //上方节点信息
            txtParent.Text = JFW_Node.Parent.Text;
            txtParent.Tag  = JFW_Node.Parent.Name;
            txtNode.Text   = _SelectJBXX.Name;
            txtNode.Tag    = _SelectJBXX.ID;

            //下方交付物基本信息
            txtJFWParent.Text = JFW_Node.Parent.Text;
            txtJFWParent.Tag  = JFW_Node.Parent.Name;
            txtJFW.Text       = _SelectJBXX.Name;
            txtDesc.Text      = _SelectJBXX.Desc;
            dtStart.Value     = (DateTime)_SelectJBXX.StarteDate;
            dtEnd.Value       = (DateTime)_SelectJBXX.EndDate;
            intWorkload.Value = int.Parse(_SelectJBXX.Workload.ToString());

            //责任人
            listWork = bll.GetManagerWorks(_SelectJBXX.ID);
            gridManager.PrimaryGrid.DataSource = listWork;
        }
コード例 #4
0
        /// <summary>
        /// 项目-模板导出
        /// Created:20170531(ChengMengjia)
        /// </summary>
        /// <param name="advTree1"></param>
        /// <param name="ProjectID"></param>
        private void SetSubTreeData(IList <PNode> listNode, PNode parent, ExcelHelper excel, ref int rowIndex)
        {
            string parentID = parent.ID.Substring(0, 36);
            IEnumerable <PNode> children = listNode.Where(t => t.ParentID == parentID).OrderBy(t => t.No);

            if (children.Count <PNode>() < 1)
            {
                return;
            }
            foreach (PNode child in children)
            {
                excel.SetCells(rowIndex, 1, child.WBSNo);
                excel.SetCells(rowIndex, 2, child.Name);
                if (child.PType == 1)//是交付物
                {
                    excel.SetCells(rowIndex, 3, "是");
                    DeliverablesJBXX jbxx = wbsBll.GetJBXX(child.ID);
                    excel.SetCells(rowIndex, 4, jbxx.StarteDate == null ? "" : ((DateTime)jbxx.StarteDate).ToString("yyyy年MM月dd日"));
                    excel.SetCells(rowIndex, 5, jbxx.EndDate == null ? "" : ((DateTime)jbxx.EndDate).ToString("yyyy年MM月dd日"));
                    excel.SetCells(rowIndex, 6, jbxx.Workload == null ? "" : ((int)jbxx.Workload).ToString());
                    excel.SetCells(rowIndex, 7, jbxx.Weight == null ? "" : ((int)jbxx.Weight).ToString());
                }
                else
                {
                    excel.SetCells(rowIndex, 3, "否");
                }
                rowIndex += 1;
                SetSubTreeData(listNode, child, excel, ref rowIndex);
            }
        }
コード例 #5
0
        /// <summary>
        /// 交付物节点的修改
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="hisFlg"></param>
        /// <param name="id"></param>
        public virtual void UpdatedDeliverables(DeliverablesJBXX new_jbxx, DeliverablesJBXX old_jbxx, PNode new_node, PNode old_node, List <DeliverablesWork> listWork)
        {
            ISession s = NHHelper.GetCurrentSession();

            try
            {
                s.BeginTransaction();
                s.Save(new_jbxx);
                s.Save(new_node);
                s.Update(old_jbxx);
                s.Update(old_node);
                if (listWork != null)
                {
                    s.CreateQuery("delete from DeliverablesWork where JBXXID='" + new_jbxx.ID.Substring(0, 36) + "';").ExecuteUpdate();
                    foreach (DeliverablesWork entity in listWork)
                    {
                        entity.ID      = Guid.NewGuid().ToString();
                        entity.CREATED = DateTime.Now;
                        entity.JBXXID  = new_jbxx.ID.Substring(0, 36);
                        entity.Manager = entity.Manager.Substring(0, 36);
                        entity.Status  = 1;
                        s.Save(entity);
                    }
                }
                UpdateProject(s);//更新项目时间
                s.Transaction.Commit();
                s.Close();
            }
            catch (Exception ex)
            {
                s.Transaction.Rollback();
                s.Close();
                throw new Exception("更新失败", ex);
            }
        }
コード例 #6
0
        /// <summary>
        /// 交付物节点的添加
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="hisFlg"></param>
        /// <param name="id"></param>
        public virtual void AddDeliverables(PNode node, DeliverablesJBXX jbxx, NodeProgress progress, List <DeliverablesWork> listWork)
        {
            ISession s = NHHelper.GetCurrentSession();

            try
            {
                s.BeginTransaction();
                s.Save(node);
                s.Save(jbxx);
                s.Save(progress);
                if (listWork != null)
                {
                    foreach (DeliverablesWork entity in listWork)
                    {
                        entity.ID      = Guid.NewGuid().ToString();
                        entity.Status  = 1;
                        entity.CREATED = DateTime.Now;
                        entity.JBXXID  = jbxx.ID.Substring(0, 36);
                        entity.Manager = entity.Manager.Substring(0, 36);
                        s.Save(entity);
                    }
                }
                UpdateProject(s);//更新项目时间
                s.Transaction.Commit();
                s.Close();
            }
            catch (Exception ex)
            {
                s.Transaction.Rollback();
                s.Close();
                throw new Exception("插入实体失败", ex);
            }
        }
コード例 #7
0
ファイル: WBS.cs プロジェクト: xuxb2008/ProjectManage
        /// <summary>
        /// 添加交付物基本信息
        ///  Created:20170401(ChengMengjia)
        /// </summary>
        void AddJFW(List <DeliverablesWork> listWork)
        {
            PNode node = new PNode()
            {
                PID      = ProjectId,
                Name     = txtJFW.Text,
                ParentID = txtJFWParent.Tag == null ? "" : txtJFWParent.Tag.ToString(),
                PType    = 1
            };
            DeliverablesJBXX entity = new DeliverablesJBXX()
            {
                ID      = "",
                EndDate = dtEnd.Value,
                // Manager = cbManager.SelectedItem == null ? "" : ((ComboItem)cbManager.SelectedItem).Value.ToString(),
                StarteDate = dtStart.Value,
                Workload   = intWorkload.Value,
                Weight     = sdWeight.Value,
                Name       = txtJFW.Text,
                Desc       = txtDesc.Text
            };

            #region 检查
            if (string.IsNullOrEmpty(node.PID))
            {
                MessageHelper.ShowMsg(MessageID.W000000002, MessageType.Alert, "项目");
                return;
            }
            if (string.IsNullOrEmpty(node.ParentID))
            {
                MessageHelper.ShowMsg(MessageID.W000000002, MessageType.Alert, "所属节点");
                return;
            }
            if (string.IsNullOrEmpty(entity.Name))
            {
                MessageHelper.ShowMsg(MessageID.W000000001, MessageType.Alert, "交付物名称");
                return;
            }
            #endregion

            JsonResult result = bll.AddJFWNode(node, entity, listWork);
            MessageBox.Show(result.msg);
            if (result.result)
            {
                ClearJFW();
                DataHelper.SetTreeDate(advTree1, ProjectId);              //绑定树形数据
                DataHelper.SetTreeSelectByValue(advTree1, node.ParentID); //遍历绑上原来的上级节点
                txtJFW.Focus();

                //主框更新
                MainFrame mainForm = (MainFrame)this.Parent.TopLevelControl;
                mainForm.RelaodTree();
                //重新加载首页的成果列表
                startPage.LoadProjectResult();
            }
        }
コード例 #8
0
ファイル: WBS.cs プロジェクト: xuxb2008/ProjectManage
 /// <summary>
 /// 上级节点选择后的触发事件
 /// Created:20170324(ChengMengjia)
 /// Updated:20170329(ChengMengjia) 增加判断是否里程碑、交付物,是即不能进行交付物添加
 /// Updated:20170329(ChengMengjia) lixx提出交付物节点可以编辑修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ParentSelect(object sender, DevComponents.AdvTree.AdvTreeNodeEventArgs e)
 {
     _SelectNode = JsonHelper.StringToEntity <PNode>(e.Node.Tag.ToString());
     _SelectJBXX = new DeliverablesJBXX();
     if (_SelectNode.PType == 1)
     {
         LoadJFW();
     }
     else
     {
         LoadNode();
     }
 }
コード例 #9
0
 /// <summary>
 /// 交付物基本信息-加载
 /// Created:20170329(ChengMengjia)
 /// Updated:20170526(ChengMengjia) 责任人变为列表加载
 /// </summary>
 private void LoadJBXX()
 {
     _jbxx             = bll.GetJBXX(CurrentNode.ID);
     txtNode2.Text     = bll.GetNode(CurrentNode.ParentID).Name;
     txtNode2.Tag      = _jbxx.ID;
     txtJFW.Text       = _jbxx.Name;
     dtStart.Value     = _jbxx.StarteDate == null ? DateTime.Now : (DateTime)_jbxx.StarteDate;
     dtEnd.Value       = _jbxx.EndDate == null ? DateTime.Now : (DateTime)_jbxx.EndDate;
     intWorkload.Value = _jbxx.Workload == null ? 1 : (int)_jbxx.Workload;
     txtDesc.Text      = _jbxx.Desc;
     //责任人
     listWork = bll.GetManagerWorks(_jbxx.ID);
     gridManager.PrimaryGrid.DataSource = listWork;
 }
コード例 #10
0
        /// <summary>
        /// 交付物基本信息-新增
        /// Created:20170329(ChengMengjia)
        /// Updated:20170414(Xuxb)保存后刷新首页成果图表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddJBXX(List <DeliverablesWork> listWork)
        {
            //新增交付物节点
            PNode node = new PNode()
            {
                PID      = ProjectId,
                Name     = txtJFW.Text,
                ParentID = CurrentNode.ID,
                PType    = 1
            };
            DeliverablesJBXX entity = new DeliverablesJBXX()
            {
                Name       = txtJFW.Text,
                StarteDate = dtStart.Value,
                EndDate    = dtEnd.Value,
                Workload   = intWorkload.Value,
                Weight     = sdWeight.Value
            };

            #region 检查
            if (string.IsNullOrEmpty(node.PID))
            {
                MessageHelper.ShowMsg(MessageID.W000000002, MessageType.Alert, "项目");
                return;
            }
            if (string.IsNullOrEmpty(node.ParentID))
            {
                MessageHelper.ShowMsg(MessageID.W000000002, MessageType.Alert, "所属节点");
                return;
            }
            if (string.IsNullOrEmpty(entity.Name))
            {
                MessageHelper.ShowMsg(MessageID.W000000001, MessageType.Alert, "交付物名称");
                return;
            }
            #endregion

            JsonResult result = new WBSBLL().AddJFWNode(node, entity, listWork);
            MessageBox.Show(result.msg);
            if (result.result)
            {
                ClearJBXX();
                //主框更新
                MainFrame mainForm = (MainFrame)this.Parent.TopLevelControl;
                mainForm.RelaodTree();
                //重新加载首页的成果列表
                startPage.LoadProjectResult();
            }
        }
コード例 #11
0
        /// <summary>
        /// 保存
        /// Created:20170406(ChengMengjia)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            string Name = txtNewName.Text;

            if (string.IsNullOrEmpty(Name))
            {
                MessageHelper.ShowMsg(MessageID.W000000001, MessageType.Alert, "新名称");
                txtNewName.Focus();
                return;
            }
            else if (_node.Name.Equals(Name))
            {
                MessageBox.Show("新名称和原名称一样!");
                txtNewName.Focus();
                return;
            }
            _node.Name = Name;
            JsonResult result;

            if (_node.PType == 1)
            {
                //如果为交付物节点
                DeliverablesJBXX jbxx = bll.GetJBXX(_node.ID);
                jbxx.Name = Name;
                result    = bll.UpdateJBXX(jbxx, null);
            }
            else
            {
                result = bll.SaveNode(_node);
            }
            if (result.result)
            {
                FileHelper.WBSMoveFloder(UploadType.WBS, result.data.ToString());//迁移文件夹
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageHelper.ShowRstMsg(false);
            }
        }
コード例 #12
0
ファイル: WBS.cs プロジェクト: xuxb2008/ProjectManage
        /// <summary>
        /// 更新交付物基本信息
        ///  Created:20170401(ChengMengjia)
        /// </summary>
        void UpdateJFW(List <DeliverablesWork> listWork)
        {
            string jbxxid = _SelectJBXX.ID;

            _SelectJBXX.EndDate    = dtEnd.Value;
            _SelectJBXX.StarteDate = dtStart.Value;
            _SelectJBXX.Workload   = intWorkload.Value;
            _SelectJBXX.Name       = txtJFW.Text;
            _SelectJBXX.Desc       = txtDesc.Text;
            _SelectJBXX.Weight     = sdWeight.Value;
            #region 检查
            if (string.IsNullOrEmpty(_SelectJBXX.Name))
            {
                MessageHelper.ShowMsg(MessageID.W000000001, MessageType.Alert, "交付物名称");
                return;
            }
            #endregion
            JsonResult result = bll.UpdateJBXX(_SelectJBXX, listWork);
            MessageBox.Show(result.msg);
            if (result.result)
            {
                _SelectNode.Name           = _SelectJBXX.Name;
                _SelectNode.ID             = result.data.ToString();
                txtNode.Text               = _SelectNode.Name;
                advTree1.SelectedNode.Text = _SelectNode.WBSNo + "-" + _SelectNode.Name;
                advTree1.SelectedNode.Name = _SelectNode.ID;
                advTree1.SelectedNode.Tag  = JsonHelper.EntityToString <PNode>(_SelectNode);
                FileHelper.WBSMoveFloder(UploadType.WBS, _SelectNode.ID);//迁移文件夹

                //主框更新
                MainFrame mainForm = (MainFrame)this.Parent.TopLevelControl;
                mainForm.RelaodTree();
                //重新加载首页的成果列表
                startPage.LoadProjectResult();
            }
            else
            {
                _SelectJBXX = bll.GetJBXX(jbxxid);
            }
        }
コード例 #13
0
        /// <summary>
        /// WBS交付物节点新增保存
        /// Created:2017.3.29(ChengMengjia)
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public JsonResult AddJFWNode(PNode node, DeliverablesJBXX jbxx, List <DeliverablesWork> list)
        {
            JsonResult jsonreslut = new JsonResult();

            try
            {
                node.ID       = Guid.NewGuid().ToString() + "-1";
                node.ParentID = node.ParentID.Substring(0, 36);
                node.No       = GetChildren(node.ParentID).Count() + 1;
                node.WBSNo    = GetWBSNo(node.ParentID) + node.No.ToString();
                node.Status   = 1;
                node.CREATED  = DateTime.Now;

                jbxx.ID      = Guid.NewGuid().ToString() + "-1";
                jbxx.NodeID  = node.ID.Substring(0, 36);
                jbxx.Status  = 1;
                jbxx.CREATED = DateTime.Now;

                NodeProgress entity = new NodeProgress()
                {
                    ID      = Guid.NewGuid().ToString() + "-1",
                    NodeID  = jbxx.NodeID,
                    PType   = 1,
                    Status  = 1,
                    CREATED = DateTime.Now
                };

                dao.AddDeliverables(node, jbxx, entity, list);
                jsonreslut.result = true;
                jsonreslut.msg    = "保存成功!";
            }
            catch (Exception ex)
            {
                LogHelper.WriteException(ex, LogType.BussinessDLL);
                jsonreslut.result = false;
                jsonreslut.msg    = ex.Message;
            }
            return(jsonreslut);
        }
コード例 #14
0
        /// <summary>
        /// 交付物基本信息更新
        ///  Created:20170330(ChengMengjia)
        /// </summary>
        /// <param name="new_jbxx"></param>
        /// <returns></returns>
        public JsonResult UpdateJBXX(DeliverablesJBXX new_jbxx, List <DeliverablesWork> listWorkx)
        {
            JsonResult jsonreslut = new JsonResult();

            try
            {
                #region jbxx
                DeliverablesJBXX old_jbxx = new Repository <DeliverablesJBXX>().Get(new_jbxx.ID);
                new_jbxx.ID      = new_jbxx.ID.Substring(0, 36) + "-" + (int.Parse(new_jbxx.ID.Substring(37)) + 1).ToString();
                new_jbxx.NodeID  = new_jbxx.NodeID.Substring(0, 36);
                new_jbxx.Status  = 1;
                new_jbxx.CREATED = DateTime.Now;
                old_jbxx.Status  = 0;
                old_jbxx.UPDATED = DateTime.Now;
                #endregion
                #region pnode
                PNode new_node = GetNode(new_jbxx.NodeID);
                PNode old_node = GetNode(new_jbxx.NodeID);
                new_node.Name    = new_jbxx.Name;
                new_node.Status  = 1;
                new_node.CREATED = DateTime.Now;
                new_node.ID      = new_node.ID.Substring(0, 36) + "-" + (int.Parse(new_node.ID.Substring(37)) + 1).ToString();
                old_node.Status  = 0;
                old_node.UPDATED = DateTime.Now;
                #endregion
                dao.UpdatedDeliverables(new_jbxx, old_jbxx, new_node, old_node, listWorkx);
                jsonreslut.data   = new_node.ID;
                jsonreslut.result = true;
                jsonreslut.msg    = "保存成功!";
            }
            catch (Exception ex)
            {
                LogHelper.WriteException(ex, LogType.BussinessDLL);
                jsonreslut.result = false;
                jsonreslut.msg    = ex.Message;
            }
            return(jsonreslut);
        }