Exemplo n.º 1
0
 /// <summary>
 /// 添加责任人
 /// Created:20170531(zhugaunjun)
 /// Updated:20170606(ChengMengjia)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddManager_Click(object sender, EventArgs e)
 {
     #region 计算剩余工作量
     int tmp = intWorkload.Value;//工作量
     List <DevComponents.DotNetBar.SuperGrid.GridElement> listManager = gridManager.PrimaryGrid.Rows.ToList();
     foreach (DevComponents.DotNetBar.SuperGrid.GridElement row in listManager)
     {
         string s = row.ToString();
         s = s.Substring(s.LastIndexOf("{") + 1);
         s = s.Substring(0, s.LastIndexOf("}"));
         string[] cells = s.Trim().Split(',');
         tmp = tmp - int.Parse(cells[2]);
     }
     #endregion
     ProjectManagement.Forms.WBS.NewManager fmNewManager = new Forms.WBS.NewManager("", tmp < 0 ? 0 : tmp, tmp < 0 ? 0 : tmp);
     if (fmNewManager.ShowDialog() == DialogResult.OK)
     {
         List <RoutineWork> listWork = new List <RoutineWork>();
         GetEditManager(ref listWork, false);
         bool IsExist = false;//是否列表中存在该责任人
         #region 查找该责任人 存在即修改
         foreach (var t in listWork)
         {
             if (t.Manager.Equals(fmNewManager.ReturnValue.Manager.Substring(0, 36)))
             {
                 IsExist           = true;
                 t.ManagerName     = fmNewManager.ReturnValue.ManagerName;
                 t.Workload       += fmNewManager.ReturnValue.Workload;
                 t.ActualWorkload += fmNewManager.ReturnValue.ActualWorkload;
                 break;
             }
         }
         #endregion
         #region  存在即新增
         if (!IsExist)
         {
             listWork.Add(new RoutineWork()
             {
                 Manager        = fmNewManager.ReturnValue.Manager.Substring(0, 36),
                 ManagerName    = fmNewManager.ReturnValue.ManagerName,
                 Workload       = fmNewManager.ReturnValue.Workload,
                 ActualWorkload = fmNewManager.ReturnValue.ActualWorkload
             });
         }
         #endregion
         gridManager.PrimaryGrid.DataSource = listWork;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 责任人双击-修改
        ///  Created:20170527(ChengMengjia)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridManager_RowDoubleClick(object sender, DevComponents.DotNetBar.SuperGrid.GridRowDoubleClickEventArgs e)
        {
            string tmp = e.GridRow.ToString();

            tmp = tmp.Substring(tmp.LastIndexOf("{") + 1);
            tmp = tmp.Substring(0, tmp.LastIndexOf("}"));
            string[] cells = tmp.Trim().Split(',');
            ProjectManagement.Forms.WBS.NewManager fmNewManager = new Forms.WBS.NewManager(cells[0], int.Parse(cells[2]), int.Parse(cells[3]));
            if (fmNewManager.ShowDialog() == DialogResult.OK)
            {
                gridManager.PrimaryGrid.GetCell(e.GridRow.RowIndex, 0).Value = fmNewManager.ReturnValue.Manager;
                gridManager.PrimaryGrid.GetCell(e.GridRow.RowIndex, 1).Value = fmNewManager.ReturnValue.ManagerName;
                gridManager.PrimaryGrid.GetCell(e.GridRow.RowIndex, 2).Value = fmNewManager.ReturnValue.Workload;
                gridManager.PrimaryGrid.GetCell(e.GridRow.RowIndex, 3).Value = fmNewManager.ReturnValue.ActualWorkload;
                GetEditManager(false);
            }
        }