コード例 #1
0
ファイル: ClueWindow.cs プロジェクト: stonezhu870/iteam
        /// <summary>
        /// 添加线索
        /// </summary>
        /// <param name="clue">线索</param>
        public void AddClueToGrid(ClueInfo clue)
        {
            List <GridRow> rows     = m_gridClues.m_rows;
            int            rowsSize = rows.Count;

            for (int i = 0; i < rowsSize; i++)
            {
                GridRow findRow = rows[i];
                if (findRow.GetCell("colP1").GetString() == clue.m_ID)
                {
                    findRow.GetCell("colP2").SetString(clue.m_level);
                    findRow.GetCell("colP3").SetString(clue.m_title);
                    findRow.GetCell("colP4").SetString(clue.m_content);
                    findRow.GetCell("colP5").SetString(clue.m_createDate);
                    return;
                }
            }
            GridRow row = new GridRow();

            m_gridClues.AddRow(row);
            row.AddCell("colP1", new GridStringCell(clue.m_ID));
            row.AddCell("colP2", new GridStringCell(clue.m_level));
            row.AddCell("colP3", new GridStringCell(clue.m_title));
            row.AddCell("colP4", new GridStringCell(clue.m_content));
            row.AddCell("colP5", new GridStringCell(clue.m_createDate));
            List <GridCell> cells     = row.GetCells();
            int             cellsSize = cells.Count;

            for (int j = 1; j < cellsSize; j++)
            {
                cells[j].AllowEdit = true;
            }
        }
コード例 #2
0
ファイル: ClueWindow.cs プロジェクト: stonezhu870/iteam
 /// <summary>
 /// 单元格编辑结束事件
 /// </summary>
 /// <param name="sender">调用者</param>
 /// <param name="cell">单元格</param>
 private void GridCellEditEnd(object sender, GridCell cell)
 {
     if (cell != null)
     {
         ClueInfo clue      = DataCenter.ClueService.GetClue(cell.Row.GetCell("colP1").GetString());
         String   colName   = cell.Column.Name;
         String   cellValue = cell.GetString();
         if (colName == "colP2")
         {
             clue.m_level = cellValue;
         }
         else if (colName == "colP3")
         {
             clue.m_title = cellValue;
         }
         else if (colName == "colP4")
         {
             clue.m_content = cellValue;
         }
         else if (colName == "colP5")
         {
             clue.m_createDate = cellValue;
         }
         DataCenter.ClueService.Save(clue);
     }
 }
コード例 #3
0
ファイル: ClueWindow.cs プロジェクト: stonezhu870/iteam
        /// <summary>
        /// 添加
        /// </summary>
        public void Add()
        {
            ClueInfo clue = new ClueInfo();

            clue.m_ID = DataCenter.ClueService.GetNewID();
            DataCenter.ClueService.Save(clue);
            AddClueToGrid(clue);
            m_gridClues.Update();
            if (m_gridClues.VScrollBar != null)
            {
                m_gridClues.VScrollBar.ScrollToEnd();
            }
            m_gridClues.Invalidate();
        }
コード例 #4
0
ファイル: ClueWindow.cs プロジェクト: stonezhu870/iteam
        /// <summary>
        /// 绑定线索
        /// </summary>
        private void BindClues()
        {
            m_gridClues.CellEditMode = GridCellEditMode.DoubleClick;
            List <ClueInfo> clues        = DataCenter.ClueService.m_clues;
            int             opinionsSize = clues.Count;

            m_gridClues.ClearRows();
            m_gridClues.BeginUpdate();
            for (int i = 0; i < opinionsSize; i++)
            {
                ClueInfo clue = clues[i];
                AddClueToGrid(clue);
            }
            m_gridClues.EndUpdate();
            m_gridClues.Invalidate();
        }
コード例 #5
0
        /// <summary>
        /// 保存信息
        /// </summary>
        /// <param name="master">信息</param>
        public void Save(ClueInfo clue)
        {
            bool modify    = false;
            int  cluesSize = m_clues.Count;

            for (int i = 0; i < cluesSize; i++)
            {
                if (m_clues[i].m_ID == clue.m_ID)
                {
                    m_clues[i] = clue;
                    modify     = true;
                    break;
                }
            }
            if (!modify)
            {
                m_clues.Add(clue);
            }
            Save();
        }