Beispiel #1
0
        /// <summary>
        /// 添加信息
        /// </summary>
        /// <param name="follow">关注</param>
        public void AddFollowToGrid(FollowInfo follow)
        {
            List <GridRow> rows     = m_gridFollows.m_rows;
            int            rowsSize = rows.Count;

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

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

            for (int j = 1; j < cellsSize; j++)
            {
                cells[j].AllowEdit = true;
            }
        }
Beispiel #2
0
 /// <summary>
 /// 单元格编辑结束事件
 /// </summary>
 /// <param name="sender">调用者</param>
 /// <param name="cell">单元格</param>
 private void GridCellEditEnd(object sender, GridCell cell)
 {
     if (cell != null)
     {
         FollowInfo follow    = DataCenter.FollowService.GetFollow(cell.Row.GetCell("colP1").GetString());
         String     colName   = cell.Column.Name;
         String     cellValue = cell.GetString();
         if (colName == "colP2")
         {
             follow.m_level = cellValue;
         }
         else if (colName == "colP3")
         {
             follow.m_title = cellValue;
         }
         else if (colName == "colP4")
         {
             follow.m_content = cellValue;
         }
         else if (colName == "colP5")
         {
             follow.m_createDate = cellValue;
         }
         DataCenter.FollowService.Save(follow);
     }
 }
Beispiel #3
0
        /// <summary>
        /// 添加
        /// </summary>
        public void Add()
        {
            FollowInfo follow = new FollowInfo();

            follow.m_ID = DataCenter.FollowService.GetNewID();
            DataCenter.FollowService.Save(follow);
            AddFollowToGrid(follow);
            m_gridFollows.Update();
            if (m_gridFollows.VScrollBar != null)
            {
                m_gridFollows.VScrollBar.ScrollToEnd();
            }
            m_gridFollows.Invalidate();
        }
Beispiel #4
0
        /// <summary>
        /// 绑定指示
        /// </summary>
        private void BindFollows()
        {
            m_gridFollows.CellEditMode = GridCellEditMode.DoubleClick;
            List <FollowInfo> follows = DataCenter.FollowService.m_follows;
            int followsSize           = follows.Count;

            m_gridFollows.ClearRows();
            m_gridFollows.BeginUpdate();
            for (int i = 0; i < followsSize; i++)
            {
                FollowInfo follow = follows[i];
                AddFollowToGrid(follow);
            }
            m_gridFollows.EndUpdate();
            m_gridFollows.Invalidate();
        }
Beispiel #5
0
        /// <summary>
        /// 保存信息
        /// </summary>
        /// <param name="master">信息</param>
        public void Save(FollowInfo follow)
        {
            bool modify      = false;
            int  followsSize = m_follows.Count;

            for (int i = 0; i < followsSize; i++)
            {
                if (m_follows[i].m_ID == follow.m_ID)
                {
                    m_follows[i] = follow;
                    modify       = true;
                    break;
                }
            }
            if (!modify)
            {
                m_follows.Add(follow);
            }
            Save();
        }