示例#1
0
        private void tsbSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (_wordData == null)
                {
                    return;
                }

                _wordData.词句信息.词句明细.Clear();

                _wordData.词句信息.词句类型 = tsCbxType.SelectedIndex;

                foreach (ListViewItem lvi in lvFreeList.Items)
                {
                    if (lvi.Checked)
                    {
                        JReportWordSection wordSection = lvi.Tag as JReportWordSection;

                        _wordData.词句信息.词句明细.Add(wordSection);
                    }
                }

                _rwm.UpdateWordItem(_wordData);

                IsModify = false;

                _isOk = true;
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
        private void butModify_Click(object sender, EventArgs e)
        {
            try
            {
                if (treeView1.SelectedNode == null)
                {
                    MessageBox.Show("请选择需要修改的项目。", "提示");
                    return;
                }

                TreeNode selNode = treeView1.SelectedNode;

                if (selNode.Tag is ReportWordsInfoData)
                {
                    //修改项目
                    if (ItemVerify(true) == false)
                    {
                        return;
                    }

                    ReportWordsInfoData itemData = selNode.Tag as ReportWordsInfoData;

                    itemData.词句名称 = txtName.Text;
                    //itemData.词句信息.适用性别 = cbxSex.Text;
                    itemData.词句信息.备注说明 = rtbDescription.Text;

                    itemData.词句信息.CopyBasePro(itemData);

                    _rwm.UpdateWordItem(itemData);

                    selNode.Text = itemData.词句名称;
                }
                else
                {
                    //修改分类
                    if (ClassVerify(true) == false)
                    {
                        return;
                    }

                    ReportWordsClassData classData = selNode.Tag as ReportWordsClassData;

                    classData.分类名称 = txtName.Text;

                    classData.分类信息.适用性别 = cbxSex.Text;
                    classData.分类信息.备注说明 = rtbDescription.Text;

                    classData.分类信息.CopyBasePro(classData);

                    _rwm.UpdateWordClass(classData);

                    selNode.Text = classData.分类名称;
                }

                ButtonHint.Start(butModify, "OK");
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }