// 修改一个事项 private void toolStripButton_modifyItem_Click(object sender, EventArgs e) { string strError = ""; if (this.listView_list.SelectedItems.Count == 0) { strError = "尚未选定要修改的事项"; goto ERROR1; } ListViewItem item = this.listView_list.SelectedItems[0]; OrderOutputItemDialog dlg = new OrderOutputItemDialog(); MainForm.SetControlFont(dlg, this.Font, false); dlg.ScriptManager = this.ScriptManager; dlg.AppInfo = this.AppInfo; dlg.ExcludeSellers = GetUsedSellers(item); dlg.GetValueTable -= new GetValueTableEventHandler(dlg_GetValueTable); dlg.GetValueTable += new GetValueTableEventHandler(dlg_GetValueTable); dlg.Seller = ListViewUtil.GetItemText(item, 0); dlg.OutputFormat = ListViewUtil.GetItemText(item, 1); dlg.StartPosition = FormStartPosition.CenterScreen; REDO_INPUT: dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } // TODO: 渠道名查重 ListViewItem dup = ListViewUtil.FindItem(this.listView_list, dlg.Seller, 0); if (dup != null && dup != item) { MessageBox.Show(this, "修改后的渠道名 '" + dlg.Seller + "' 在当前列表中已经存在。请重新输入..."); goto REDO_INPUT; } ListViewUtil.ChangeItemText(item, 0, dlg.Seller); ListViewUtil.ChangeItemText(item, 1, dlg.OutputFormat); // ListViewUtil.SelectLine(item, true); this.m_bChanged = true; return; ERROR1: MessageBox.Show(this, strError); }
// 新增一个事项 private void toolStripButton_newItem_Click(object sender, EventArgs e) { OrderOutputItemDialog dlg = new OrderOutputItemDialog(); MainForm.SetControlFont(dlg, this.Font, false); dlg.ScriptManager = this.ScriptManager; dlg.AppInfo = this.AppInfo; dlg.ExcludeSellers = GetUsedSellers(null); dlg.GetValueTable -= new GetValueTableEventHandler(dlg_GetValueTable); dlg.GetValueTable += new GetValueTableEventHandler(dlg_GetValueTable); dlg.StartPosition = FormStartPosition.CenterScreen; REDO_INPUT: dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } // TODO: 渠道名查重 ListViewItem dup = ListViewUtil.FindItem(this.listView_list, dlg.Seller, 0); if (dup != null) { MessageBox.Show(this, "渠道名 '" + dlg.Seller + "' 在当前列表中已经存在。请重新输入..."); goto REDO_INPUT; } ListViewItem item = new ListViewItem(); item.Text = dlg.Seller; item.SubItems.Add(dlg.OutputFormat); this.listView_list.Items.Add(item); ListViewUtil.SelectLine(item, true); this.m_bChanged = true; }
// 修改一个事项 private void toolStripButton_modifyItem_Click(object sender, EventArgs e) { string strError = ""; if (this.listView_list.SelectedItems.Count == 0) { strError = "尚未选定要修改的事项"; goto ERROR1; } ListViewItem item = this.listView_list.SelectedItems[0]; OrderOutputItemDialog dlg = new OrderOutputItemDialog(); MainForm.SetControlFont(dlg, this.Font, false); dlg.ScriptManager = this.ScriptManager; dlg.AppInfo = this.AppInfo; dlg.ExcludeSellers = GetUsedSellers(item); dlg.GetValueTable -= new GetValueTableEventHandler(dlg_GetValueTable); dlg.GetValueTable += new GetValueTableEventHandler(dlg_GetValueTable); dlg.Seller = ListViewUtil.GetItemText(item, 0); dlg.OutputFormat = ListViewUtil.GetItemText(item, 1); dlg.StartPosition = FormStartPosition.CenterScreen; REDO_INPUT: dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) return; // TODO: 渠道名查重 ListViewItem dup = ListViewUtil.FindItem(this.listView_list, dlg.Seller, 0); if (dup != null && dup != item) { MessageBox.Show(this, "修改后的渠道名 '" + dlg.Seller + "' 在当前列表中已经存在。请重新输入..."); goto REDO_INPUT; } ListViewUtil.ChangeItemText(item, 0, dlg.Seller); ListViewUtil.ChangeItemText(item, 1, dlg.OutputFormat); // ListViewUtil.SelectLine(item, true); this.m_bChanged = true; return; ERROR1: MessageBox.Show(this, strError); }
// 新增一个事项 private void toolStripButton_newItem_Click(object sender, EventArgs e) { OrderOutputItemDialog dlg = new OrderOutputItemDialog(); MainForm.SetControlFont(dlg, this.Font, false); dlg.ScriptManager = this.ScriptManager; dlg.AppInfo = this.AppInfo; dlg.ExcludeSellers = GetUsedSellers(null); dlg.GetValueTable -= new GetValueTableEventHandler(dlg_GetValueTable); dlg.GetValueTable += new GetValueTableEventHandler(dlg_GetValueTable); dlg.StartPosition = FormStartPosition.CenterScreen; REDO_INPUT: dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) return; // TODO: 渠道名查重 ListViewItem dup = ListViewUtil.FindItem(this.listView_list, dlg.Seller, 0); if (dup != null) { MessageBox.Show(this, "渠道名 '" + dlg.Seller + "' 在当前列表中已经存在。请重新输入..."); goto REDO_INPUT; } ListViewItem item = new ListViewItem(); item.Text = dlg.Seller; item.SubItems.Add(dlg.OutputFormat); this.listView_list.Items.Add(item); ListViewUtil.SelectLine(item, true); this.m_bChanged = true; }