文书打包反射

This commit is contained in:
leomon 2023-08-15 23:33:21 +08:00
parent 692b93a583
commit d0012438a0
19 changed files with 52 additions and 154 deletions

View File

@ -43,11 +43,11 @@
</Reference> </Reference>
<Reference Include="DevComponents.DotNetBar.SuperGrid, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL"> <Reference Include="DevComponents.DotNetBar.SuperGrid, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>Extensions\DevComponents.DotNetBar.SuperGrid.dll</HintPath> <HintPath>..\AIMS\Extensions\DevComponents.DotNetBar.SuperGrid.dll</HintPath>
</Reference> </Reference>
<Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL"> <Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\DotNetBar for Windows Forms\DevComponents.DotNetBar2.dll</HintPath> <HintPath>..\AIMS\Extensions\DevComponents.DotNetBar2.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
@ -254,12 +254,30 @@
<Compile Include="DocManager\frmDocumentSingle.Designer.cs"> <Compile Include="DocManager\frmDocumentSingle.Designer.cs">
<DependentUpon>frmDocumentSingle.cs</DependentUpon> <DependentUpon>frmDocumentSingle.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="DocManager\frmKB.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DocManager\frmKB.Designer.cs">
<DependentUpon>frmKB.cs</DependentUpon>
</Compile>
<Compile Include="DocManager\frmTemplateD.cs"> <Compile Include="DocManager\frmTemplateD.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="DocManager\frmTemplateD.designer.cs"> <Compile Include="DocManager\frmTemplateD.designer.cs">
<DependentUpon>frmTemplateD.cs</DependentUpon> <DependentUpon>frmTemplateD.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="DocManager\frmUserTempPurview.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DocManager\frmUserTempPurview.Designer.cs">
<DependentUpon>frmUserTempPurview.cs</DependentUpon>
</Compile>
<Compile Include="DocManager\frmUserTempPurviewDetail.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DocManager\frmUserTempPurviewDetail.Designer.cs">
<DependentUpon>frmUserTempPurviewDetail.cs</DependentUpon>
</Compile>
<Compile Include="DrugManagement\frmDosageKind.cs"> <Compile Include="DrugManagement\frmDosageKind.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -951,10 +969,19 @@
<EmbeddedResource Include="DocManager\frmDocumentSingle.resx"> <EmbeddedResource Include="DocManager\frmDocumentSingle.resx">
<DependentUpon>frmDocumentSingle.cs</DependentUpon> <DependentUpon>frmDocumentSingle.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="DocManager\frmKB.resx">
<DependentUpon>frmKB.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DocManager\frmTemplateD.resx"> <EmbeddedResource Include="DocManager\frmTemplateD.resx">
<DependentUpon>frmTemplateD.cs</DependentUpon> <DependentUpon>frmTemplateD.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="DocManager\frmUserTempPurview.resx">
<DependentUpon>frmUserTempPurview.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DocManager\frmUserTempPurviewDetail.resx">
<DependentUpon>frmUserTempPurviewDetail.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DrugManagement\frmDosageKind.resx"> <EmbeddedResource Include="DrugManagement\frmDosageKind.resx">
<DependentUpon>frmDosageKind.cs</DependentUpon> <DependentUpon>frmDosageKind.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@ -367,19 +367,9 @@ namespace AIMS
} }
public Form GetForm(string Path) public Form GetForm(string Path)
{ {
object result = null; object result = null;
if (Path.Contains("AIMS") || Path.Contains("DataDictionary") || Path.Contains("DrugManagement"))
{
Type type = Type.GetType(Path); Type type = Type.GetType(Path);
result = (Form)Activator.CreateInstance(type); result = (Form)Activator.CreateInstance(type);
}
else
{
Type typeofControl = null;
Assembly tempAssembly = Assembly.LoadFrom("" + Path.Split('.')[0].ToString() + ".DLL");
typeofControl = tempAssembly.GetType(Path);
result = (Form)Activator.CreateInstance(typeofControl);
}
return (Form)result; return (Form)result;
} }

View File

@ -116,7 +116,9 @@ namespace AIMS.OperationAfter.UI
} }
private void timerLoadRescue_Tick(object sender, EventArgs e) private void timerLoadRescue_Tick(object sender, EventArgs e)
{ {
timerLoadRescue.Enabled=false;
btnFind_Click(null, null); btnFind_Click(null, null);
} }
/// <summary> /// <summary>
/// 绑定基础表项目数据 到 ComboBox /// 绑定基础表项目数据 到 ComboBox

View File

@ -66,20 +66,10 @@ namespace AIMS
} }
} }
public Form GetForm(string Path) public Form GetForm(string Path)
{ {
object result = null; object result = null;
if (Path.Contains("AIMS") ||Path.Contains("DataDictionary") ||Path.Contains("DrugManagement"))
{
Type type = Type.GetType(Path); Type type = Type.GetType(Path);
result = (Form)Activator.CreateInstance(type); result = (Form)Activator.CreateInstance(type);
}
else
{
Type typeofControl = null;
Assembly tempAssembly = Assembly.LoadFrom("" + Path.Split('.')[0].ToString() + ".DLL");
typeofControl = tempAssembly.GetType(Path);
result = (Form)Activator.CreateInstance(typeofControl);
}
return (Form)result; return (Form)result;
} }

View File

@ -50,7 +50,7 @@ namespace DocumentManagement
/// 知识树节点排序 /// 知识树节点排序
/// </summary> /// </summary>
/// <param name="ls">节点list</param> /// <param name="ls">节点list</param>
internal static void SetOrders(List<string> ls) public static void SetOrders(List<string> ls)
{ {
try try
{ {
@ -366,7 +366,7 @@ namespace DocumentManagement
return dt; return dt;
} }
internal static void InsertEntry(KBEntry entry) public static void InsertEntry(KBEntry entry)
{ {
try try
{ {
@ -418,7 +418,7 @@ namespace DocumentManagement
} }
} }
internal static void UpdateEntry(KBEntry entry) public static void UpdateEntry(KBEntry entry)
{ {
try try
{ {
@ -455,7 +455,7 @@ namespace DocumentManagement
} }
} }
internal static void DeleteEntry(string id) public static void DeleteEntry(string id)
{ {
try try
{ {

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Data; using System.Data;
namespace DocumentManagement.DAL namespace DocumentManagement.DAL
{ {
class PrintTemplateDB public class PrintTemplateDB
{ {
public static void Add(Model.PrintTemplate PrintTemplateObj) public static void Add(Model.PrintTemplate PrintTemplateObj)
{ {

View File

@ -12,6 +12,8 @@
<AssemblyName>DocumentManagement</AssemblyName> <AssemblyName>DocumentManagement</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -40,7 +42,7 @@
</Reference> </Reference>
<Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL"> <Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\AIMS\DLL\DevComponents.DotNetBar2.dll</HintPath> <HintPath>..\AIMS\Extensions\DevComponents.DotNetBar2.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"> <Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
@ -140,12 +142,6 @@
<Compile Include="UI\ExtWriterControl.designer.cs"> <Compile Include="UI\ExtWriterControl.designer.cs">
<DependentUpon>ExtWriterControl.cs</DependentUpon> <DependentUpon>ExtWriterControl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\frmKB.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\frmKB.Designer.cs">
<DependentUpon>frmKB.cs</DependentUpon>
</Compile>
<Compile Include="UI\frmParentSelect.cs"> <Compile Include="UI\frmParentSelect.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -170,18 +166,6 @@
<Compile Include="UI\frmTitle.designer.cs"> <Compile Include="UI\frmTitle.designer.cs">
<DependentUpon>frmTitle.cs</DependentUpon> <DependentUpon>frmTitle.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\frmUserTempPurview.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\frmUserTempPurview.Designer.cs">
<DependentUpon>frmUserTempPurview.cs</DependentUpon>
</Compile>
<Compile Include="UI\frmUserTempPurviewDetail.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\frmUserTempPurviewDetail.Designer.cs">
<DependentUpon>frmUserTempPurviewDetail.cs</DependentUpon>
</Compile>
<Compile Include="UI\frmViewSelect.cs"> <Compile Include="UI\frmViewSelect.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -215,9 +199,6 @@
<EmbeddedResource Include="UI\ExtWriterControl.zh-TW.resx"> <EmbeddedResource Include="UI\ExtWriterControl.zh-TW.resx">
<DependentUpon>ExtWriterControl.cs</DependentUpon> <DependentUpon>ExtWriterControl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UI\frmKB.resx">
<DependentUpon>frmKB.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\frmParentSelect.resx"> <EmbeddedResource Include="UI\frmParentSelect.resx">
<DependentUpon>frmParentSelect.cs</DependentUpon> <DependentUpon>frmParentSelect.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
@ -234,12 +215,6 @@
<EmbeddedResource Include="UI\frmTitle.resx"> <EmbeddedResource Include="UI\frmTitle.resx">
<DependentUpon>frmTitle.cs</DependentUpon> <DependentUpon>frmTitle.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UI\frmUserTempPurview.resx">
<DependentUpon>frmUserTempPurview.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\frmUserTempPurviewDetail.resx">
<DependentUpon>frmUserTempPurviewDetail.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\frmViewSelect.resx"> <EmbeddedResource Include="UI\frmViewSelect.resx">
<DependentUpon>frmViewSelect.cs</DependentUpon> <DependentUpon>frmViewSelect.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@ -58,9 +58,9 @@ namespace DocumentManagement
private FlagXTextRangeProvider provider = new FlagXTextRangeProvider(); private FlagXTextRangeProvider provider = new FlagXTextRangeProvider();
private CompilerResults cr; //private CompilerResults cr;
private Type type; //private Type type;
public frmTemplate() public frmTemplate()
{ {
@ -295,96 +295,7 @@ namespace DocumentManagement
//} //}
//InitCodeCompiler(); //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> /// <summary>
/// Handle after load document /// Handle after load document
/// </summary> /// </summary>

View File

@ -37,7 +37,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL"> <Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\AIMS\DLL\DevComponents.DotNetBar2.dll</HintPath> <HintPath>..\AIMS\Extensions\DevComponents.DotNetBar2.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

View File

@ -72,7 +72,10 @@
<Reference Include="DCSoft.Writer"> <Reference Include="DCSoft.Writer">
<HintPath>..\AIMS\Extensions\DCSoft.Writer.dll</HintPath> <HintPath>..\AIMS\Extensions\DCSoft.Writer.dll</HintPath>
</Reference> </Reference>
<Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL" /> <Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\AIMS\Extensions\DevComponents.DotNetBar2.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\AIMS\Extensions\Newtonsoft.Json.dll</HintPath> <HintPath>..\AIMS\Extensions\Newtonsoft.Json.dll</HintPath>