private void tsbDel_Click(object sender, EventArgs e) { if (lvPjnd.SelectedItems.Count <= 0) { return; } List <string> lstPjnd = GetLstPjnd(); if (WinPublicMethods.AskQuestion(this, "是否删除评价年度 " + PublicMethods.GetStringByLstString(lstPjnd) + "及其相关数据?")) { foreach (string item in lstPjnd) { DelPJND(item); } //MyMethod.ShowMessage(this, "删除评价年度成功,同时删除相关数据:" + DelCount.ToString() + "条。"); for (int i = lvPjnd.SelectedItems.Count - 1; i >= 0; i--) { lvPjnd.SelectedItems[i].Remove(); } isModify = true; } }
private void tsbDelPjnd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tstPjnd.Text)) { WinPublicMethods.WarnMessageBox(this, "指定的评价年度为空无法清除!"); return; } string pjnd = tstPjnd.Text.Trim(); if (WinPublicMethods.AskQuestion(this, "是否删除评价年度 " + pjnd + " 及其相关数据?")) { DelPJND(pjnd); isModify = true; } }
public static bool DataGridViewPaste(DataGridView dgv, DataGridViewCellEventHandler dgv_CellValueChanged, out int rowsCount, out int columnsCount) { rowsCount = columnsCount = 0; //粘贴赋值 dgv.CellValueChanged -= dgv_CellValueChanged; //string errMessage = MyMethod.PasterToDataGridView(dgv, dgv.AllowUserToAddRows, ref rowsCount, ref columnsCount); //string errMessage = MyMethod.PasterToDataGridView(dgv, false, ref rowsCount, ref columnsCount); MyMethod.PasterToDataGridView(dgv, true); //再绑定单元格值改变事件 dgv.CellValueChanged += dgv_CellValueChanged; if (string.IsNullOrEmpty(errMessage) == false) { WinPublicMethods.WarnMessageBox(errMessage); return(false); } return(true); }
/// <summary> /// 加载数据 /// </summary> /// <param name="lstDictionary">目录队列</param> /// <param name="lstChildData">实体数据</param> /// <param name="isGroup">是否分组</param> public void LoadData(List <IEntityData> lstDictionary, List <IEntityData> lstChildData, bool isGroup) { try { navigationPanel.Init(lstDictionary); } catch (Exception ex) { PublicMethods.WarnMessageBox("加载导航异常:" + ex.Message); } try { if (isGroup) { //每个资产使用 if (unitGroupPanel.Visible == false) { freeLayoutPanel.Visible = false; unitGroupPanel.Visible = true; unitGroupPanel.Dock = DockStyle.Fill; unitGroupPanel.Init(lstChildData); } } else { //项目队列使用 unitGroupPanel.Visible = false; freeLayoutPanel.Visible = true; freeLayoutPanel.Dock = DockStyle.Fill; freeLayoutPanel.InitInterface(lstChildData, IconLayoutType.LeftWordRightImage, false); } } catch (Exception ex) { WinPublicMethods.WarnMessageBox("加载面板异常:" + ex.Message); } }
void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { WinPublicMethods.WarnMessageBox(this, "异常:" + e.Error.Message); return; } lvPjnd.BeginUpdate(); lvPjnd.Items.Clear(); foreach (DataRow dr in dtOptions.Rows) { ListViewItem lvi = AddListViewItem(dr); if (lvi.Text == this.curPjnd) { lvi.ForeColor = Color.Blue; } } lvPjnd.EndUpdate(); }