AIMS/DocumentManagement/UI/frmTemplate.cs
2023-08-03 12:55:03 +08:00

2151 lines
85 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DCSoft.Writer;
using DCSoft.Writer.Controls;
using DCSoft.Writer.Commands;
using DCSoft.Writer.Dom;
using DCSoft.Drawing;
using DCSoft.Writer.Data;
using DCSoft.Writer.Security;
using DCSoft.Common;
using DCSoft.Data;
using DCSoft.Writer.Printing;
using DCSoft.Writer.Extension.Data;
using DCSoft.Writer.Extension;
using DCSoft.Design;
using System.Linq;
using System.Xml;
using Microsoft.CSharp;
using System.CodeDom.Compiler;
using System.Reflection;
namespace DocumentManagement
{
/// <summary>
///
/// </summary>
public partial class frmTemplate : Form
{
public PrintTemplate model = new PrintTemplate();
/// <summary>
/// 数据源树状列表控制器
/// </summary>
private DataSourceTreeViewControler dstvControler = null;
public WriterControl editControl { get { return this.myEditControl; } }
public RichTextBox RTB_Click { get { return this.rtbClick; } }
public RichTextBox RTB_Content { get { return this.rtbContent; } }
/// <summary>
/// 元素事件窗体
/// </summary>
//private frmElementEvents frmElementEvents;
//private XTextDocument bakDoc = null;
private XTextElementList tempList,tempChkList;
private bool delFlag = true;
private FlagXTextRangeProvider provider = new FlagXTextRangeProvider();
private CompilerResults cr;
private Type type;
public frmTemplate()
{
InitializeComponent();
myEditControl.ServerObject = new ServerObjectSample(this);
//myEditControl.ViewMode = Printing.PageViewMode.Normal;
//myEditControl.Document.Options.EditOptions.AutoEditElementValue = true;
//myEditControl.IsAdministrator = true;
//myEditControl.Readonly = true;
//myEditControl.KeyPress += new KeyPressEventHandler(myEditControl_KeyPress);
myEditControl.DocumentControler = new MyDocumentControler();
//myEditControl.IsAdministrator = true;
//myEditControl.DocumentControler.DataFilter = new MyDataFilter();
//myEditControl.HeaderFooterReadonly = true;
myEditControl.AllowDragContent = true;
//DocumentContentStyle style = myEditControl.Document.Style;
//myEditControl.AutoSetDocumentDefaultFont = false;
tabDataSource.Visible = false;
this.spDataSource.Visible = false;
myEditControl.MoveFocusHotKey = MoveFocusHotKeys.Tab;
}
private AppStartOptions _StartOptions = new AppStartOptions();
public AppStartOptions StartOptions
{
get
{
return _StartOptions;
}
set
{
_StartOptions = value;
}
}
private void frmTemplate_Load(object sender, EventArgs e)
{
this.myEditControl.EventCanInsertObject +=
new DCSoft.Writer.CanInsertObjectEventHandler(this.myEditControl_EventCanInsertObject);
this.myEditControl.EventInsertObject +=
new DCSoft.Writer.InsertObjectEventHandler(this.myEditControl_EventInsertObject);
//this.myEditControl.DocumentControler = new DocumentControlerExt();
// 添加扩展编辑器命令模块对象
myEditControl.AppHost.CommandContainer.Modules.Add(
new DCSoft.Writer.Extension.WriterCommandModuleExtension());
//DCSoft.Writer.Controls.TextWindowsFormsEditorHost.PopupFormSizeFix = new System.Drawing.Size(40, 20);
myEditControl.Font = new Font(System.Windows.Forms.Control.DefaultFont.Name, 12);
if (_StartOptions == null)
{
_StartOptions = new AppStartOptions();
}
//// 设置编辑器界面双缓冲
//myEditControl.DoubleBuffering = _StartOptions.DoubleBuffering;
// 初始化设置命令执行器
myEditControl.CommandControler = myCommandControler;
//myEditControl.CommandControler.UpdateBindingControlStatus();
myCommandControler.Start();
myEditControl.DocumentOptions = new DocumentOptions();
// 设置文档处于调试模式
myEditControl.DocumentOptions.BehaviorOptions.DebugMode = true;
if (_StartOptions.EnablePermissionControl)
{
// Enable permission control
// 允许逻辑删除
myEditControl.DocumentOptions.SecurityOptions.EnableLogicDelete = true;
// 启用授权控制
myEditControl.DocumentOptions.SecurityOptions.EnablePermission = true;
// 显示逻辑删除的内容
myEditControl.DocumentOptions.SecurityOptions.ShowLogicDeletedContent = true;
// 显示痕迹标记
myEditControl.DocumentOptions.SecurityOptions.ShowPermissionMark = true;
//mPermissionConfig.Enabled = true;
//mLogin.Enabled = true;
//myEditControl.AutoUserLogin = true;
//myEditControl.AutoUserLoginInfo = _StartOptions.LoginInfo;
}
else
{
// Without permission control
myEditControl.DocumentOptions.SecurityOptions.EnableLogicDelete = false;
myEditControl.DocumentOptions.SecurityOptions.EnablePermission = false;
myEditControl.DocumentOptions.SecurityOptions.ShowLogicDeletedContent = false;
myEditControl.DocumentOptions.SecurityOptions.ShowPermissionMark = false;
//mPermissionConfig.Enabled = false;
//mLogin.Enabled = false;
//myEditControl.AutoUserLogin = false;
}
//this.myEditControl_DocumentLoad(null, null);
//model.Id = 2;
if (model.Id != 0)
{
model = DocumentDAL.GetTemplatebyId(model.Id);
}
tempList = new XTextElementList();
tempChkList = new XTextElementList();
//DocumentDAL.LoadKBLibaray();
myEditControl.ExecuteCommand("LoadKBLibrary", false, DocumentDAL.Lib);
//string kbFile = System.IO.Path.Combine(Application.StartupPath + "\\PrintDC\\", "kblibrary.xml");
//if (System.IO.File.Exists(kbFile))
//{
// //自动加载默认的知识库
// //KBLibrary lib = (KBLibrary)myEditControl.ExecuteCommand("LoadKBLibrary", false, kbFile);
// // 设置加载知识库中模板使用的文件系统
// //myEditControl.AppHost.FileSystems[lib.TemplateFileSystemName]
// // = EMR.EMRFileSystem.Instance;
//}
// 注册自定义的输入域下拉列表提供者
myEditControl.AppHost.Services.AddService(
typeof(IListItemsProvider),
new MyListItemsProvider());
mDataSourceList_Click(null, null);
// 执行一次新增文件操作
myEditControl.ExecuteCommand("FileNew", true, null);
//byte[] array = Encoding.UTF8.GetBytes(strXML);
//MemoryStream stream = new MemoryStream(array); //convert stream 2 string
//StreamReader reader = new StreamReader(stream);
//myEditControl.ExecuteCommand("FileOpen", false, reader);
//reader.Close();
//stream.Close();
//myEditControl.ExecuteCommand("InsertXML", false, strXML);
//document.Parameters.SetValue("title", System.Configuration.ConfigurationManager.AppSettings["HospitalName"].ToString());
//myEditControl.RefreshDocument();
//myEditControl.ExecuteCommand("UpdateViewForDataSource", false, null);
//如果不为空,则“编辑”状态
if (model.Id != 0)
{
myEditControl.LoadDocumentFromString(model.XmlFile, "xml");
myEditControl.Document.FileName = model.XmlFileName;
//bakDoc = new XTextDocument();
//bakDoc.Fields.AddRange(myEditControl.Document.Fields.ToArray());
tempList.AddRange(myEditControl.Document.Fields);
//tempList.ToArray().ToList<XTextElement>()
//.ForEach(element =>
// listFields.Items.Add(
// new ListItem
// {
// Text = ((XTextInputFieldElementBase)element).BackgroundText
// ,
// Value = element.ID
// }));
//listFields.DisplayMember = listFields.text;
tempChkList.AddRange(myEditControl.Document.GetElementsByType(typeof(XTextCheckBoxElement)));
myEditControl.DocumentContentChanged += new WriterEventHandler(myEditControl_DocumentContentChanged);
//ImageList lg = new ImageList();
//lg.Images.Add(this.toolStripButton2.Image);
//lg.Images.Add(this.toolStripMenuItem12.Image);
//listFields.SmallImageList = lg;
//if (model.XmlStatic.Length > 0)
//{
// XmlDocument doc = new XmlDocument();
// doc.LoadXml(model.XmlStatic);
// UpdateListView(doc);
//}
//else
//{
// UpdateListView();
//}
UpdateListView();
}
else
{
/*
//第一行页眉 医院民称
XTextDocument document = this.myEditControl.Document;
ContentBuilder bulder = new ContentBuilder(document.Header);
XTextInputFieldElement title = new XTextInputFieldElement();
title.BackgroundText = "医院名称";
title.FieldSettings = new InputFieldSettings();
//title.FieldSettings.EditStyle = InputFieldEditStyle.Text;
//title.DisplayFormat = new ValueFormater();
//title.ValueBinding = new DCSoft.Writer.Data.XDataBinding();
//title.ValueBinding.DataSource = "title";//数据源的名称
//title.ValueBinding.AutoUpdate = true;//是否自动更新数据
bulder.Append(title);
title.Style.Align = DCSoft.Drawing.DocumentContentAlignment.Center;
DocumentContentStyle dcs2 = new DocumentContentStyle();
dcs2.FontSize = 12;
dcs2.Color = System.Drawing.Color.Black;
dcs2.Align = DCSoft.Drawing.DocumentContentAlignment.Left;
bulder.AppendParagraphFlag(dcs2);
myEditControl.ExecuteCommand("InsertString", false, " ");
//myEditControl.RefreshDocument();
title.ID = "D_Title";
//title.StyleIndex = 0;
//title.Style.FontSize = 16;
//title.Style.Color = System.Drawing.Color.Gray;
*/
}
//XTextInputFieldElement titleBase = (XTextInputFieldElement)myEditControl.Document.GetElementById("D_Title");
//if (titleBase != null)
//{
// titleBase.Text = System.Configuration.ConfigurationManager.AppSettings["HospitalName"].ToString();
//}
//dstvControler = new DataSourceTreeViewControler(tvwDataSource);
//tvwDataSource.MouseDown += dstvControler.HandleTreeViewMouseDown;
string fileName = System.IO.Path.Combine(
Application.StartupPath,
"DataSourceDescriptor.xml");
if (System.IO.File.Exists(fileName))
{
dstvControler.LoadFile(fileName);
}
////使checkbox居中显示
//XTextElementList list = myEditControl.Document.GetElementsByType(typeof(XTextCheckBoxElement));
//foreach (XTextElement el in list)
//{
// ((XTextCheckBoxElement)el).Top = 15;
// //DCSoft.WinForms.ResizeableType ResizeableType = new DCSoft.WinForms.ResizeableType();
// //ResizeableType = DCSoft.WinForms.ResizeableType.WidthAndHeight;
// //((XTextCheckBoxElement)el).Resizeable = ResizeableType;
// //MessageBox.Show(((XTextCheckBoxElement)el).WidthHeightRate.ToString());
//}
InitCodeCompiler();
}
private void InitCodeCompiler()
{
var providerOptions = new Dictionary<string, string>();
providerOptions.Add("CompilerVersion", "v4.0");
CodeDomProvider cdp = new CSharpCodeProvider(providerOptions);
CompilerParameters cp = new CompilerParameters();
cp.GenerateExecutable = false;
cp.GenerateInMemory = true;
cp.ReferencedAssemblies.Add("mscorlib.dll");
cp.ReferencedAssemblies.Add("System.dll");
cp.ReferencedAssemblies.Add("System.Core.dll");
cp.ReferencedAssemblies.Add("DCSoft.Writer.dll");
cp.ReferencedAssemblies.Add("System.Data.Linq.dll");
cp.ReferencedAssemblies.Add("System.Xml.Linq.dll");
cp.ReferencedAssemblies.Add("System.Windows.Forms.dll");
string source = @"
namespace DocumentManagement
{
using System;
using System.Collections.Generic;
using System.Linq;
using DCSoft.Writer;
using DCSoft.Writer.Dom;
using System.Windows.Forms;
using System.Reflection;
public class BindEvents
{
private XTextDocument doc;
private XTextContainerElement container;
public BindEvents(DCSoft.Writer.Controls.WriterControl myEditControl)
{
doc = myEditControl.Document;
container = myEditControl.Document;
}
public static void MouseClickEvent(){
// doc.EditorControl.FreezeUI();
//
// doc.EditorControl.ReleaseFreezeUI();
// doc.EditorControl.UpdatePages();
}
private void SetCheckedValue(string name, bool value)
{
var element = doc.GetElementsByName(name).FirstElement;
if (element != null)
{
var pChecked = element.GetType().GetProperty(""Checked"");
pChecked.SetValue(element, value, null);
}
}
private bool GetCheckedValue(string name)
{
bool? result = null;
var element = doc.GetElementsByName(name).FirstElement;
if (element != null)
{
var pChecked = element.GetType().GetProperty(""Checked"");
result = Convert.ToBoolean(pChecked.GetValue(element, null));
}
return result.Value;
}
}
}
";
cr = cdp.CompileAssemblyFromSource(cp, source);
if (cr.Errors.HasErrors)
{
MessageBox.Show("加载元素事件失败!");
}
else
{
Assembly a = cr.CompiledAssembly;
type = a.GetTypes().Where(x => x.IsClass).FirstOrDefault();
Type[] types = new Type[a.GetTypes().Length];
types[0] = typeof(WriterControl);
ConstructorInfo ci = type.GetConstructor(types);
if (ci != null)
{
object obj = ci.Invoke(new object[] { this.myEditControl });
}
//myEditControl.Document.GetElementsByName("").FirstElement;
}
}
/// <summary>
/// Handle after load document
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void myEditControl_DocumentLoad(object sender, EventArgs e)
{
myEditControl.SetDocumentParameterValue(
"当前时间",
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
//if (myEditControl.DocumentOptions.SecurityOptions.EnablePermission)
//{
// // if enable permission
// if (myEditControl.Document != null && _StartOptions.LoginInfo != null)
// {
// // User logon , add current user info to document.
// myEditControl.UserLogin(_StartOptions.LoginInfo , false );
// }
//}
}
/// <summary>
/// Demo of server object in document
/// </summary>
public class ServerObjectSample
{
public ServerObjectSample(frmTemplate frm)
{
_Form = frm;
}
private frmTemplate _Form = null;
public frmTemplate Form
{
get
{
return _Form;
}
}
public string FormTitle
{
get
{
return _Form.Text;
}
}
public string AppPath
{
get
{
return Application.StartupPath;
}
}
private string _Name = "Zhang san";
public string Name
{
get { return _Name; }
set { _Name = value; }
}
private DateTime _Birthday = new DateTime(1990, 1, 1);
public DateTime Birthday
{
get { return _Birthday; }
set { _Birthday = value; }
}
private string _Nation = "China";
public string Nation
{
get { return _Nation; }
set { _Nation = value; }
}
}
public class MyDocumentControler : DCSoft.Writer.Dom.DocumentControler
{
public override bool CanDelete(XTextElement element, DomAccessFlags flags)
{
//if (element is XTextInputFieldElement)
//{
// return false;
//}
return base.CanDelete(element, flags);
}
}
#region Click_Event
private void menuClose_Click(object sender, EventArgs e)
{
this.Close();
}
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
}
private void menuOpenXMLDemo_Click(object sender, EventArgs e)
{
HandleCommand(MyCommandNames.OpenXMLDemo);
}
private void menuOpenRTFDemo_Click(object sender, EventArgs e)
{
HandleCommand(MyCommandNames.OpenNursingRecordDemo);
}
private void mOpenFormViewDemo_Click(object sender, EventArgs e)
{
HandleCommand(MyCommandNames.OpenFormViewDemo);
}
private void mTest_Click(object sender, EventArgs e)
{
}
private void mTestInsertField_Click(object sender, EventArgs e)
{
XTextInputFieldElement field = new XTextInputFieldElement();
field.FieldSettings = new InputFieldSettings();
field.FieldSettings.EditStyle = InputFieldEditStyle.DropdownList;
//field.InitalizeText = "测试文本ABC";
field.Name = "COUNTRY";
field.BackgroundText = "Please select country";
field.FieldSettings.MultiSelect = false;
field.Attributes = new XAttributeList();
field.Attributes.SetValue("Insert time", DateTime.Now.ToLongDateString());
field.OwnerDocument = myEditControl.Document;
field.SetInnerTextFast("测试文本ABC");
XTextInputFieldElement newField = (XTextInputFieldElement)myEditControl.ExecuteCommand("InsertInputField", true, field);
if (newField != null)
{
System.Console.WriteLine(newField.ToString());
}
}
private void mTestInsertMedic_Click(object sender, EventArgs e)
{
XTextInputFieldElement field = new XTextInputFieldElement();
field.FieldSettings = new InputFieldSettings();
field.FieldSettings.EditStyle = InputFieldEditStyle.DropdownList;
field.FieldSettings.ListSource = new ListSourceInfo();
field.FieldSettings.ListSource.SourceName = "DOCEX";
field.FieldSettings.ListSource.DisplayPath = "Name";
field.FieldSettings.ListSource.ValuePath = "Name";
field.FieldSettings.MultiSelect = false;
field.Attributes = new XAttributeList();
field.Attributes.SetValue("Insert Time", DateTime.Now.ToLongDateString());
field.Name = "Docex";
field.BackgroundText = "药品";
myEditControl.ExecuteCommand("InsertInputField", true, field);
}
private void mTestInsertImage_Click(object sender, EventArgs e)
{
System.Drawing.Image img = Image.FromFile(System.IO.Path.Combine(Application.StartupPath, "About.jpg"));
myEditControl.ExecuteCommand("InsertImage", false, img);
}
private void mTestInsertString_Click(object sender, EventArgs e)
{
myEditControl.ExecuteCommand("InsertString", false, "abc");
}
private void mTestInsertRTF_Click(object sender, EventArgs e)
{
myEditControl.ExecuteCommand("InsertRTF", false, @"{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fcharset134 \'cb\'ce\'cc\'e5;}}
{\colortbl ;\red255\green0\blue0;}
{\*\generator Msftedit 5.41.21.2510;}{\info{\horzdoc}{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}{\*\fchars !),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9}}
\viewkind4\uc1\pard\sa200\sl276\slmult1\lang2052\f0\fs22 1\cf1 2\cf0 3\par
}");
}
private void mTestInsertXML_Click(object sender, EventArgs e)
{
myEditControl.XMLText = @"<?xml version='1.0'?>
<XTextDocument xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<XElements>
<Element xsi:type='XTextBody'>
<XElements>
<Element xsi:type='XString'>
<Text>111</Text>
</Element>
<Element xsi:type='XString' StyleIndex='0'>
<Text>111</Text>
</Element>
<Element xsi:type='XString' StyleIndex='1'>
<Text>11</Text>
</Element>
<Element xsi:type='XString' StyleIndex='2'>
<Text>1</Text>
</Element>
<Element xsi:type='XString'>
<Text>11</Text>
</Element>
<Element xsi:type='XParagraphFlag' />
</XElements>
</Element>
<Element xsi:type='XTextHeader'>
<XElements>
<Element xsi:type='XParagraphFlag' />
</XElements>
</Element>
<Element xsi:type='XTextFooter'>
<XElements>
<Element xsi:type='XParagraphFlag' />
</XElements>
</Element>
</XElements>
<Info>
<CreationTime>2012-03-29T15:47:51.1032576+08:00</CreationTime>
<LastModifiedTime>2012-03-29T15:47:51.1042577+08:00</LastModifiedTime>
<LastPrintTime>1980-01-01T00:00:00</LastPrintTime>
<Operator>DCSoft.Writer Version:1.0.1111.28434</Operator>
</Info>
<DefaultFont>
<Size>12</Size>
</DefaultFont>
<ContentStyles>
<Default>
<FontName>宋体</FontName>
<FontSize>12</FontSize>
</Default>
<Styles>
<Style Index='0'>
<Bold>true</Bold>
</Style>
<Style Index='1'>
<FontSize>24</FontSize>
<Bold>true</Bold>
</Style>
<Style Index='2'>
<FontSize>24</FontSize>
</Style>
</Styles>
</ContentStyles>
<DocumentGraphicsUnit>Document</DocumentGraphicsUnit>
<PageSettings>
<DesignerPaperWidth>0</DesignerPaperWidth>
<DesignerPaperHeight>0</DesignerPaperHeight>
</PageSettings>
<CustomerParameters />
</XTextDocument>";
}
private void mTestUpdateData_Click(object sender, EventArgs e)
{
//XTextInputFieldElement field = (XTextInputFieldElement)myEditControl.GetCurrentElement(typeof(XTextInputFieldElement));
//field.EditorTextExt = DateTime.Now.ToString();
//return;
//XTextElementList xTextElementList = this.myEditControl.Document.GetSpecifyElements(typeof(XTextInputFieldElement));
//myEditControl.IsAdministrator = true;
//foreach (XTextFieldElement xTextInputFieldElement in xTextElementList)
//{
// if (xTextInputFieldElement.Parent is XTextInputFieldElement || xTextInputFieldElement.Parent is XTextCheckBoxElement)
// {
// myEditControl.ExecuteCommand(StandardCommandNames.DeleteField, false, xTextInputFieldElement);
// //xTextInputFieldElement.EditorDelete(true);
// }
//}
//return;
//using (dlgProperty dlg = new dlgProperty())
//{
// dlg.InstanceToShow = myEditControl.ServerObject;
// dlg.Text = "This is values before update";
// dlg.ShowDialog(this);
// int result = this.myEditControl.WriteDataSource();
// if (result == 0)
// {
// MessageBox.Show("No changed");
// }
// else
// {
// dlg.Text = "This is values after updatemodified " + result + " parts";
// dlg.InstanceToShow = myEditControl.ServerObject;
// dlg.ShowDialog(this);
// }
//}
}
//private void mXML2RTF_Click(object sender, EventArgs e)
//{
// MessageBox.Show("此处演示在后台将XDesigner.Writer格式的XML文档转换为RTF文档不显示用户界面可以运用在ASP.NET或Service程序中。");
// string sourceFileName = null;
// string descFileName = null;
// using (OpenFileDialog dlg = new OpenFileDialog())
// {
// dlg.Filter = "XML文件|*.xml";
// dlg.CheckFileExists = true;
// dlg.ShowReadOnly = false;
// dlg.Title = "请选择一个XDesigner.Writer程序保存的XML文件";
// if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
// {
// sourceFileName = dlg.FileName;
// }
// else
// {
// return;
// }
// }
// using (SaveFileDialog dlg = new SaveFileDialog())
// {
// dlg.Filter = "RTF文件(*.rtf)|*.rtf";
// dlg.CheckPathExists = true;
// dlg.OverwritePrompt = true;
// if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
// {
// descFileName = dlg.FileName;
// }
// else
// {
// return;
// }
// }
// XTextDocument document = new XTextDocument();
// document.Load(sourceFileName, "xml");
// using (System.Drawing.Graphics g = document.CreateGraphics())
// {
// document.RefreshSize(g);
// document.ExecuteLayout();
// document.RefreshPages();
// document.Save(descFileName, "rtf");
// }
// MessageBox.Show(string.Format("成功的将“{0}”转换为“{1}”。", sourceFileName, descFileName));
//}
/// <summary>
/// 文档内容发生改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void myEditControl_DocumentContentChanged(object sender, WriterEventArgs e)
{
//System.Console.WriteLine("");
//System.Diagnostics.Debug.WriteLine(
// System.Environment.TickCount + ":" + myEditControl.DocumentContentVersion);
//XTextInputFieldElement field = myEditControl.Document.CurrentField as XTextInputFieldElement;
if (model.Id != 0 && delFlag)
{
if (tempList.Count > myEditControl.Document.Fields.Count
|| tempChkList.Count > myEditControl.Document.GetElementsByType(typeof(XTextCheckBoxElement)).Count)
{
if (MessageBox.Show("删除域将导致历史数据无法对应模板,是否继续?", "提示!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning,
MessageBoxDefaultButton.Button2) == DialogResult.No)
{
myEditControl.ExecuteCommand("Undo", false, false);
return;
}
else
{
//SetFiledID();
}
}
}
}
private void mTestSetInputFieldText_Click(object sender, EventArgs e)
{
XTextInputFieldElement field = (XTextInputFieldElement)myEditControl.GetCurrentElement(
typeof(XTextInputFieldElement));
if (field != null)
{
// 直接设置文本输入域的内容
field.EditorTextExt = DateTime.Now.ToString();
}
}
private void mTestInsertCheckBoxList_Click(object sender, EventArgs e)
{
myEditControl.ExecuteCommand("InsertCheckBoxList", true, null);
//myEditControl.Document.GetSpecifyElements(typeof(XTextCheckBoxElement));
}
private void mTestSetStyle_Click(object sender, EventArgs e)
{
XTextInputFieldElement field = (XTextInputFieldElement)myEditControl.Document.GetCurrentElement(typeof(XTextInputFieldElement));
if (field != null)
{
using (FontDialog dlg = new FontDialog())
{
dlg.Font = field.RuntimeStyle.Font.Value;
dlg.Color = field.RuntimeStyle.Color;
dlg.ShowColor = true;
if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
{
DocumentContentStyle newStyle = new DocumentContentStyle();
newStyle.DisableDefaultValue = true;
newStyle.Font = new XFontValue(dlg.Font);
newStyle.Color = dlg.Color;
//newStyle.BackgroundColor = Color.Yellow;
field.EditorSetContentStyle(newStyle, true);
//field.EditorText = "";
//field.EditorText = DateTime.Now.ToString();
}
}
}
}
private void mTestChangeEditorTextExt_Click(object sender, EventArgs e)
{
XTextInputFieldElement field = (XTextInputFieldElement)myEditControl.GetCurrentElement(typeof(XTextInputFieldElement));
if (field != null)
{
XTextElementList fields = myEditControl.Document.Fields;
XTextInputFieldElement nextField = (XTextInputFieldElement)fields.GetNextElement(field);
if (nextField != null)
{
nextField.EditorTextExt = Guid.NewGuid().ToString();
}
}
}
private void mPermissionConfig_Click(object sender, EventArgs e)
{
//using (dlgPermissionConfig dlg = new dlgPermissionConfig())
//{
// dlg.Document = this.myEditControl.Document;
// if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
// {
// myEditControl.RefreshDocument();
// }
//}
}
private void mLogin_Click(object sender, EventArgs e)
{
//using (dlgLogin dlg = new dlgLogin())
//{
// if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
// {
// myEditControl.UserLogin();
// }
//}
}
private void mTestChangeParagraphFormat_Click(object sender, EventArgs e)
{
myEditControl.Document.ContentStyles.Default.SpacingBeforeParagraph = 90f;
myEditControl.RefreshDocument();
}
private void mTestSetHeaderFooter_Click(object sender, EventArgs e)
{
//XTextDocument document = myEditControl.Document;
//ContentBuilder bulder = new ContentBuilder(document.Header);
//DocumentContentStyle dcs = new DocumentContentStyle();
//dcs.FontSize = 20;
//dcs.Color = System.Drawing.Color.Red;
//bulder.Append("这是一段页眉 第 ", dcs);
//XTextPageInfoElement pi = new XTextPageInfoElement();
//pi.ValueType = PageInfoValueType.PageIndex;
//pi.StyleIndex = document.ContentStyles.GetStyleIndex(dcs);
//bulder.Append(pi);
//bulder.Append("共 页", dcs);
//XTextPageInfoElement pc = new XTextPageInfoElement();
//pc.ValueType = PageInfoValueType.NumOfPages;
//pc.StyleIndex = document.ContentStyles.GetStyleIndex(dcs);
//bulder.Append(pc);
//bulder.Append("页", dcs);
//dcs = new DocumentContentStyle();
//dcs.Align = DocumentContentAlignment.Center;
////dcs.BorderBottom = true;
////dcs.BorderSpacing = 10;
////dcs.BorderWidth = 1;
//bulder.SetParagraphStyle(dcs);
//bulder = new ContentBuilder(document.Body);
//dcs = new DocumentContentStyle();
//dcs.Color = System.Drawing.Color.Yellow;
//bulder.Append("这是文档正文内容", dcs);
//bulder.AppendParagraphFlag();
//dcs = new DocumentContentStyle();
//dcs.FontSize = 40;
//bulder.Append("页面第二行", dcs);
//bulder = new ContentBuilder(document.Footer);
//dcs = new DocumentContentStyle();
//dcs.FontSize = 30;
//dcs.Color = System.Drawing.Color.Blue;
//bulder.Append("这是页脚内容", dcs);
myEditControl.Document.ContentStyles.Default.FontSize = 40;
myEditControl.Document.ContentStyles.Default.Color = System.Drawing.Color.Tomato;
myEditControl.Document.ContentStyles.Default.LineSpacingStyle = DCSoft.Drawing.LineSpacingStyle.SpaceSpecify;
myEditControl.Document.ContentStyles.Default.LineSpacing = 60;
myEditControl.RefreshDocument();
}
private void mTestInsertDocument_Click(object sender, EventArgs e)
{
myEditControl.ExecuteCommand("InsertXML", false, @"<?xml version='1.0'?><XTextDocument xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' EditorVersionString='1.1.1111.17451'><Attributes /><XElements><Element xsi:type='XTextBody'><Expressions /><Attributes /><XElements><Element xsi:type='XString' StyleIndex='1'><Text>姓名:\r\n姓名 #xm# 住址:(单位)家庭住址\r\n性别 #xb# 职业: #zy#\r\n年龄 #nl# 婚姻: #hyzk# \r\n民族 #mz# 入院日期 #ryrq#\r\n出生地 #csd# 记录日期 \r\n病史陈述者患者本人 可靠程度:\r\n</Text></Element><Element xsi:type='XParagraphFlag'><AutoCreate>true</AutoCreate></Element></XElements></Element><Element xsi:type='XTextHeader'><Expressions /><Attributes /><XElements><Element xsi:type='XParagraphFlag' StyleIndex='0'><AutoCreate>true</AutoCreate></Element></XElements></Element><Element xsi:type='XTextFooter'><Expressions /><Attributes /><XElements><Element xsi:type='XParagraphFlag'><AutoCreate>true</AutoCreate></Element></XElements></Element></XElements><Info><CreationTime>2012-09-19T14:03:29.4695325+08:00</CreationTime><LastModifiedTime>2012-09-19T14:03:29.4695325+08:00</LastModifiedTime><LastPrintTime>1980-01-01T00:00:00</LastPrintTime><Operator>DCSoft.Writer Version:1.1.1111.28206</Operator><NumOfPage>1</NumOfPage></Info><Printing>false</Printing><UserHistories /><ContentStyles><Default xsi:type='DocumentContentStyle'><FontName>宋体</FontName><FontSize>12</FontSize></Default><Styles><Style Index='0'><Align>Center</Align></Style><Style Index='1' /></Styles></ContentStyles><DocumentGraphicsUnit>Document</DocumentGraphicsUnit><PageSettings /></XTextDocument>");
//string fileName = null;
//using (OpenFileDialog dlg = new OpenFileDialog())
//{
// dlg.Filter = "*.xml|*.xml";
// dlg.CheckFileExists = true;
// if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
// {
// fileName = dlg.FileName;
// }
// else
// {
// return;
// }
//}
//XTextDocument document = new XTextDocument();
//document.Load(fileName, FileFormat.XML);
//XTextElementList list = document.Elements;
//myEditControl.Document.ImportElements(list);
//document.DocumentControler.InsertElements(list);
}
private void mInsertXML_Click(object sender, EventArgs e)
{
// XTextElement element = myEditControl.Document.CurrentElement;
//DocumentContentStyle style = new DocumentContentStyle();
//style.Bold = true;
//element.Style = style;
//myEditControl.RefreshDocument();
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Filter = "*.xml|*.xml";
dlg.CheckFileExists = true;
if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
{
using (System.IO.Stream stream = dlg.OpenFile())
{
myEditControl.ExecuteCommand("InsertXML", false, stream);
}
}
}
}
private void mTestSetDefaultStyle_Click(object sender, EventArgs e)
{
myEditControl.ExecuteCommand(
"SetDefaultStyle",
false,
"Align:Center;LineSpacingStyle:SpaceSpecify;LineSpacing:80");
}
/// <summary>
/// 使用本地文件系统
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mLocalFileSystem_Click(object sender, EventArgs e)
{
//mLocalFileSystem.Checked = true;
//mDBFileSystem.Checked = false;
//// 更换后台的服务对象
////myEditControl.AppHost.SetDataProvider(new DefaultDataProvider());
//myEditControl.AppHost.FileSystems.Docuemnt = DCSoft.Writer.Data.DefaultFileSystem.Instance;
//myEditControl.AppHost.FileSystems.Template = DCSoft.Writer.Data.DefaultFileSystem.Instance;
}
/// <summary>
/// 使用数据库文件系统
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mDBFileSystem_Click(object sender, EventArgs e)
{
//mLocalFileSystem.Checked = false;
//mDBFileSystem.Checked = true;
//// 更换后台的服务对象
//DCSoft.Writer.WinFormDemo.EMR.EMRFileSystem p = DCSoft.Writer.WinFormDemo.EMR.EMRFileSystem.Instance;
////myEditControl.AppHost.SetDataProvider(p);
//myEditControl.AppHost.FileSystems.Docuemnt = p;
//myEditControl.AppHost.FileSystems.Template = p;
}
private void toolStripMenuItem11_Click(object sender, EventArgs e)
{
myEditControl.ExecuteCommand("InsertHtml", false, @"<table border='1'>
<col width ='200px' />
<col width ='100px' />
<col width ='100px' />
<tr bgcolor='gray'>
<td>药品名称</td>
<td>用药途径</td>
<td>用药频次</td>
</tr>
<tr>
<td>苯磺酸氨氯地平片</td>
<td>口服</td>
<td>3/日</td>
</tr>
<tr>
<td>氯化钠注射液0.9%</td>
<td>静脉注射</td>
<td>1/日</td>
</tr>
<tr>
<td>注射用氨曲南</td>
<td>静脉注射</td>
<td>1/日</td>
</tr>
</table>");
}
/// <summary>
/// 显示和隐藏数据源列表功能
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mDataSourceList_Click(object sender, EventArgs e)
{
bool show = btnDataSourceList.Checked;
if (show)
{
}
this.spDataSource.Visible = show;
this.tabDataSource.Visible = show;
if (tabDataSource.Visible)
{
// 设置为设计器使用的文档控制器
myEditControl.DocumentControler = new DocumentControlerExt();
}
else
{
// 设置为普通的文档控制器
myEditControl.DocumentControler = new DocumentControler();
}
}
private void mTestGenerateContent_Click(object sender, EventArgs e)
{
////第一行页眉 医院民称
//XTextDocument document = this.myEditControl.Document;
//ContentBuilder bulder = new ContentBuilder(document.Header);
//DocumentContentStyle dcs = new DocumentContentStyle();
//dcs.FontSize = 16;
//dcs.Color = System.Drawing.Color.Gray;
//dcs.Align = DCSoft.Drawing.DocumentContentAlignment.Center;
////bulder.Append("XXXX人民医院\r\n", dcs);
//bulder.Append(System.Configuration.ConfigurationManager.AppSettings["HospitalName"].ToString() + "\r\n", dcs);
////姓名文本输入域
//XTextInputFieldElement name = new XTextInputFieldElement();
//name.FieldSettings = new InputFieldSettings();
//name.FieldSettings.EditStyle = InputFieldEditStyle.Text;
//name.DisplayFormat = new ValueFormater();
//name.ValidateStyle = new DCSoft.Common.ValueValidateStyle();
////自动绑定数据
//name.ValueBinding = new DCSoft.Writer.Data.XDataBinding();
//name.ValueBinding.DataSource = "name";//数据源的名称
//name.ValueBinding.AutoUpdate = true;//是否自动更新数据
////住院号文本输入域
//XTextInputFieldElement inpno = new XTextInputFieldElement();
//inpno.FieldSettings = new InputFieldSettings();
//inpno.FieldSettings.EditStyle = InputFieldEditStyle.Text;
//inpno.DisplayFormat = new ValueFormater();
//inpno.ValidateStyle = new DCSoft.Common.ValueValidateStyle();
////自动绑定数据
//inpno.ValueBinding = new DCSoft.Writer.Data.XDataBinding();
//inpno.ValueBinding.DataSource = "inpno";//数据源的名称
//inpno.ValueBinding.AutoUpdate = true;//是否自动更新数据
////科室文本输入域
//XTextInputFieldElement dept = new XTextInputFieldElement();
//dept.FieldSettings = new InputFieldSettings();
//dept.FieldSettings.EditStyle = InputFieldEditStyle.Text;
//dept.DisplayFormat = new ValueFormater();
//dept.ValidateStyle = new DCSoft.Common.ValueValidateStyle();
////自动绑定数据
//dept.ValueBinding = new DCSoft.Writer.Data.XDataBinding();
//dept.ValueBinding.DataSource = "dept";//数据源的名称
//dept.ValueBinding.AutoUpdate = true;//是否自动更新数据
////床号文本输入域
//XTextInputFieldElement bedno = new XTextInputFieldElement();
//bedno.FieldSettings = new InputFieldSettings();
//bedno.FieldSettings.EditStyle = InputFieldEditStyle.Text;
//bedno.DisplayFormat = new ValueFormater();
//bedno.ValidateStyle = new DCSoft.Common.ValueValidateStyle();
////自动绑定数据
//bedno.ValueBinding = new DCSoft.Writer.Data.XDataBinding();
//bedno.ValueBinding.DataSource = "bedno";//数据源的名称
//bedno.ValueBinding.AutoUpdate = true;//是否自动更新数据
////第二行页眉 病人信息
//DocumentContentStyle dcs2 = new DocumentContentStyle();
//dcs2.FontSize = 12;
//dcs2.Color = System.Drawing.Color.Gray;
//dcs2.Align = DCSoft.Drawing.DocumentContentAlignment.Center;
//bulder.Append("姓名:");
//bulder.Append(name);
//bulder.Append("\t");
//bulder.Append("住院号:");
//bulder.Append(inpno);
//bulder.Append("\t");
//bulder.Append("科室:");
//bulder.Append(dept);
//bulder.Append("\t");
//bulder.Append("床号:");
//bulder.Append(bedno);
//bulder.SetParagraphStyle(dcs2);
//myEditControl.Document.Parameters.SetValue("name", "张三");
//myEditControl.Document.Parameters.SetValue("inpno", "0001");
//myEditControl.Document.Parameters.SetValue("dept", "222");
//myEditControl.Document.Parameters.SetValue("bedno", "333");
//myEditControl.RefreshDocument();
//myEditControl.ExecuteCommand("UpdateViewForDataSource", false, null);
}
private void mTestLoadKBFromURL_Click(object sender, EventArgs e)
{
//using (DCSoft.WinForms.Native.dlgInputUrl dlg = new WinForms.Native.dlgInputUrl())
//{
// if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
// {
// string url = dlg.InputURL;
// // 注册自定义的输入域下拉列表提供者
// myEditControl.AppHost.Services.AddService(
// typeof(IListItemsProvider),
// new DCSoft.Writer.Data.DefaultListItemsProvider());
// myEditControl.ExecuteCommand("LoadKBLibrary", false, url);
// }
//}
}
private void mLoadmodelSource_Click(object sender, EventArgs e)
{
string xml = @"
<EMR_Patients>
<PA_HIS_BEINHOSPITAL_CODE>233854</PA_HIS_BEINHOSPITAL_CODE>
<PA_ID>00004613</PA_ID>
<PA_BEINHOSPITAL_GREE>0</PA_BEINHOSPITAL_GREE>
<PA_OUTPATIENT_CODE />
<PA_CARDCODE />
<PA_BEINHOSPITAL_CODE>00233854_0</PA_BEINHOSPITAL_CODE>
<PA_PIH_PATIENT_SAPCE>神经内科</PA_PIH_PATIENT_SAPCE>
<PA_CASE_HISTOR_CODE>00233854</PA_CASE_HISTOR_CODE>
<PA_NAME>种永安</PA_NAME>
<PA_SEX>男</PA_SEX>
<PA_PRITHTIME>1940-04-06 00:00:00 </PA_PRITHTIME>
<PA_HOMEPLACE>陕西扶风</PA_HOMEPLACE>
<PA_NATION>01</PA_NATION>
<PA_NATIONALITY>003</PA_NATIONALITY>
<PA_IDENTITYCARD />
<PA_WORK_UNIT>扶风县绛帐镇前进村一组</PA_WORK_UNIT>
<PA_WORKADRESS>扶风县绛帐镇前进村一组</PA_WORKADRESS>
<PA_W_POSTALCODE>722206</PA_W_POSTALCODE>
<PA_W_PHONE>5281655</PA_W_PHONE>
<PA_RPE_ADDRESS>扶风县绛帐镇前进村一组</PA_RPE_ADDRESS>
<PA_RPE_POSTALCODE>722206</PA_RPE_POSTALCODE>
<PA_RPE_PHONE>5281655</PA_RPE_PHONE>
<PA_LINKMAN_NAME>种周强</PA_LINKMAN_NAME>
<PA_LM_RAPPORT>父子</PA_LM_RAPPORT>
<PA_LM_ADDRESS>扶风县绛帐镇前进村一组</PA_LM_ADDRESS>
<PA_LM_PHONE>5281655</PA_LM_PHONE>
<PA_INSURANCE_CE_CODE />
<PA_INSURANCE_CE_NAME />
<PA_INSURANCE_CODE />
<PA_PERSONNEL_TYPE />
<PA_PATIENT_SOURCE>门诊</PA_PATIENT_SOURCE>
<PA_DOCTOR />
<PA_DIAGNOSE>脑梗死</PA_DIAGNOSE>
<PA_DIAGNOSE_NURSE />
<PA_NURCS>一般</PA_NURCS>
<PA_FASHION>门诊</PA_FASHION>
<PA_RY_TIME>2010-06-17 08:00:00 </PA_RY_TIME>
<PA_FORESTALLDIAGNOSE>无</PA_FORESTALLDIAGNOSE>
<PA_RYKB>05</PA_RYKB>
<PA_PAYMENT_NURCS>合疗</PA_PAYMENT_NURCS>
<PA_BINGAN_CODE>00233854</PA_BINGAN_CODE>
<PA_AMRRIAGE_STATUS>已婚</PA_AMRRIAGE_STATUS>
<PA_OCCUPATION>02</PA_OCCUPATION>
<PA_DISPLACE_KB>05</PA_DISPLACE_KB>
<PA_DISPLACE_BEINHOSPITAL />
<PA_LEAVEHOSPITAL_BE>05</PA_LEAVEHOSPITAL_BE>
<PA_LEAVEHOSPITAL_PATIENT>2010-07-10 15:15:19</PA_LEAVEHOSPITAL_PATIENT>
<PA_LEAVEHOSPITAL_NURCS />
<PA_PIH_NUMBEROFDAYS />
<PA_CURE_TYPE />
<PA_DIAGNOSE_DATE>1901-01-01 00:00:00 </PA_DIAGNOSE_DATE>
<PA_DIAGNOSE_DR>000036</PA_DIAGNOSE_DR>
<PA_STATE>正常</PA_STATE>
<PA_BEINHOSPITAL_BOOKER>000036</PA_BEINHOSPITAL_BOOKER>
<PA_BEINHOSPITAL_BOOKINTIME>2010-06-17 10:16:16 </PA_BEINHOSPITAL_BOOKINTIME>
<PA_LEAVEHOSPITAL_BOOKER>000036</PA_LEAVEHOSPITAL_BOOKER>
<PA_LEAVEHOSPITAL_BOOKINTIME>2010-10-10 15:15:19 </PA_LEAVEHOSPITAL_BOOKINTIME>
<PA_PYM>ZYA</PA_PYM>
</EMR_Patients>";
myEditControl.SetDocumentParameterValueXml("EMR_Patients", xml);
myEditControl.ExecuteCommand(
"FileOpen",
false,
System.IO.Path.Combine(
Application.StartupPath,
@"EMR\TemplateDocument\InpatientInfo.xml"));
myEditControl.ExecuteCommand("FormViewMode", false, null);
}
private void mGetmodelSource_Click(object sender, EventArgs e)
{
int result = (int)myEditControl.ExecuteCommand("UpdateDataSourceForView", false, null);
string xml = myEditControl.GetDocumentParameterValueXml("EMR_Patients");
System.Diagnostics.Debug.WriteLine(xml);
MessageBox.Show(result.ToString());
}
private void mTestSomething_Click(object sender, EventArgs e)
{
}
private void mInsertSimpleList_Click(object sender, EventArgs e)
{
XTextInputFieldElement field = new XTextInputFieldElement();
field.BackgroundText = "请选择值";
field.FieldSettings = new InputFieldSettings();
field.FieldSettings.EditStyle = InputFieldEditStyle.DropdownList;
field.FieldSettings.ListSource = new DCSoft.Writer.Data.ListSourceInfo();
field.FieldSettings.ListSource.RuntimeItems = new ListItemCollection();
field.FieldSettings.ListSource.RuntimeItems.AddByTextValue("列表项目1", "数值1");
field.FieldSettings.ListSource.RuntimeItems.AddByTextValue("列表项目2", "数值2");
field.FieldSettings.ListSource.RuntimeItems.AddByTextValue("列表项目3", "数值3");
field.FieldSettings.ListSource.RuntimeItems.AddByTextValue("列表项目4", "数值4");
field.FieldSettings.ListSource.RuntimeItems.AddByTextValue("列表项目5", "数值5");
myEditControl.ExecuteCommand("InsertInputField", false, field);
}
//private void mPrintMultiDocument_Click(object sender, EventArgs e)
//{
// using (DCSoft.Writer.Printing.WriterPrintDocument pd = new DCSoft.Writer.Printing.WriterPrintDocument())
// {
// while (true)
// {
// using (OpenFileDialog dlg = new OpenFileDialog())
// {
// dlg.Filter = "*.xml|*.xml";
// dlg.CheckFileExists = true;
// if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
// {
// XTextDocument doc = new XTextDocument();
// doc.Load(dlg.FileName, "xml");
// using (Graphics g = doc.CreateGraphics())
// {
// doc.RefreshSize(g);
// }
// doc.ExecuteLayout();
// doc.RefreshPages();
// pd.Documents.Add(doc);
// }
// else
// {
// break;
// }
// }
// }
// if (pd.Documents.Count > 0)
// {
// using (PrintPreviewDialog dlg = new PrintPreviewDialog())
// {
// dlg.Document = pd;
// pd.UpdateDocumentsState();
// dlg.ShowDialog(this);
// pd.RestoreDocumentsState();
// }
// }
// }
//}
private void mPrintDocumentBackground_Click(object sender, EventArgs e)
{
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Filter = "*.xml|*.xml";
dlg.CheckFileExists = true;
if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
{
// 后台加载文档
string fileName = dlg.FileName;
XTextDocument document = new XTextDocument();
document.Load(fileName, "xml");
// 创建后台打印器
DocumentPrinter dp = new DocumentPrinter();
// 添加要打印的文档,可以添加多个
dp.Documents.Add(document);
// 准备打印
dp.PreparePrintDocument();
// 执行后台打印
dp.PrintDocument(false);
}
}
}
private void mDocumentValidate_Click(object sender, EventArgs e)
{
ValueValidateResultList list = (ValueValidateResultList)myEditControl.ExecuteCommand("DocumentValueValidate", false, null);
if (list != null && list.Count > 0)
{
// 校验不成功
StringBuilder str = new StringBuilder();
foreach (ValueValidateResult item in list)
{
if (str.Length > 0)
{
str.Append(Environment.NewLine);
}
str.Append(item.Element.ID + ":" + item.Message);
}
MessageBox.Show(str.ToString());
}
}
private void mViewSelectionXML_Click(object sender, EventArgs e)
{
string xmlSource = Convert.ToString(
this.myEditControl.ExecuteCommand("GetSelectionContentText", true, "xml"));
System.Diagnostics.Debug.WriteLine(xmlSource);
}
private void mViewSelectionRTF_Click(object sender, EventArgs e)
{
string rtfSource = Convert.ToString(
this.myEditControl.ExecuteCommand("GetSelectionContentText", true, "rtf"));
System.Diagnostics.Debug.WriteLine(rtfSource);
}
private void mInsertXmlFromClipboard_Click(object sender, EventArgs e)
{
string xml = Clipboard.GetText();
if (string.IsNullOrEmpty(xml) == false)
{
myEditControl.ExecuteCommand("InsertXML", false, xml);
}
}
#endregion Click_Event
/// <summary>
/// Handle commands
/// </summary>
/// <param name="Command">command name</param>
public void HandleCommand(string Command)
{
if (Command == null)
return;
Command = Command.Trim();
try
{
switch (Command)
{
case MyCommandNames.OpenXMLDemo:
myEditControl.ExecuteCommand("FormViewMode", false, false);
OpenDemoFile("DCSoft.Writer.WinFormDemo.DemoFile.demo.xml", "xml");
break;
case MyCommandNames.OpenFormViewDemo:
if (OpenDemoFile("DCSoft.Writer.WinFormDemo.DemoFile.FormViewModeDemo.xml", "xml"))
{
myEditControl.ExecuteCommand("FormViewMode", false, true);
myEditControl.AutoScrollPosition = new Point(0, 0);
myEditControl.UpdateTextCaret();
}
break;
case MyCommandNames.OpenNursingRecordDemo:
{
if (OpenDemoFile("DCSoft.Writer.WinFormDemo.DemoFile.NursingRecord.xml", "xml"))
{
myEditControl.ExecuteCommand("FormViewMode", false, false);
}
}
break;
default:
#if DEBUG
this.Alert("Bad command:" + Command);
#endif
break;
}
}
catch (Exception ext)
{
//this.Alert(ResourceStrings._EXEERR + ext.ToString());
//this.Status = ResourceStrings._EXEERR + ext.Message;
this.Alert("执行命令错误:" + ext.ToString());
this.Status = "错误:" + ext.Message;
}
this.UpdateFormText();
}
/// <summary>
/// Show a message box
/// </summary>
/// <param name="msg">message text</param>
private void Alert(string msg)
{
MessageBox.Show(this, msg, this.Text);
}
/// <summary>
/// get or set main status text
/// </summary>
private string Status
{
get { return this.lblStatus.Text; }
set { this.lblStatus.Text = value; this.Update(); }
}
private void UpdateFormText()
{
//string text = System.Configuration.ConfigurationManager.AppSettings["HospitalName"].ToString();
string text = "";
if (string.IsNullOrEmpty(this.myEditControl.Document.Info.Title) == false)
{
text = myEditControl.Document.Info.Title + "-" + text;
}
else if (string.IsNullOrEmpty(this.myEditControl.Document.FileName) == false)
{
text = myEditControl.Document.FileName + " - " + text;
}
if (myEditControl.Document.Modified)
{
text = text + " *";
}
this.Text = text;
}
private bool OpenDemoFile(string resourceName, string format)
{
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
try
{
System.IO.Stream stream = this.GetType().Assembly.GetManifestResourceStream(resourceName);
if (stream != null)
{
using (stream)
{
FileOpenCommandParameter fcp = new FileOpenCommandParameter();
fcp.Format = format;
//fcp.FileName = resourceName;
fcp.InputStream = stream;
bool result = (bool)myEditControl.ExecuteCommand("FileOpen", true, fcp);
if (result == false)
{
this.Status = fcp.Message;
}
return result;
}
}
return false;
}
finally
{
this.Cursor = System.Windows.Forms.Cursors.Default;
}
}
/// <summary>
/// handle element hover event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void myEditControl_HoverElementChanged(object sender, EventArgs e)
{
provider.Document = myEditControl.Document;
provider.Prefix = '{';
provider.Endfix = '}';
XTextRange range;
try
{
range = provider.GetRange(myEditControl.HoverElement);
}
catch (Exception )
{
range = null;
}
if (range != null)
{
this.myEditControl.HighlightRange = new HighlightInfo(range);
}
else
{
this.myEditControl.HighlightRange = null;
}
}
/// <summary>
/// Handle selection changed event in editor control
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void myEditControl_SelectionChanged(object sender, EventArgs e)
{
//XTextFieldElement field = (XTextFieldElement)myEditControl.Document.CurrentField;
//field.EditorTextExt = "bbb";
provider.Document = myEditControl.Document;
provider.Prefix = '{';
provider.Endfix = '}';
XTextRange range = provider.GetRange(myEditControl.CurrentElement);
if (range != null)
{
myEditControl.HighlightRange = new HighlightInfo(range);
}
else
{
myEditControl.HighlightRange = null;
}
XTextLine line = myEditControl.Document.CurrentContentElement.CurrentLine;
if (line != null && line.OwnerPage != null)
{
string txt =
string.Format("第 {0} 页 第 {1} 行 第 {2} 列",
Convert.ToString(line.OwnerPage.PageIndex),
Convert.ToString(myEditControl.CurrentLineIndexInPage),
Convert.ToString(myEditControl.CurrentColumnIndex));
if (myEditControl.Selection.Length != 0)
{
txt = txt + string.Format(
" 选择了{0}个元素",
Math.Abs(myEditControl.Selection.Length));
}
Point p = myEditControl.SelectionStartPosition;
this.lblPosition.Text = txt + " X:" + p.X + " Y:" + p.Y;
}
UpdateFormText();
SetContextMenu();
if (this.dstvControler != null)
{
this.dstvControler.UpdateCurrentDataSourceNode(myEditControl);
}
//this.Text = myEditControl.CaretPosition.ToString();
}
/// <summary>
/// 设置编辑器控件的快捷菜单
/// </summary>
private void SetContextMenu()
{
if (Math.Abs(myEditControl.Selection.Length) == 1)
{
XTextElement element = this.myEditControl.Selection.ContentElements[0];
if (element is XTextImageElement)
{
this.myEditControl.ContextMenuStrip = this.cmImage;
return;
}
}
bool isInCell = false;
if (myEditControl.Selection.Cells != null && myEditControl.Selection.Cells.Count > 0)
{
isInCell = true;
}
else
{
XTextContainerElement c = null;
int index = 0;
myEditControl.Document.Content.GetCurrentPositionInfo(out c, out index);
if (c is XTextTableCellElement || c.OwnerCell != null)
{
isInCell = true;
}
}
if (isInCell)
{
myEditControl.ContextMenuStrip = cmTableCell;
return;
}
myEditControl.ContextMenuStrip = cmEdit;
}
public void frmTemplate_FormClosing(object sender, FormClosingEventArgs e)
{
if (this.Text.Trim().EndsWith("*"))
{
DialogResult result = MessageBox.Show("文件已经修改,尚未保存,是否保存文件?", "系统提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1);
switch(result)
{
case DialogResult.Yes :
try
{
InsertOrUpdate();
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
e.Cancel = true;
}
break;
case DialogResult.No :
break;
case DialogResult.Cancel :
e.Cancel = true;
break;
default:
break;
}
}
//bool b = (bool)myEditControl.ExecuteCommand("FileQueryExit", true, null);
//if (b == false)
//{
// e.Cancel = true;
//}
}
private void myEditControl_StatusTextChanged(object sender, EventArgs e)
{
lblStatus.Text = myEditControl.StatusText;
this.statusStrip1.Refresh();
}
/// <summary>
/// 编辑器中执行命令时的错误处理
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void myEditControl_CommandError(object sender, CommandErrorEventArgs args)
{
MessageBox.Show(
this,
args.CommandName + "\r\n" + args.Exception.ToString(),
this.Text,
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
private void myEditControl_AfterExecuteCommand(object sender, WriterCommandEventArgs args)
{
if (args.Name == "LoadKBLibrary")
{
tvwKB.KBLibrary = myEditControl.AppHost.KBLibrary;
tvwKB.RefreshView();
}
//SetFiledID();
//MessageBox.Show(args.Name);
}
#region
private void myEditControl_EventCanInsertObject(object sender, CanInsertObjectEventArgs args)
{
if (this.dstvControler != null)
{
this.dstvControler.HandleCanInsertObjectEvent(myEditControl, args);
}
}
private void myEditControl_EventInsertObject(object sender, InsertObjectEventArgs args)
{
//if (this.dstvControler != null)
//{
// this.dstvControler.HandleInsertObjectEvent(myEditControl, args);
//}
object obj = args.DataObject.GetData(args.DataObject.GetFormats()[0]);
//SetFiledID();
}
#endregion
/// <summary>
/// 保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripButton2_Click(object sender, EventArgs e)
{
//SetFiledID();
//myEditControl.Document.Style.RemoveSameStyle(myEditControl.Document.Style);
//XTextElement elementTemp = myEditControl.Document.GetElementById("D201605091434574203336");
//if (elementTemp != null)
//{
// elementTemp.Text = "哎呀我去!";
// if (elementTemp is XTextCheckBoxElement)
// {
// ((XTextCheckBoxElement)elementTemp).Checked = true;
// }
//}
try
{
InsertOrUpdate();
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
return;
}
//XTextElementList xlist = myEditControl.Document.Elements;
//XTextElementList xchkList = myEditControl.Document.GetElementsByType(typeof(XTextCheckBoxElement));
//foreach (XTextElement element in xchkList)
//{
// XTextCheckBoxElement field = (XTextCheckBoxElement)element;
// field.ID = field.GroupName;
// Console.WriteLine(field.Name);
//}
//XTextElementList xlist = myEditControl.Document.Fields;
//foreach(XTextElement element in xlist)
//{
// if (element is XTextInputFieldElement)
// {
// XTextInputFieldElement field = (XTextInputFieldElement)element;
// //field.EditorTextExt = xlist.LastElement.Text;
// for (int i = 0; i < field.Elements.Count; i++)
// {
// field.Elements[i].StyleIndex = xlist.LastElement.Elements[i].StyleIndex;
// //Type type = typeof(ContentStyle);
// //DocumentContentStyle cstyle = new DocumentContentStyle();
// //System.Reflection.PropertyInfo prop = type.GetProperty("Bold");
// //prop.SetValue(cstyle, true, null);
// //object value = prop.GetValue(cstyle, null);
// //field.Elements[i].Style = cstyle;
// }
// //ContentStyle cstyle = field.RuntimeStyle;
// //string text = field.EditorTextExt;
// //DocumentContentStyle style = field.Style;
// ////field.EditorTextExt = ((XTextInputFieldElement)(xlist.LastContentElement)).EditorTextExt;
// //field.EditorTextExt = xlist.LastElement.Text;
// //field.Style = xlist.LastElement.Style;
// }
//}
//ContentStyleList cslist = myEditControl.Document.ContentStyles.Styles;
//foreach (ContentStyle element in cslist)
//{
// element.ToString();
//}
}
private void eet_ContentChanging(object sender, ContentChangingEventArgs args)
{
//if (args. == false)
//{
// txtLog.AppendText(Environment.NewLine + "输入域 " + args.Element.ID + " 内容发生改变!");
//}
//MessageBox.Show(args.Element.ID);
}
public void InsertOrUpdate()
{
try
{
//frmTitle frmTitle = new frmTitle();
//frmTitle.model = model;
//if (frmTitle.ShowDialog() != DialogResult.OK)
//{
// return;
//}
//model = frmTitle.model;
if (model.XmlFileName == null || model.XmlFileName.Equals(string.Empty))
{
return;
}
model.XmlFile = myEditControl.Document.XMLText;
SetXMLStatic();
//如果不为空,则“编辑”状态
if (model.Id != 0)
{
DocumentDAL.UpdateTemplate(model);
}
else
{
DocumentDAL.InsertTemplate(model);
}
MessageBox.Show("保存成功!");
myEditControl.Document.FileName = model.XmlFileName;
myEditControl.Document.Modified = false;
myEditControl.Document.OnSelectionChanged();
//this.FormClosing -= new System.Windows.Forms.FormClosingEventHandler(this.frmTemplate_FormClosing);
//Close();
}
catch (Exception exp)
{
throw exp;
}
}
private void eetChk_MouseClick(object sender, ElementMouseEventArgs args)
{
if (args.Element is XTextCheckBoxElement || args.Element is XTextRadioBoxElement)
{
//var pName = args.Element.GetType().GetProperty("Name");
//var name = pName.GetValue(args.Element, null) ?? "";
//try
//{
// Object rslt = type.InvokeMember(
// "MouseClickEvent",
// BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Static,
// null,
// null, // for static class
// new object[] { });
//}
//catch (Exception exp)
//{
// MessageBox.Show(exp.StackTrace + ":" + exp.Message);
//}
}
}
/// <summary>
/// 创建ID
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
private string CreateID(object obj)
{
string id = string.Empty;
id = "D" + DateTime.Now.ToString("yyyyMMddHHmmss") + obj.GetHashCode();
return id;
}
/// <summary>
/// 设置ID
/// </summary>
void SetFiledID()
{
if (tempList.Count != myEditControl.Document.Fields.Count)
{
if (tempList.Count < myEditControl.Document.Fields.Count)
{
//XTextElementList cloneList = myEditControl.Document.Fields.Clone();
myEditControl.Document.Fields.ToArray().Except(tempList.ToArray())
.ToList<XTextElement>().ForEach(element => element.ID = CreateID(element));
}
tempList.Clear();
tempList.AddRange(myEditControl.Document.Fields);
}
if (tempChkList.Count != myEditControl.Document.GetElementsByType(typeof(XTextCheckBoxElement)).Count)
{
if (tempChkList.Count < myEditControl.Document.GetElementsByType(typeof(XTextCheckBoxElement)).Count)
{
//XTextElementList cloneList = myEditControl.Document.Fields.Clone();
myEditControl.Document.GetElementsByType(typeof(XTextCheckBoxElement)).ToArray().Except(tempChkList.ToArray())
.ToList<XTextElement>().ForEach(element => element.ID = CreateID(element));
}
tempChkList.Clear();
tempChkList.AddRange(myEditControl.Document.GetElementsByType(typeof(XTextCheckBoxElement)));
}
myEditControl.Document.Fields.ToArray()
.ToList<XTextElement>().Where(element => element.ID == null || element.ID==string.Empty).ToList().ForEach(element => element.ID = CreateID(element));
tempChkList.ToArray()
.ToList<XTextElement>().Where(element => element.ID == null || element.ID == string.Empty).ToList().ForEach(element => element.ID = CreateID(element));
UpdateListView();
}
/// <summary>
/// 更新统计域
/// </summary>
private void UpdateListView()
{
XmlDocument doc = new XmlDocument();
if (model.XmlStatic!=null && model.XmlStatic.Length > 0)
{
doc.LoadXml(model.XmlStatic);
}
else
{
doc = null;
}
//this.listFields.BeginUpdate();
//listFields.Items.Clear();
//for (int i = 0; i < tempList.Count; i++)
//{
// ListViewItem lvi = new ListViewItem();
// lvi.ImageIndex = 0;
// lvi.Text = ((XTextInputFieldElementBase)tempList[i]).BackgroundText;
// lvi.SubItems.Add(tempList[i].ID);
// if (doc != null)
// {
// lvi.SubItems.Add(doc.DocumentElement.SelectSingleNode("//Item[@Id='" + tempList[i].ID + "']") == null
// ? "" : doc.DocumentElement.SelectSingleNode("//Item[@Id='" + tempList[i].ID + "']").Attributes["Group"].Value);
// }
// listFields.Items.Add(lvi);
//}
//for (int i = 0; i < tempChkList.Count; i++)
//{
// ListViewItem lvi = new ListViewItem();
// lvi.ImageIndex = 1;
// lvi.Text = ((XTextCheckBoxElement)tempChkList[i]).Name;
// lvi.SubItems.Add(tempChkList[i].ID);
// if (doc != null)
// {
// lvi.SubItems.Add(doc.DocumentElement.SelectSingleNode("//Item[@Id='" + tempChkList[i].ID + "']") == null
// ? "" : doc.DocumentElement.SelectSingleNode("//Item[@Id='" + tempChkList[i].ID + "']").Attributes["Group"].Value);
// }
// listFields.Items.Add(lvi);
//}
//this.listFields.EndUpdate();
}
private void tabDataSource_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabDataSource.SelectedIndex == 0)
{
tabDataSource.Size = new Size(331, 560);
}
else if (tabDataSource.SelectedIndex == 1)
{
tabDataSource.Size = new Size(380, 560);
}
}
//private void listFields_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
//{
// //myEditControl.Document.HighlightManager.HighlightRange.a
// try
// {
// for (int i = 0; i < listFields.SelectedItems.Count; i++)
// {
// XTextElement element = myEditControl.Document.GetElementById(listFields.SelectedItems[i].SubItems[1].Text);
// if (element != null)
// {
// element.Visible = true;
// element.Focus();
// //XTextRange range = new XTextRange(element, 0, element.Elements.Count);
// //provider.Document = myEditControl.Document;
// //provider.Prefix = '{';
// //provider.Endfix = '}';
// //XTextRange range = provider.CreateRange(element);
// //if (range != null)
// //{
// // myEditControl.HighlightRange = new HighlightInfo(range);
// //}
// }
// }
// }
// catch (Exception exp)
// {
// lblStatus.Text = exp.Message;
// return;
// }
//}
private void btnRefresh_Click(object sender, EventArgs e)
{
//SetFiledID();
}
/// <summary>
/// 给XMLStatic赋值
/// </summary>
private void SetXMLStatic()
{
XmlDocument doc = new XmlDocument();
XmlElement rootNode = doc.CreateElement("Root");
doc.AppendChild(rootNode);
XmlElement clickEnventNode = doc.CreateElement("ClickEvent");
clickEnventNode.InnerText = this.rtbClick.Text;
XmlElement contentChangedEnventNode = doc.CreateElement("ContentChangedEnvent");
contentChangedEnventNode.InnerText = this.rtbContent.Text;
rootNode.AppendChild(clickEnventNode);
rootNode.AppendChild(contentChangedEnventNode);
//for (int i = 0; i < listFields.Items.Count; i++)
//{
// if (listFields.Items[i].SubItems.Count < 3
// || listFields.Items[i].SubItems[2].Text.Trim().Equals(string.Empty))
// {
// continue;
// }
// else
// {
// XmlElement itemNode = doc.CreateElement("Item");
// itemNode.SetAttribute("Id", listFields.Items[i].SubItems[1].Text);
// itemNode.SetAttribute("Group", listFields.Items[i].SubItems[2].Text.Trim());
// rootNode.AppendChild(itemNode);
// }
//}
model.XmlStatic = doc.OuterXml;
//if (doc.GetElementsByTagName("Item").Count > 0)
//{
// model.XmlStatic = doc.OuterXml;
//}
}
private void tsbPrint_Click(object sender, EventArgs e)
{
WriterControl wc = new WriterControl();
SwapByRef(myEditControl);
//myEditControl.Document.EditorControl.FreezeUI();
//delFlag = false;
//XTextElementList tempChkList = new XTextElementList();
//tempChkList = wc.Document.GetElementsByType(typeof(XTextCheckBoxElementBase));
//wc.FormView = FormViewMode.Disable;
//for (int i = 0; i < tempChkList.Count; i++)
//{
// ((XTextCheckBoxElementBase)tempChkList[i]).Deleteable = true;
// ((XTextCheckBoxElementBase)tempChkList[i]).Select();
// //
// wc.ExecuteCommand("Delete", false, tempChkList[i]);
// wc.ExecuteCommand("InsertImage", false, tempChkList[i].CreateContentImage());
// ((XTextCheckBoxElementBase)tempChkList[i]).EditorRefreshView();
//}
//delFlag = true;
//wc.RefreshDocument();
//wc.Dispose();
//myEditControl.Document.EditorControl.ReleaseFreezeUI();
//myEditControl.Document.EditorControl.UpdatePages();
}
void SwapByRef(WriterControl a)
{
delFlag = false;
WriterControl wc = new WriterControl();
wc.Document = a.Document;
XTextElementList tempChkList = new XTextElementList();
tempChkList = wc.Document.GetElementsByType(typeof(XTextCheckBoxElementBase));
wc.FormView = FormViewMode.Disable;
for (int i = 0; i < tempChkList.Count; i++)
{
((XTextCheckBoxElementBase)tempChkList[i]).Deleteable = true;
((XTextCheckBoxElementBase)tempChkList[i]).Select();
//
wc.ExecuteCommand("Delete", false, tempChkList[i]);
wc.ExecuteCommand("InsertImage", false, tempChkList[i].CreateContentImage());
((XTextCheckBoxElementBase)tempChkList[i]).EditorRefreshView();
}
delFlag = true;
wc.RefreshDocument();
}
private void btnID_Click(object sender, EventArgs e)
{
//if (listFields.CheckedItems.Count == 0)
//{
// MessageBox.Show("请选择数据!");
// return;
//}
//using (frmFieldsID frmFieldsID = new frmFieldsID())
//{
// frmFieldsID.items = listFields.CheckedItems;
// frmFieldsID.FormClosing += new FormClosingEventHandler(frmFieldsID_FormClosing);
// frmFieldsID.ShowDialog();
//}
}
private void frmFieldsID_FormClosing(object sender, FormClosingEventArgs e)
{
}
private void tvEvent_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
try
{
TreeNode node = e.Node;
XTextElement element = myEditControl.Document.GetElementById(node.Text);
if (element != null)
{
element.Visible = true;
element.Focus();
}
}
catch (Exception)
{
throw;
}
}
private void btnNewEvent_Click(object sender, EventArgs e)
{
//frmElementEvents = frmElementEvents.CreateInstance(this.tvEvent);
//frmElementEvents.IsNew = true;
//frmElementEvents.StartPosition = FormStartPosition.CenterScreen;
//frmElementEvents.FormClosing += new FormClosingEventHandler(frmElementEvents_FormClosing);
//frmElementEvents.Show();
}
void frmElementEvents_FormClosing(object sender, FormClosingEventArgs e)
{
//if (frmElementEvents.returnNode.Text == "")
//{
// return;
//}
}
}
public class PrintTemplate
{
public int Id { get; set; }
public int ParentId { get; set; }
public string XmlFileName { get; set; }
public string XmlFile { get; set; }
public string XmlStatic { get; set; }
//public int PermissionLv { get; set { value = 0; } }
public int TemplateOrder { get; set; }
public int IsValid { get; set; }
public string OperatorNo { get; set; }
public DateTime OperatorDate { get; set; }
public int PrintDocumentId { get; set; }
}
public class PrintDocument
{
public int Id { get; set; }
public int PatientId { get; set; }
public int TemplateId { get; set; }
public string XmlFileName { get; set; }
public string XmlFile { get; set; }
public string XmlStatic { get; set; }
public int IsValid { get; set; }
public string OperatorNo { get; set; }
public DateTime OperatorDate { get; set; }
public string RecordId { get; set; }
public string Remark { get; set; }
public string OrderNo { get; set; }
}
}