Esempio n. 1
0
        // 修改名字和注释
        void menu_modify(object sender, System.EventArgs e)
        {
            string strError = "";

            if (listView1.SelectedItems.Count == 0)
            {
                strError = "尚未选择拟修改的模板记录事项...";
                goto ERROR1;
            }

            ListViewItem item = listView1.SelectedItems[0];

            TemplateRecordDlg dlg = new TemplateRecordDlg();

            GuiUtil.SetControlFont(dlg, this.Font, false);

            string strOldName = ListViewUtil.GetItemText(item, 0);

            dlg.TemplateName = ListViewUtil.GetItemText(item, 0);
            dlg.Comment      = ListViewUtil.GetItemText(item, 1);

REDO_INPUT:
            dlg.ShowDialog(this);
            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            // 查重 2014/6/21
            ListViewItem dup = ListViewUtil.FindItem(this.listView1, dlg.TemplateName, 0);

            if (dup != null && dup != item)
            {
                strError = "模板名 '" + dlg.TemplateName + "' 已经被使用了,不允许重复出现。请重新输入模板名";
                MessageBox.Show(this, strError);
                goto REDO_INPUT;
            }

            int nRet = ChangeRecordProperty(strOldName,
                                            dlg.TemplateName,
                                            dlg.Comment,
                                            out strError);

            if (nRet == -1)
            {
                goto ERROR1;
            }

            FillList(false);
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Esempio n. 2
0
        // 修改名字和注释
        void menu_Modify(object sender, System.EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选择拟修改的模板记录事项...");
                return;
            }
            TemplateRecordDlg dlg = new TemplateRecordDlg();

            MainForm.SetControlFont(dlg, this.Font, false);

            string strOldName = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);

            dlg.TemplateName    = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);
            dlg.TemplateComment = ListViewUtil.GetItemText(listView1.SelectedItems[0], 1);

            dlg.ShowDialog(this);
            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            string strError = "";
            int    nRet     = ChangeRecordProperty(strOldName,
                                                   dlg.TemplateName,
                                                   dlg.TemplateComment,
                                                   out strError);

            if (nRet == -1)
            {
                MessageBox.Show(this, strError);
                return;
            }

            FillList(false);
        }
Esempio n. 3
0
        // 修改名字和注释
        void menu_modify(object sender, System.EventArgs e)
        {
            string strError = "";

            if (listView1.SelectedItems.Count == 0)
            {
                strError = "尚未选择拟修改的模板记录事项...";
                goto ERROR1;
            }

            ListViewItem item = listView1.SelectedItems[0];

            TemplateRecordDlg dlg = new TemplateRecordDlg();
            GuiUtil.SetControlFont(dlg, this.Font, false);

            string strOldName = ListViewUtil.GetItemText(item, 0);

            dlg.TemplateName = ListViewUtil.GetItemText(item, 0);
            dlg.Comment = ListViewUtil.GetItemText(item, 1);

        REDO_INPUT:
            dlg.ShowDialog(this);
            if (dlg.DialogResult != DialogResult.OK)
                return;

            // 查重 2014/6/21
            ListViewItem dup = ListViewUtil.FindItem(this.listView1, dlg.TemplateName, 0);
            if (dup != null && dup != item)
            {
                strError = "模板名 '" + dlg.TemplateName + "' 已经被使用了,不允许重复出现。请重新输入模板名";
                MessageBox.Show(this, strError);
                goto REDO_INPUT;
            }

            int nRet = ChangeRecordProperty(strOldName,
                dlg.TemplateName,
                dlg.Comment,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            FillList(false);
            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Esempio n. 4
0
		// 修改名字和注释
		void menu_Modify(object sender, System.EventArgs e)
		{
			if (listView1.SelectedItems.Count == 0)
			{
                MessageBox.Show(this, "尚未选择拟修改的模板记录事项...");
				return;
			}
			TemplateRecordDlg dlg = new TemplateRecordDlg();
            MainForm.SetControlFont(dlg, this.Font, false);

			string strOldName = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);

			dlg.TemplateName = ListViewUtil.GetItemText(listView1.SelectedItems[0], 0);
			dlg.TemplateComment = ListViewUtil.GetItemText(listView1.SelectedItems[0], 1);

			dlg.ShowDialog(this);
			if (dlg.DialogResult != DialogResult.OK)
				return;

			string strError = "";
			int nRet = ChangeRecordProperty(strOldName, 
				dlg.TemplateName,
				dlg.TemplateComment,
				out strError);
			if (nRet == -1) 
			{
				MessageBox.Show(this, strError);
				return;
			}

			FillList(false);
		}