Example #1
0
        /// <summary>
        /// 在当前树节点位置处创建模板节点
        /// </summary>
        /// <returns>bool</returns>
        private bool CreateDocType()
        {
            TempletInfoForm templetInfoForm = new TempletInfoForm();

            templetInfoForm.IsNew       = true;
            templetInfoForm.IsFolder    = false;
            templetInfoForm.DocTypeInfo = this.MakeDocTypeInfo(false);
            if (templetInfoForm.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }

            TempletType docTypeInfo = templetInfoForm.DocTypeInfo;

            if (docTypeInfo == null)
            {
                return(false);
            }
            short shRet = TempletTypeAccess.Instance.Insert(docTypeInfo);

            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.ShowError("模板创建失败,无法更新到数据库!");
                return(false);
            }
            this.CreateNewNode(false, docTypeInfo);
            TempletHandler.Instance.OpenTemplet(docTypeInfo);
            return(true);
        }
Example #2
0
        /// <summary>
        /// 显示选中的模板的信息,并接受修改
        /// </summary>
        private void ShowTempletInfoEditForm()
        {
            TreeNode selectedNode = this.treeView1.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }
            TempletType docTypeInfo = selectedNode.Tag as TempletType;

            if (docTypeInfo == null)
            {
                return;
            }
            string szDocTypeID = docTypeInfo.DocTypeID;

            TempletInfoForm templetInfoForm = new TempletInfoForm();

            templetInfoForm.IsNew       = false;
            templetInfoForm.IsFolder    = docTypeInfo.IsFolder;
            templetInfoForm.DocTypeInfo = docTypeInfo.Clone() as TempletType;
            DialogResult result = templetInfoForm.ShowDialog();

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

            docTypeInfo = templetInfoForm.DocTypeInfo;
            if (docTypeInfo == null)
            {
                return;
            }
            short shRet = TempletTypeAccess.Instance.Update(docTypeInfo);

            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.ShowError("模板创建失败,无法更新到数据库!");
                return;
            }
            selectedNode.Tag  = docTypeInfo;
            selectedNode.Text = docTypeInfo.DocTypeName;
            if (!docTypeInfo.IsValid || !docTypeInfo.IsVisible)
            {
                selectedNode.ForeColor = Color.Silver;
            }
            else
            {
                selectedNode.ForeColor = Color.Black;
            }
        }