Beispiel #1
0
        private void EditProject()
        {
            var rows = this.skinDataGridView_projects.SelectedRows;

            if (rows == null || rows.Count == 0)
            {
                return;
            }
            var row = rows[0];

            if (row != null && row.Tag != null)
            {
                FrmUserProject frm = new FrmUserProject((Model.UserProjectModel)row.Tag);
                if (frm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    if (modifyOrAddItem == null)
                    {
                        return;
                    }
                    //修改工程
                    //foreach (DataGridViewRow item in this.skinDataGridView_projects.Rows)
                    //{
                    //    if (item.Cells[0].Value!= null && item.Cells[0].Value.ToString() == modifyOrAddItem.ID.ToString())
                    //    {
                    DataGridViewRow gridRow = row;
                    gridRow.Cells[0].Value = modifyOrAddItem.ID;
                    gridRow.Cells[1].Value = modifyOrAddItem.ProjectName;
                    gridRow.Cells[2].Value = modifyOrAddItem.MonitoringSoftwareName;
                    gridRow.Cells[3].Value = modifyOrAddItem.MonitoringPath;
                    gridRow.Tag            = modifyOrAddItem;
                    //    }
                    //}
                }
            }
        }
Beispiel #2
0
        private void AddProject()
        {
            FrmUserProject frm = new FrmUserProject(null);

            if (frm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                if (modifyOrAddItem == null)
                {
                    return;
                }
                //新增工程
                int             index   = this.skinDataGridView_projects.Rows.Add(1);
                DataGridViewRow gridRow = this.skinDataGridView_projects.Rows[index];
                gridRow.Cells[0].Value = modifyOrAddItem.ID;
                gridRow.Cells[1].Value = modifyOrAddItem.ProjectName;
                gridRow.Cells[2].Value = modifyOrAddItem.MonitoringSoftwareName;
                gridRow.Cells[3].Value = modifyOrAddItem.MonitoringPath;
                gridRow.Tag            = modifyOrAddItem;
            }
        }