Exemple #1
0
        private void btnWord_Click(object sender, EventArgs e)
        {
            var index = (int)ddlWord.SelectedValue;

            WordsAppendix     words = null;
            FormWordsAppendix f;

            if (index >= 0)
            {
                words = (WordsAppendix)_appendix.Appendixs[index];
            }
            f = new FormWordsAppendix(words, _formIndex + 1);

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (f.Appendix.Timu == null)
                {
                    return;
                }

                f.Appendix.Type  = 0;
                f.Appendix.Title = f.Appendix.Timu.ConContent;

                if (index == -1)
                {
                    if (_appendix.Appendixs == null)
                    {
                        _appendix.Appendixs = new List <ToWord.Appendix>();
                    }

                    dDLSourceBindingSource.List.Add(new DDLSource()
                    {
                        Index = _appendix.Appendixs.Count - 1, Text = "【文字】" + f.Appendix.Title
                    });
                    _appendix.Appendixs.Add(f.Appendix);
                }
                else
                {
                    _appendix.Appendixs[index] = f.Appendix;
                    ((DDLSource)dDLSourceBindingSource.Current).Text = "【文字】" + f.Appendix.Title;
                    BindDDL();
                }
            }
        }
Exemple #2
0
        private void btnWord_Click(object sender, EventArgs e)
        {
            DataVerifier dv = new DataVerifier();

            dv.Check(n == null, "请先添加通知模板再添加附件");

            if (dv.Pass)
            {
                var index = (int)ddlWord.SelectedValue;

                WordsAppendix     words = null;
                FormWordsAppendix f;

                if (index >= 0)
                {
                    dv.Check(n.Appendixs[index].Type != 0, "修改附件时请选择对应的附件类型");
                    if (dv.Pass)
                    {
                        words = (WordsAppendix)n.Appendixs[index];
                    }
                }

                if (dv.Pass)
                {
                    f = new FormWordsAppendix(words);

                    if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        if (f.Appendix.Timu == null)
                        {
                            return;
                        }

                        f.Appendix.Type  = 0;
                        f.Appendix.Title = f.Appendix.Timu.ConContent;

                        if (index == -1)
                        {
                            if (n.Appendixs == null)
                            {
                                n.Appendixs = new List <Appendix>();
                            }

                            n.Appendixs.Add(f.Appendix);
                            dDLSourceBindingSource.List.Add(new DDLSource()
                            {
                                Index = n.Appendixs.Count - 1, Text = "【文字】" + f.Appendix.Title
                            });
                        }
                        else
                        {
                            n.Appendixs[index] = f.Appendix;
                            ((DDLSource)dDLSourceBindingSource.Current).Text = "【文字】" + f.Appendix.Title;
                            BindDDL();
                        }
                    }
                }
            }

            dv.ShowMsgIfFailed();
        }