/// <summary>
 /// 获取所有的文档模板
 /// </summary>
 /// <param name="docType"></param>
 /// <returns></returns>
 public List<doc_template> getAllDocumentTemplate()
 {
     List<doc_template> docTemplateList = new List<doc_template>();
     doc_template DOC2 = new doc_template();
     DOC2.id = 3;
     DOC2.name = "需求文档模板";
     DOC2.parent_id = 1;
     DOC2.parent_name = "设计文档";
     DOC2.breadth = "A4";
     DOC2.create_date = DateTime.Parse("2013-01-01");
     DOC2.create_user_name = "李俊";
     DOC2.create_user_id = 1;
     DOC2.modify_date = DateTime.Parse("2013-01-01");
     DOC2.modify_user_id = 2;
     DOC2.modify_user_name = "张三";
     DOC2.modify_count = "2";
     docTemplateList.Add(DOC2);
     return docTemplateList;
 }
Exemplo n.º 2
0
        private void ChooseDocTemplate_Load(object sender, EventArgs e)
        {
            // 自动加载数据
            doc_template DOC = new doc_template();
            DOC.id = 1;
            DOC.name = "设计文档";
            DOC.parent_id = -1;
            DOC.file_type = "Files";

            pList.Add(DOC);
            doc_template DOC1 = new doc_template();
            DOC1.id = 2;
            DOC1.name = "办公文档";
            DOC1.parent_id = -1;
            DOC1.file_type = "Files";
            pList.Add(DOC1);

            doc_template DOC2 = new doc_template();
            DOC2.id = 3;
            DOC2.name = "需求文档模板";
            DOC2.parent_id = 1;
            DOC2.parent_name = "设计文档";
            DOC2.breadth = "A4";
            DOC2.create_date = DateTime.Parse("2013-01-01");
            DOC2.create_user_name = "李俊";
            DOC2.create_user_id = 1;
            DOC2.modify_date = DateTime.Parse("2014-01-03");
            DOC2.modify_user_name = "张三";
            DOC2.modify_user_id = 2;
            DOC2.modify_count = "2";
            DOC2.file_type = "File";
            pList.Add(DOC2);

            this.treeList2.DataSource = pList;
            this.treeList2.ParentFieldName = "ParentId";
            this.treeList2.KeyFieldName = "Id";
            this.treeList2.OptionsView.ShowColumns = false;

            this.treeList2.RefreshDataSource();
        }
Exemplo n.º 3
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     docTemplate.name = this.txtTemplateName.Text;
     docTemplate.breadth = this.txtBreadth.Text;
     docTemplate.id = int.Parse(this.txtTemplateId.Text);
     docTemplate.parent_name = this.txtTemplateType.Text;
     if (actionType == 1)
     {
         // 新建
         docTemplate = WcfServiceLocator.Create<IDocTemplateCategoryManage>().insertDocumentTemplate(docTemplate);
     }
     else if (actionType == 2)
     {
         // 修改
         docTemplate = WcfServiceLocator.Create<IDocTemplateCategoryManage>().updateDocumentTemplate(docTemplate);
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Exemplo n.º 4
0
 /// <summary>
 /// 自定义构造函数
 /// </summary>
 /// <param name="docTemplate"></param>
 /// <param name="actionType"></param>
 public BuildDocTemplate(doc_template docTemplate, int actionType)
 {
     InitializeComponent();
     this.docTemplate = docTemplate;
     this.actionType = actionType;
 }
Exemplo n.º 5
0
        /// <summary>
        /// 文件夹点击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (e.ClickedItem.Name == "toolStripMenuItem1")
            {
                doc_template_tree tTree = new doc_template_tree();
                tTree.parent_id = ((doc_template_tree)node.Tag).id;
                tTree.parent_name = ((doc_template_tree)node.Tag).name;
                // 新建分类
                BuildDocTemplateCategory category = new BuildDocTemplateCategory(tTree,1);
                if (category.ShowDialog() == DialogResult.OK)
                {
                    //新建分类成功!
                    DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(category.docTemplateTree.id, node);
                    tns.SetValue(TemplateName, category.docTemplateTree.name);
                    tns.SetValue(TemplateId, category.docTemplateTree.id);
                    tns.SetValue(TemplateType, "Files");
                    tns.Tag = category.docTemplateTree;
                }
            }
            else if (e.ClickedItem.Name == "toolStripMenuItem2")
            {
                // 修改分类
                doc_template_tree tTree = (doc_template_tree)node.Tag;
                BuildDocTemplateCategory category = new BuildDocTemplateCategory(tTree, 2);
                if (category.ShowDialog() == DialogResult.OK)
                {
                    //修改分类成功!
                    node.SetValue(TemplateName, category.docTemplateTree.name);
                    node.Tag = category.docTemplateTree;
                }

            }
            else if (e.ClickedItem.Name == "toolStripMenuItem3")
            {
                // 删除分类
                doc_template_tree tTree = (doc_template_tree)node.Tag;
                if (DialogResult.OK == MessageBox.Show("确定删除这行数据!", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
                {
                    bool flag = WcfServiceLocator.Create<IDocTemplateCategoryManage>().delDocumentTemplateTree(tTree);
                    if (flag)
                    {
                        // 访问后台删除数据
                        this.TreeDocTemplate.treeList1.DeleteNode(node);
                    }
                }

            }
            else if (e.ClickedItem.Name == "toolStripMenuItem4")
            {

                // 分类属性
                doc_template_tree tTree = (doc_template_tree)node.Tag;
                BuildDocTemplateCategory category = new BuildDocTemplateCategory(tTree, 3);
                category.ShowDialog();
            }
            else if (e.ClickedItem.Name == "toolStripMenuItem10")
            {
                // 新建模板文档
                doc_template docTemplate = new doc_template();
                docTemplate.parent_id = ((doc_template_tree)node.Tag).id;
                docTemplate.parent_name = ((doc_template_tree)node.Tag).name;
                BuildDocTemplate bulidDocTemlate = new BuildDocTemplate(docTemplate,1);
                if (bulidDocTemlate.ShowDialog() == DialogResult.OK)
                {
                    // 新建模板文档成功!
                    //新建分类成功!
                    DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(bulidDocTemlate.docTemplate.id, node);
                    tns.SetValue(TemplateName, bulidDocTemlate.docTemplate.name);
                    tns.SetValue(TemplateId, bulidDocTemlate.docTemplate.id);
                    tns.SetValue(TemplateType, "Files");
                    tns.Tag = bulidDocTemlate.docTemplate;
                }
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// 文档树右击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void treeList1_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button ==   MouseButtons.Right)
     {
         DevExpress.XtraTreeList.TreeListHitInfo hInfo = this.TreeDocTemplate.treeList1.CalcHitInfo(new Point(e.X, e.Y));
         if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了
         {
             if (hInfo.Node.Tag.GetType() == typeof(doc_template_tree))
             {
                 this.TreeDocTemplate.treeList1.ContextMenuStrip = this.contextMenuStrip1;
                 node = hInfo.Node;
             }
             else
             {
                 this.TreeDocTemplate.treeList1.ContextMenuStrip = this.contextMenuStrip2;
                 selTreeNode = (doc_template)hInfo.Node.Tag;
                 node = hInfo.Node;
             }
         }
     }
 }
 /// <summary>
 /// 插入文档模板
 /// </summary>
 /// <param name="docTemplate"></param>
 /// <returns></returns>
 public doc_template insertDocumentTemplate(doc_template docTemplate)
 {
     return docTemplate;
 }
 /// <summary>
 /// 删除文档模板
 /// </summary>
 /// <param name="docTemplate"></param>
 /// <returns></returns>
 public bool delDocumentTemplate(doc_template docTemplate)
 {
     return true;
 }
 /// <summary>
 /// 修改文档模板
 /// </summary>
 /// <param name="docTemplate"></param>
 /// <returns></returns>
 public doc_template updateDocumentTemplate(doc_template docTemplate)
 {
     return docTemplate;
 }