コード例 #1
0
        void menu_delete_Click(object sender, EventArgs e)
        {
            string strError = "";

            if (this.listView_actions.SelectedIndices.Count == 0)
            {
                strError = "尚未选定要删除的行";
                goto ERROR1;
            }

            string strText = "确实要删除所选定的 " + this.listView_actions.SelectedItems.Count.ToString() + " 个行?";

            DialogResult result = MessageBox.Show(this,
                                                  strText,
                                                  "ChangeItemActionDialog",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question,
                                                  MessageBoxDefaultButton.Button2);

            if (result != DialogResult.Yes)
            {
                return;
            }

            ListViewUtil.DeleteSelectedItems(this.listView_actions);
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
コード例 #2
0
        void menu_deleteReport_Click(object sender, EventArgs e)
        {
            string strError = "";

            if (this.listView_reports.SelectedItems.Count == 0)
            {
                strError = "尚未选定要删除的事项";
                goto ERROR1;
            }

            DialogResult result = MessageBox.Show(this,
                                                  "确实要删除选定的 " + this.listView_reports.SelectedItems.Count.ToString() + " 个事项?",
                                                  "LibraryReportCfgForm",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question,
                                                  MessageBoxDefaultButton.Button2);

            if (result != DialogResult.Yes)
            {
                return;
            }
            ListViewUtil.DeleteSelectedItems(this.listView_reports);

            this.Changed = true;
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
コード例 #3
0
        private void toolStripButton_location_delete_Click(object sender, EventArgs e)
        {
            string strError = "";

            if (this.listView_location_list.SelectedItems.Count == 0)
            {
                strError = "尚未选定要删除的馆藏地点事项";
                goto ERROR1;
            }

            string strItemNameList = ListViewUtil.GetItemNameList(this.listView_location_list.SelectedItems);

            /*
             * for (int i = 0; i < this.listView_location_list.SelectedItems.Count; i++)
             * {
             *  if (i > 0)
             *      strItemNameList += ",";
             *  strItemNameList += this.listView_location_list.SelectedItems[i].Text;
             * }
             * */

            // 对话框警告
            DialogResult result = MessageBox.Show(this,
                                                  "确实要删除馆藏地点事项 " + strItemNameList + "?",
                                                  "ManagerForm",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question,
                                                  MessageBoxDefaultButton.Button2);

            if (result != DialogResult.Yes)
            {
                return;
            }

#if NO
            for (int i = this.listView_location_list.SelectedIndices.Count - 1;
                 i >= 0;
                 i--)
            {
                int    index           = this.listView_location_list.SelectedIndices[i];
                string strDatabaseName = this.listView_location_list.Items[index].Text;
                this.listView_location_list.Items.RemoveAt(index);
            }
#endif
            // 2012/3/11
            ListViewUtil.DeleteSelectedItems(this.listView_location_list);


            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
コード例 #4
0
        private void button_delete_Click(object sender, EventArgs e)
        {
            string strError = "";

            if (this.listView_entities.SelectedItems.Count == 0)
            {
                strError = "尚未选择要删除的事项";
                goto ERROR1;
            }

            ListViewUtil.DeleteSelectedItems(this.listView_entities);
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
コード例 #5
0
ファイル: ReportDefForm.cs プロジェクト: zszqwe/dp2
        void menu_deleteColumn_Click(object sender, EventArgs e)
        {
            string strError = "";

            // int nRet = 0;

            if (this.listView_columns.SelectedItems.Count == 0)
            {
                strError = "尚未选定要删除的事项";
                goto ERROR1;
            }

            // TODO: 是否对话框询问?

            ListViewUtil.DeleteSelectedItems(this.listView_columns);
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
コード例 #6
0
        // 删除已经选定的行
        void menu_deleteSelected_Click(object sender, EventArgs e)
        {
            if (this.listView1.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选定要删除的事项。");
                return;
            }

            DialogResult result = MessageBox.Show(this,
                                                  "确实要删除选定的 " + this.listView1.SelectedItems.Count.ToString() + " 个事项?",
                                                  "dp2Circulation",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question,
                                                  MessageBoxDefaultButton.Button2);

            if (result != DialogResult.Yes)
            {
                return;
            }

            ListViewUtil.DeleteSelectedItems(this.listView1);
        }
コード例 #7
0
ファイル: OrderFileDialog.cs プロジェクト: zszqwe/dp2
        // 删除一个或多个事项
        private void toolStripButton_deleteItem_Click(object sender, EventArgs e)
        {
            string strError = "";

            if (this.listView_list.SelectedIndices.Count == 0)
            {
                strError = "尚未选定要删除的事项";
                goto ERROR1;
            }

            DialogResult result = MessageBox.Show(this,
                                                  "确实要删除选定的 " + this.listView_list.SelectedIndices.Count.ToString() + " 个事项? ",
                                                  "OrderFileDialog",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question,
                                                  MessageBoxDefaultButton.Button2);

            if (result != DialogResult.Yes)
            {
                return;
            }

#if NO
            for (int i = this.listView_list.SelectedIndices.Count - 1; i >= 0; i--)
            {
                this.listView_list.Items.RemoveAt(this.listView_list.SelectedIndices[i]);
            }
#endif
            // 2012/3/11
            ListViewUtil.DeleteSelectedItems(this.listView_list);

            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
コード例 #8
0
        private void button_deleteInstance_Click(object sender, EventArgs e)
        {
            string strError = "";
            int    nRet     = 0;

            HideMessageTip();

            if (this.listView_instance.SelectedItems.Count == 0)
            {
                strError = "尚未选择要删除的事项";
                goto ERROR1;
            }

            DialogResult result = MessageBox.Show(this,
                                                  "确实要删除所选择的 " + this.listView_instance.SelectedItems.Count.ToString() + " 个实例?",
                                                  "InstanceDialog",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question,
                                                  MessageBoxDefaultButton.Button2);

            if (result != DialogResult.Yes)
            {
                return;
            }

            // 删除应用程序目录
            foreach (ListViewItem item in this.listView_instance.SelectedItems)
            {
                string strSite         = ListViewUtil.GetItemText(item, COLUMN_SITE);
                string strVirtualDir   = ListViewUtil.GetItemText(item, COLUMN_VIRTUALDIR);
                string strPhysicalPath = ListViewUtil.GetItemText(item, COLUMN_PHYSICALPATH);

                // 注销 Web App。调用后,程序物理目录没有删除。apppool 没有删除。
                // 只能用于 IIS 7 以上版本
                nRet = OpacAppInfo.UnregisterWebApp(
                    strSite,
                    strVirtualDir,
                    out strError);
                if (nRet == -1)
                {
                    MessageBox.Show(this, strError);
                }

                // 删除应用程序物理目录
                //LineInfo info = (LineInfo)item.Tag;
                //if (info != null)
                {
                    if (string.IsNullOrEmpty(strPhysicalPath) == false)
                    {
                        // return:
                        //      -1  出错。包括出错后重试然后放弃
                        //      0   成功
                        nRet = InstallHelper.DeleteDataDir(strPhysicalPath,
                                                           out strError);
                        if (nRet == -1)
                        {
                            MessageBox.Show(this, strError);
                        }
                    }
                }
            }



            List <string> datadirs = new List <string>();

            foreach (ListViewItem item in this.listView_instance.SelectedItems)
            {
                string strDataDir = ListViewUtil.GetItemText(item, COLUMN_DATADIR);
                if (String.IsNullOrEmpty(strDataDir) == true)
                {
                    continue;
                }

                if (Directory.Exists(strDataDir) == false)
                {
                    continue;
                }

                datadirs.Add(strDataDir);
            }

            ListViewUtil.DeleteSelectedItems(this.listView_instance);

            this.Changed = true;

            // 如果数据目录已经存在,提示是否连带删除数据目录
            if (datadirs.Count > 0)
            {
                strError = "";
                result   = MessageBox.Show(this,
                                           "所选定的实例信息已经删除。\r\n\r\n要删除它们所对应的下列数据目录么?\r\n" + StringUtil.MakePathList(datadirs, "\r\n"),
                                           "InstanceDialog",
                                           MessageBoxButtons.YesNo,
                                           MessageBoxIcon.Question,
                                           MessageBoxDefaultButton.Button1);
                if (result == DialogResult.Yes)
                {
                    foreach (string strDataDir in datadirs)
                    {
                        string strTempError = "";
                        // return:
                        //      -1  出错。包括出错后重试然后放弃
                        //      0   成功
                        nRet = InstallHelper.DeleteDataDir(strDataDir,
                                                           out strTempError);
                        if (nRet == -1)
                        {
                            strError += strTempError + "\r\n";
                        }
                    }
                    if (String.IsNullOrEmpty(strError) == false)
                    {
                        goto ERROR1;
                    }
                }
            }

            return;

ERROR1:
            MessageBox.Show(this, strError);
            return;
        }
コード例 #9
0
ファイル: MessageAccountForm.cs プロジェクト: zgren/dp2
 // 删除所选择的账户
 void MenuItem_deleteAccounts_Click(object sender, EventArgs e)
 {
     ListViewUtil.DeleteSelectedItems(this.listView_accounts);
 }