Esempio n. 1
0
 /// <summary>
 /// 应用整体模板
 /// </summary>
 /// <returns></returns>
 public DataTable ApplyAllDataModel()
 {
     if (_currentGridView == null)
     {
         DocumentTemplet documentTemplet = new DocumentTemplet(DocTempletType.ALL, Path.GetFileNameWithoutExtension(_baseDoc.ReportName), ExtendAppContext.Current.EventNo);
         XtraForm        xtraForm        = GetDialogForm("套用模板", documentTemplet);
         if (xtraForm.ShowDialog() == DialogResult.OK)
         {
             DataTable TotalModelDT = documentTemplet.DialogResultDataTable;
             return(TotalModelDT);
         }
     }
     else
     {
         if (_currentGridView != null)
         {
             if (_currentGridView.TempletFlag == DocTempletType.QiXieQingDian)
             {
                 QiXieQingDianTemplet qiXieQingDianTemplet = new QiXieQingDianTemplet();
                 qiXieQingDianTemplet.IsApply = true;
                 XtraForm xtraForm = GetDialogForm("套用模板", qiXieQingDianTemplet);
                 if (xtraForm.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(qiXieQingDianTemplet.DialogResultData))
                 {
                     SetQingdianViewData(qiXieQingDianTemplet.DialogResultData, qiXieQingDianTemplet.IsAddTempletData);
                     return(null);
                 }
             }
         }
         else if (_currentMRichTextBox != null)
         {
             if (_currentMRichTextBox.TempletFlag != DocTempletType.None)
             {
                 DocumentTemplet documentTemplet = null;
                 if (_currentMRichTextBox.TempletFlag == DocTempletType.Other && !string.IsNullOrEmpty(_currentMRichTextBox.OtherTempletFlagString))
                 {
                     documentTemplet = new DocumentTemplet(_currentMRichTextBox.OtherTempletFlagString.Trim(), ExtendAppContext.Current.EventNo);
                 }
                 else
                 {
                     documentTemplet = new DocumentTemplet(_currentMRichTextBox.TempletFlag, ExtendAppContext.Current.EventNo);
                 }
                 XtraForm xtraForm = GetDialogForm("套用模板", documentTemplet);
                 if (xtraForm.ShowDialog() == DialogResult.OK)
                 {
                     _currentMRichTextBox.Text = documentTemplet.DialogResultData;
                     return(null);
                 }
             }
         }
     }
     return(null);
 }
Esempio n. 2
0
        /// <summary>
        /// 应用模板
        /// </summary>
        /// <returns></returns>
        public bool ApplyModel()
        {
            bool isApplyed = false;

            if (_currentGridView == null && _currentMRichTextBox == null)
            {
                Dialog.MessageBox("请选择被套用控件");
                return(false);
            }
            if (_currentGridView != null)
            {
                if (_currentGridView.TempletFlag == DocTempletType.QiXieQingDian)
                {
                    QiXieQingDianTemplet qiXieQingDianTemplet = new QiXieQingDianTemplet();
                    qiXieQingDianTemplet.IsApply = true;
                    XtraForm xtraForm = GetDialogForm("套用模板", qiXieQingDianTemplet);
                    if (xtraForm.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(qiXieQingDianTemplet.DialogResultData))
                    {
                        SetQingdianViewData(qiXieQingDianTemplet.DialogResultData, qiXieQingDianTemplet.IsAddTempletData);
                        isApplyed = true;
                    }
                }
            }
            else if (_currentMRichTextBox != null)
            {
                if (_currentMRichTextBox.TempletFlag != DocTempletType.None)
                {
                    DocumentTemplet documentTemplet = null;
                    if (_currentMRichTextBox.TempletFlag == DocTempletType.Other && !string.IsNullOrEmpty(_currentMRichTextBox.OtherTempletFlagString))
                    {
                        documentTemplet = new DocumentTemplet(_currentMRichTextBox.OtherTempletFlagString.Trim(), ExtendAppContext.Current.EventNo);
                    }
                    else
                    {
                        documentTemplet = new DocumentTemplet(_currentMRichTextBox.TempletFlag, ExtendAppContext.Current.EventNo);
                    }
                    XtraForm xtraForm = GetDialogForm("套用模板", documentTemplet);
                    if (xtraForm.ShowDialog() == DialogResult.OK)
                    {
                        _currentMRichTextBox.Text = documentTemplet.DialogResultData;
                        isApplyed = true;
                    }
                }
            }
            return(isApplyed);
        }