Beispiel #1
0
        /// <summary>
        /// 添加线索
        /// </summary>
        /// <param name="opinion">线索</param>
        public void AddOpinionToGrid(OpinionInfo opinion)
        {
            List <GridRow> rows     = m_gridOpinions.m_rows;
            int            rowsSize = rows.Count;

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

            m_gridOpinions.AddRow(row);
            row.AddCell("colP1", new GridStringCell(opinion.m_ID));
            row.AddCell("colP2", new GridStringCell(opinion.m_level));
            row.AddCell("colP3", new GridStringCell(opinion.m_title));
            row.AddCell("colP4", new GridStringCell(opinion.m_content));
            row.AddCell("colP5", new GridStringCell(opinion.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)
     {
         OpinionInfo opinion   = DataCenter.OpinionService.GetOpinion(cell.Row.GetCell("colP1").GetString());
         String      colName   = cell.Column.Name;
         String      cellValue = cell.GetString();
         if (colName == "colP2")
         {
             opinion.m_level = cellValue;
         }
         else if (colName == "colP3")
         {
             opinion.m_title = cellValue;
         }
         else if (colName == "colP4")
         {
             opinion.m_content = cellValue;
         }
         else if (colName == "colP5")
         {
             opinion.m_createDate = cellValue;
         }
         DataCenter.OpinionService.Save(opinion);
     }
 }
Beispiel #3
0
        /// <summary>
        /// 添加
        /// </summary>
        public void Add()
        {
            OpinionInfo opinion = new OpinionInfo();

            opinion.m_ID = DataCenter.OpinionService.GetNewID();
            DataCenter.OpinionService.Save(opinion);
            AddOpinionToGrid(opinion);
            m_gridOpinions.Update();
            if (m_gridOpinions.VScrollBar != null)
            {
                m_gridOpinions.VScrollBar.ScrollToEnd();
            }
            m_gridOpinions.Invalidate();
        }
Beispiel #4
0
        /// <summary>
        /// 绑定线索
        /// </summary>
        private void BindClues()
        {
            m_gridOpinions.CellEditMode = GridCellEditMode.DoubleClick;
            List <OpinionInfo> clues = DataCenter.OpinionService.m_opinions;
            int opinionsSize         = clues.Count;

            m_gridOpinions.ClearRows();
            m_gridOpinions.BeginUpdate();
            for (int i = 0; i < opinionsSize; i++)
            {
                OpinionInfo opinion = clues[i];
                AddOpinionToGrid(opinion);
            }
            m_gridOpinions.EndUpdate();
            m_gridOpinions.Invalidate();
        }
Beispiel #5
0
        /// <summary>
        /// 保存信息
        /// </summary>
        /// <param name="opinion">信息</param>
        public void Save(OpinionInfo opinion)
        {
            bool modify       = false;
            int  opinionsSize = m_opinions.Count;

            for (int i = 0; i < opinionsSize; i++)
            {
                if (m_opinions[i].m_ID == opinion.m_ID)
                {
                    m_opinions[i] = opinion;
                    modify        = true;
                    break;
                }
            }
            if (!modify)
            {
                m_opinions.Add(opinion);
            }
            Save();
        }