private void btnAdd_Click(object sender, EventArgs e) { ManagementSpecialtyPropertyInput item = new ManagementSpecialtyPropertyInput(); item.标识 = Guid.NewGuid(); item.届别 = division; item.序号 = gridView1.RowCount + 1; specialty_property_list.Add(item); gridControl1.RefreshDataSource(); gridView1.FocusedRowHandle = gridView1.RowCount - 1; }
private void gridView1_CellValueChanged(object sender, CellValueChangedEventArgs e) { if (e.Column.FieldName == "岗位级别" || e.Column.FieldName == "学历" || e.Column.FieldName == "属性" || e.Column.FieldName == "专业名称") { ManagementSpecialtyPropertyInput row = gridView1.GetRow(gridView1.FocusedRowHandle) as ManagementSpecialtyPropertyInput; if (row != null) { row.已确认 = false; gridControl1.RefreshDataSource(); gridControl1.Refresh(); } } }
private void btnDelete_Click(object sender, EventArgs e) { ColumnView colView = (ColumnView)gridControl1.MainView; if (colView != null) { if (MessageBox.Show("确实删除当前记录吗?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes) { ManagementSpecialtyPropertyInput currentManagementSpecialtyPropertyInput = (ManagementSpecialtyPropertyInput)colView.GetFocusedRow(); if (currentManagementSpecialtyPropertyInput != null) { specialty_property_list.Remove(currentManagementSpecialtyPropertyInput); currentManagementSpecialtyPropertyInput.Delete(); gridControl1.RefreshDataSource(); MessageBox.Show("删除成功。", "删除提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void repositoryItemConfirmButton_ButtonClick(object sender, ButtonPressedEventArgs e) { ManagementSpecialtyPropertyInput row = gridView1.GetRow(gridView1.FocusedRowHandle) as ManagementSpecialtyPropertyInput; if (row != null) { //如果专业是有效的 if (CheckSpecialtyValid(row)) { row.已确认 = true; gridControl1.RefreshDataSource(); gridControl1.Refresh(); } else //否则 { MessageBox.Show("确认失败:录入的专业名称无效。"); } } }
protected void LoadData(bool compare) { CreateWaitDialog("正在查询...", "请稍等"); specialty_property_list = ManagementSpecialtyPropertyInput.GetEditingRows(division, isCheck); //如果比较 if (compare) { specialty_property_list_opposite = ManagementSpecialtyPropertyInput.GetEditingRows(this.division, !isCheck); } SetWaitDialogCaption("正在加载..."); gridControl1.DataSource = specialty_property_list; gridControl1.RefreshDataSource(); CloseWaitDialog(); showDifferent = compare; }
private void gridView1_FocusedColumnChanged(object sender, FocusedColumnChangedEventArgs e) { GridColumn col = e.FocusedColumn; if (col == null) { return; } if (col.FieldName == "岗位级别" || col.FieldName == "学历" || col.FieldName == "专业名称") { ManagementSpecialtyPropertyInput row = gridView1.GetRow(gridView1.FocusedRowHandle) as ManagementSpecialtyPropertyInput; if (row != null) { col.OptionsColumn.AllowEdit = MyHelper.XpoSession.IsNewObject(row); } } }
private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) { if (showDifferent == false) { return; } e.Appearance.ForeColor = Color.Black; e.Appearance.BackColor = Color.Transparent; ManagementSpecialtyPropertyInput row = gridView1.GetRow(e.RowHandle) as ManagementSpecialtyPropertyInput; if (row != null) { foreach (ModifyField field in row.内容不同的字段) { if (field.称 == e.Column.FieldName) { e.Appearance.ForeColor = Color.Yellow; e.Appearance.BackColor = Color.Red; } } } }
private bool CheckSpecialtyValid(ManagementSpecialtyPropertyInput row) { TraineeInfo item = traineeList.Find(a => a.岗位级别 == row.岗位级别 && a.学历 == row.学历 && a.学习专业 == row.专业名称); return(item != null); }