基线 SVN r240

SVN-Revision: r240
This commit is contained in:
cyf
2025-02-06 06:46:06 +00:00
commit ab56a9bcf7
5317 changed files with 902274 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NPOI" publicKeyToken="0df73ec7942b34e1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.3.1" newVersion="2.1.3.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lskj.Util;
using Lskj.Business;
using System.Windows.Forms;
using Lskj.Model;
namespace Lskj.AutoWordFile
{
/// <summary>
/// c#库被调用统一接口类
/// </summary>
public sealed class DllBaseClass : IForm
{
public DllBaseClass()
{
}
public DllBaseClass(string[] obj)
{
try
{
//obj[5] = "通用测试报告";
DynamicAutoCreate moduleModel = new DynamicAutoCreate(obj);
FrmMain main = new FrmMain();
this.SubForm = main;
main.Model = moduleModel;
}
catch (Exception ex)
{
LogUtil.WriteError("Lskj.AutoWordFile.dll--参数错误-->" + obj.ToString(), ex);
}
}
/// <summary>
/// 窗口
/// </summary>
public Form SubForm { get; set; }
}
}
+160
View File
@@ -0,0 +1,160 @@
namespace Lskj.AutoWordFile
{
partial class FrmMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.panel2 = new System.Windows.Forms.Panel();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.panel1 = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label4 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// panel2
//
this.panel2.Controls.Add(this.progressBar1);
this.panel2.Controls.Add(this.panel1);
this.panel2.Controls.Add(this.label1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(491, 106);
this.panel2.TabIndex = 10;
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(80, 79);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(385, 12);
this.progressBar1.Step = 1;
this.progressBar1.TabIndex = 9;
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label3);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(491, 63);
this.panel1.TabIndex = 8;
//
// pictureBox1
//
this.pictureBox1.BackgroundImage = global::Lskj.AutoCreatWord.Properties.Resources.Word;
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.pictureBox1.Location = new System.Drawing.Point(401, 4);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(66, 55);
this.pictureBox1.TabIndex = 1;
this.pictureBox1.TabStop = false;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(33, 44);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(245, 12);
this.label4.TabIndex = 0;
this.label4.Text = "这段时间您可以使用您的计算机办理其他事务";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(33, 26);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(257, 12);
this.label2.TabIndex = 0;
this.label2.Text = "正在下载图片,并生成word请耐心等待一段时间";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(11, 8);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(85, 12);
this.label3.TabIndex = 0;
this.label3.Text = "正在生成word";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(21, 79);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 7;
this.label1.Text = "正在生成:";
//
// FrmMain
//
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
this.Appearance.Options.UseBackColor = true;
this.Appearance.Options.UseFont = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(491, 106);
this.Controls.Add(this.panel2);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "FrmMain";
this.Text = "朗速-开发动态文档(WORD)智能生成工具";
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.ComponentModel.BackgroundWorker backgroundWorker1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ProgressBar progressBar1;
}
}
+143
View File
@@ -0,0 +1,143 @@
using Lskj.Business;
using Lskj.Business.Impl;
using Lskj.Control;
using Lskj.Core;
using Lskj.Model;
using Lskj.Util;
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Lskj.AutoWordFile
{
public partial class FrmMain : BaseForm
{
private bool NewInitSuccess = false;
private int fileCount;
/// <summary>
/// 基础对象
/// </summary>
public ModuleModel ModuleModel;
/// <summary>
/// 本地打开word路径
/// </summary>
public string WordPath;
/// <summary>
/// 调用动态链接库默认传递参数
/// </summary>
public DynamicAutoCreate Model;
// 可替换模板文档
public Document document;
// 替换的数据集合
public DataSet ds;
/// <summary>
/// 模块编号
/// </summary>
public string ModelCode;
public FrmMain()
{
InitializeComponent();
this.Load += OnFrmMainLoad;
}
/// <summary>
/// 窗口初始化
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnFrmMainLoad(object sender, EventArgs e)
{
try
{
string mainTempPath = $@"{PubUtil.AbsolutelyPath}\WordFile\{Model.MainTempPath}.doc";
if (!File.Exists(mainTempPath))
{
mainTempPath = $@"{PubUtil.AbsolutelyPath}\WordFile\{Model.MainTempPath}.docx";
if (!File.Exists(mainTempPath))
{
//throw new Exception($"模板文件{mainTempPath}不存在");
}
else
{
Model.MainTempPath = $"{Model.MainTempPath}.docx";
}
}
else
{
Model.MainTempPath = $"{Model.MainTempPath}.doc";
}
string menuTempPath = $@"{PubUtil.AbsolutelyPath}\WordFile\{Model.MenuTempPath}.doc";
if (!File.Exists(menuTempPath))
{
menuTempPath = $@"{PubUtil.AbsolutelyPath}\WordFile\{Model.MenuTempPath}.docx";
if (!File.Exists(menuTempPath))
{
//throw new Exception($"模板文件{menuTempPath}不存在");
}
else
{
Model.MenuTempPath = $"{Model.MenuTempPath}.doc";
}
}
else
{
Model.MenuTempPath = $"{Model.MenuTempPath}.doc";
}
string fileName = Path.GetFileName(Model.MainTempPath);
fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + "word文档" + fileName;
string saveFilePath = $@"{PubUtil.AbsolutelyPath}\Tempfiles\{fileName}";
string savePdfPath = $@"{Path.GetDirectoryName(saveFilePath)}\{Path.GetFileNameWithoutExtension(saveFilePath)}.doc";
CancellationTokenSource cts = new CancellationTokenSource();
CancellationToken token = cts.Token;
Task progressTask = new Task(() =>
{
for (int i = 1; i <= 99; i++)
{
token.ThrowIfCancellationRequested();
Invoke(new Action(() =>
{
progressBar1.Value = i;
}));
Thread.Sleep(1000);
}
}, token);
progressTask.Start();
Task crateTask = new Task(() =>
{
AutoCreatWord.CreateWordUtil.DbOperator = new Lskj.Data.ADO.Template.DbTemplate(string.Format("server={0};database={1};persist security info=true;user id=lserpAdmin;password=lserp110;max pool size = 512;", DBConfig.Instance.ServerName, DBConfig.Instance.DataBase), "system.data.sqlclient");
AutoCreatWord.CreateWordUtil.Create(mainTempPath, menuTempPath, Model.MenuTempArray, SqlHelper.ExecuteDataSet(Model.MasterSql), savePdfPath, SystemInfo.Instance.OAUrl, out string msg);
cts.Cancel();
if (this.InvokeRequired)
{
this.Invoke(new Action(() =>
{
progressBar1.Value = 100;
Process.Start(savePdfPath);
Close();
}));
}
});
crateTask.Start();
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
Close();
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\Lskj.LserpAll\packages\cef.redist.x86.114.2.10\build\cef.redist.x86.props" Condition="Exists('..\Lskj.LserpAll\packages\cef.redist.x86.114.2.10\build\cef.redist.x86.props')" />
<PropertyGroup>
<StartupObject />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6924BAEC-DE41-424C-B2B0-F479F8D6A1B0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Lskj.AutoCreatWord</RootNamespace>
<AssemblyName>Lskj.AutoCreatWord</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Debug\Lib\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\Debug\AllMethodXml\Lskj.AutoWordFile.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>logo.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Printing.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Sparkline.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="Lskj.Business">
<HintPath>..\..\Release\Lskj.Business.dll</HintPath>
</Reference>
<Reference Include="Lskj.Control">
<HintPath>..\..\Release\Lskj.Control.dll</HintPath>
</Reference>
<Reference Include="Lskj.Core">
<HintPath>..\..\Release\Lskj.Core.dll</HintPath>
</Reference>
<Reference Include="Lskj.Data">
<HintPath>..\..\Release\Lskj.Data.dll</HintPath>
</Reference>
<Reference Include="Lskj.Data.ADO, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\引用DLL\Lskj.Data.ADO.dll</HintPath>
</Reference>
<Reference Include="Lskj.Push">
<HintPath>..\..\Release\Lskj.Push.dll</HintPath>
</Reference>
<Reference Include="Lskj.Util">
<HintPath>..\..\Release\Lskj.Util.dll</HintPath>
</Reference>
<Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Spire.Common">
<HintPath>..\..\引用DLL\Spire.Common.dll</HintPath>
</Reference>
<Reference Include="Spire.Doc">
<HintPath>..\..\引用DLL\Spire.Doc.dll</HintPath>
</Reference>
<Reference Include="Spire.License">
<HintPath>..\..\引用DLL\Spire.License.dll</HintPath>
</Reference>
<Reference Include="Spire.Pdf">
<HintPath>..\..\引用DLL\Spire.Pdf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Net" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CreateWordUtil.cs" />
<Compile Include="DllBaseClass.cs" />
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="logo.ico" />
<None Include="Word.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lskj.Model\Lskj.Model.csproj">
<Project>{52bc40e0-c0c6-4f78-996b-cae028d209ca}</Project>
<Name>Lskj.Model</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\Lskj.LserpAll\packages\cef.redist.x86.114.2.10\build\cef.redist.x86.props')" Text="$([System.String]::Format('$(ErrorText)', '..\Lskj.LserpAll\packages\cef.redist.x86.114.2.10\build\cef.redist.x86.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,213 @@
/******************************
* 说明:数据库连接参数配置类
* 创建人:龚宇超
* 创建日期:2017-07-24
* 修改人:
* 修改日期:
* 修改备注:
* 版本:1.0.0.0
******************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
using System.Data.SqlClient;
using System.Data;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Diagnostics;
namespace Lskj.Core
{
/// <summary>
/// 数据库连接参数配置类
/// </summary>
public sealed class DBConfig
{
private static string _regKey = "AA_LS_Erp V2.0";
private static DBConfig _instance = null;
/// <summary>
/// DBConfig静态单例对象
/// </summary>
/// <value>The instance.</value>
public static DBConfig Instance
{
get
{
if (_instance == null)
{
_instance = new DBConfig();
_instance.ReadConfig();
_instance.WriteConfig();
}
return _instance;
}
}
/// <summary>
/// 数据库名
/// </summary>
public string DataBase;
/// <summary>
/// 帐套
/// </summary>
public string DataBook;
/// <summary>
/// 服务器名
/// </summary>
public string ServerName;
/// <summary>
/// 登录名
/// </summary>
public string LoginName;
/// <summary>
/// 文件升级标志
/// </summary>
public bool UpdateSet;
///<summary>
///智能客户端启动
///</summary>
public bool SmallClient;
/// <summary>
/// 内外外网标志
/// </summary>
public bool Internet;
/// <summary>
/// <para>说明:读取注册表配置</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-07 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
public void ReadConfig()
{
RegistryKey regKey = Registry.CurrentUser;
RegistryKey subKey = regKey.OpenSubKey(_regKey);
subKey = subKey.OpenSubKey("File");
DataBase = subKey.GetValue("datastr", "") + "";
ServerName = subKey.GetValue("ServerName", "") + "";
LoginName = subKey.GetValue("LoginName", "") + "";
UpdateSet = subKey.GetValue("UpdateSet", "0") + "" == "1" || subKey.GetValue("UpdateSet", "0") + "" == "True" ? true : false;
SmallClient = subKey.GetValue("SmallClient", "0") + "" == "1" || subKey.GetValue("SmallClient", "0") + "" == "True" ? true : false;
Internet = subKey.GetValue("Internet", "1") + "" == "0" ? true : false;
try
{
DataBook = subKey.GetValue("DataBook", "") + "";
}
catch (Exception)
{
}
}
/// <summary>
/// <para>说明:写配置</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-07 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
public void WriteConfig()
{
RegistryKey regKey = Registry.CurrentUser;
RegistryKey subKey = regKey.OpenSubKey(_regKey);
subKey = subKey.OpenSubKey("File", true);
subKey.SetValue("datastr", DataBase);
subKey.SetValue("ServerName", ServerName);
subKey.SetValue("LoginName", LoginName);
subKey.SetValue("UpdateSet", UpdateSet);
subKey.SetValue("SmallClient", SmallClient);
subKey.SetValue("DataBook", DataBook);
subKey.Close();
}
/// <summary>
/// <para>说明:获取C#连接字符串</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-07 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <returns>System.String.</returns>
public string GetConnection()
{
return string.Format("Server={0};Database={1};Persist Security Info=True;User ID=lserpAdmin;Password=lserp110;Connection Timeout=5", ServerName, DataBase);
}
/// <summary>
/// <para>说明:获取delphi连接字符串</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-07 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <returns>System.String.</returns>
public string GetDelphiConnection()
{
return string.Format("Provider=SQLOLEDB.1;Server={0};Database={1};Persist Security Info=True;User ID=lserpAdmin;Password=lserp110;Connection Timeout=5", ServerName, DataBase);
}
/// <summary>
/// <para>说明:获取</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-03-28 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <returns>System.String.</returns>
public string GetLsCrmConnection()
{
return Internet ? "Server=192.168.0.10,14330;Database=lscrm;Persist Security Info=True;User ID=Lserp_crm;Password=lserp_ERP_@#$_123;Connection Timeout=5"
: "Server=lsucrm.ticp.net,14330;Database=lscrm;Persist Security Info=True;User ID=Lserp_crm;Password=lserp_ERP_@#$_123;Connection Timeout=5";
}
/// <summary>
/// <para>说明:创建数据库连接</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-07 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool CreateConnection()
{
string connStr = GetConnection();
if (SqlHelper._connection != null)
{
try
{
SqlHelper._connection.Close();
SqlHelper._connection.Dispose();
}
catch (Exception)
{
}
SqlHelper._connection = null;
}
try
{
SqlHelper._connection = new SqlConnection(connStr);
SqlHelper._connection.Open();
return true;
}
catch (Exception ex)
{
}
return false;
}
}
}
@@ -0,0 +1,651 @@
/******************************
* 说明:数据库操作类
* 创建人:龚宇超
* 创建日期:2017-07-24
* 修改人:
* 修改日期:
* 修改备注:
* 版本:1.0.0.0
******************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace Lskj.Core
{
/// <summary>
/// 数据库操作类
/// </summary>
public static class SqlHelper
{
/// <summary>
/// 数据连接
/// </summary>
public static SqlConnection _connection;
#region ExecuteAdapter
/// <summary>
/// <para>说明:获取适配器</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="commandParameters">The command parameters.</param>
/// <returns>SqlDataAdapter.</returns>
public static SqlDataAdapter ExecuteAdapter(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlDataAdapter adapter;
SqlCommand cmd = new SqlCommand();
try
{
PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
adapter = new SqlDataAdapter(cmd);
}
catch
{
throw;
}
return adapter;
}
/// <summary>
/// <para>说明:获取适配器</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <returns>SqlDataAdapter.</returns>
public static SqlDataAdapter ExecuteAdapter(CommandType cmdType, string cmdText)
{
SqlDataAdapter adapter;
SqlCommand cmd = new SqlCommand();
try
{
PrepareCommand(cmd, _connection, null, cmdType, cmdText, null);
adapter = new SqlDataAdapter(cmd);
}
catch
{
throw;
}
return adapter;
}
#endregion
#region ExecuteDataTable
/// <summary>
/// <para>说明:执行sql返回DataTable</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdText">The command text.</param>
/// <returns>DataTable.</returns>
public static DataTable ExecuteDataTable(string cmdText)
{
return ExecuteDataSet(cmdText).Tables[0];
}
/// <summary>
/// <para>说明:执行sql返回DataTable</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdText">The command text.</param>
/// <returns>DataTable.</returns>
public static DataTable ExecuteDataTable(string cmdText, params SqlParameter[] commandParameters)
{
return ExecuteDataSet(CommandType.Text, cmdText, "temp", commandParameters).Tables[0];
}
/// <summary>
/// <para>说明:执行sql返回指定字段值</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-15 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="fieldName">Name of the field.</param>
/// <param name="cmdText">The command text.</param>
/// <returns>System.Object.</returns>
public static object ExecuteObject(string fieldName, string cmdText)
{
object result = null;
try
{
result = ExecuteDataSet(cmdText).Tables[0].Rows[0][fieldName];
}
catch (Exception)
{
}
return result;
}
/// <summary>
/// <para>说明:执行sql返回指定字段值</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-11-27 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="fieldName">Name of the field.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="commandParameters">The command parameters.</param>
/// <returns>System.Object.</returns>
public static object ExecuteObject(string fieldName, string cmdText, params SqlParameter[] commandParameters)
{
object result = null;
try
{
result = ExecuteDataSet(CommandType.Text, cmdText, "temp", commandParameters).Tables[0].Rows[0][fieldName];
}
catch (Exception)
{
}
return result;
}
/// <summary>
/// <para>说明:执行sql返回指定字段值</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-15 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="fieldName">Name of the field.</param>
/// <param name="cmdText">The command text.</param>
/// <returns>System.Object.</returns>
public static string ExecuteString(string fieldName, string cmdText)
{
object obj = ExecuteObject(fieldName, cmdText);
return obj == null ? "" : obj.ToString();
}
/// <summary>
/// <para>说明:执行sql返回指定字段值</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-11-27 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="fieldName">Name of the field.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="commandParameters">The command parameters.</param>
/// <returns>System.String.</returns>
public static string ExecuteString(string fieldName, string cmdText, params SqlParameter[] commandParameters)
{
object obj = ExecuteObject(fieldName, cmdText, commandParameters);
return obj == null ? "" : obj.ToString();
}
#endregion
#region ExecuteDataSet
/// <summary>
/// <para>说明:查询结果集</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="tabName">Name of the tab.</param>
/// <param name="commandParameters">The command parameters.</param>
/// <returns>DataSet.</returns>
public static DataSet ExecuteDataSet(int cmdType, string cmdText, string tabName, params SqlParameter[] commandParameters)
{
CommandType _cmdType = CommandType.Text;
switch (cmdType)
{
case 4:
_cmdType = CommandType.StoredProcedure;
break;
case 512:
_cmdType = CommandType.TableDirect;
break;
}
return ExecuteDataSet(_cmdType, cmdText, tabName, commandParameters);
}
/// <summary>
/// <para>说明:查询结果集</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdType">语句类型存储过程或者sql语句</param>
/// <param name="cmdText">执行内容</param>
/// <param name="tabName">表名</param>
/// <param name="commandParameters">参数</param>
/// <returns>DataSet.</returns>
public static DataSet ExecuteDataSet(CommandType cmdType, string cmdText, string tabName, params SqlParameter[] commandParameters)
{
DataSet set2;
SqlCommand cmd = new SqlCommand();
try
{
PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet, tabName);
//adapter.FillSchema(dataSet, SchemaType.Mapped, tabName);
set2 = dataSet;
}
catch
{
throw;
}
finally
{
cmd.Dispose();
}
return set2;
}
/// <summary>
/// <para>说明:查询结果集</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdType">语句类型存储过程或者sql语句</param>
/// <param name="cmdText">执行内容</param>
/// <param name="tabName">表名</param>
/// <returns>DataSet.</returns>
public static DataSet ExecuteDataSet(CommandType cmdType, string cmdText, string tabName)
{
DataSet set2;
SqlCommand cmd = new SqlCommand();
try
{
PrepareCommand(cmd, _connection, null, cmdType, cmdText, null);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet, tabName);
set2 = dataSet;
}
catch
{
throw;
}
return set2;
}
/// <summary>
/// <para>说明:查询结果集</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdText">执行内容</param>
/// <returns>DataSet.</returns>
public static DataSet ExecuteDataSet(string cmdText)
{
DataSet set2;
SqlCommand cmd = new SqlCommand();
try
{
PrepareCommand(cmd, _connection, null, CommandType.Text, cmdText, null);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet, "temp");
set2 = dataSet;
}
catch
{
throw;
}
return set2;
}
/// <summary>
/// <para>说明:查询结果集</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="procedureName">Name of the procedure.</param>
/// <param name="tabName">表名</param>
/// <param name="parameterNames">The parameter names.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <returns>DataSet.</returns>
public static DataSet ExecuteDataSet(string procedureName, string tabName, string[] parameterNames, object[] parameterValues)
{
DataSet set2;
try
{
SqlCommand cmd = new SqlCommand(procedureName, _connection);
cmd.CommandType = CommandType.StoredProcedure;
if (parameterNames != null && parameterValues != null)
{
for (int i = 0; i < parameterNames.Length && i < parameterValues.Length; i++)
{
cmd.Parameters.AddWithValue(parameterNames[i], parameterValues[i]);
}
}
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet, tabName);
set2 = dataSet;
}
catch
{
throw;
}
return set2;
}
#endregion
#region ExecuteNonQuery
/// <summary>
/// <para>说明:执行sql语句或者存储过程</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="Connectionection">The connectionection.</param>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="commandParameters">The command parameters.</param>
/// <returns>System.Int32.</returns>
public static int ExecuteNonQuery(SqlConnection Connectionection, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, Connectionection, null, cmdType, cmdText, commandParameters);
int num = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return num;
}
/// <summary>
/// <para>说明:执行sql语句或者存储过程</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="trans">The trans.</param>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="commandParameters">The command parameters.</param>
/// <returns>System.Int32.</returns>
public static int ExecuteNonQuery(SqlTransaction trans, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, trans.Connection, trans, cmdType, cmdText, commandParameters);
int num = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return num;
}
/// <summary>
/// <para>说明:执行sql语句或者存储过程</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="commandParameters">The command parameters.</param>
/// <returns>System.Int32.</returns>
public static int ExecuteNonQuery(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
int num = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return num;
}
/// <summary>
/// <para>说明:执行sql语句或者存储过程</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <returns>System.Int32.</returns>
public static int ExecuteNonQuery(CommandType cmdType, string cmdText)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, _connection, null, cmdType, cmdText, null);
int num = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return num;
}
/// <summary>
/// <para>说明:执行sql语句或者存储过程</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdText">The command text.</param>
/// <returns>System.Int32.</returns>
public static int ExecuteNonQuery(string cmdText)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, _connection, null, CommandType.Text, cmdText, null);
int num = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return num;
}
#endregion
#region ExecuteReader
/// <summary>
/// <para>说明:执行sql语句或者存储过程并返回结果集(只读、只进)</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="commandParameters">The command parameters.</param>
/// <returns>SqlDataReader.</returns>
public static SqlDataReader ExecuteReader(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlDataReader reader2;
SqlCommand cmd = new SqlCommand();
try
{
PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
SqlDataReader reader = cmd.ExecuteReader();
cmd.Parameters.Clear();
reader2 = reader;
}
catch
{
throw;
}
return reader2;
}
#endregion
#region ExecuteScalar
/// <summary>
/// <para>说明:执行sql语句或者存储过程并返回结果集第一行第一列</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="Connectionection">The connectionection.</param>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="commandParameters">The command parameters.</param>
/// <returns>System.Object.</returns>
public static object ExecuteScalar(SqlConnection Connectionection, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, Connectionection, null, cmdType, cmdText, commandParameters);
object obj2 = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return obj2;
}
/// <summary>
/// <para>说明:执行sql语句或者存储过程并返回结果集第一行第一列</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="commandParameters">The command parameters.</param>
/// <returns>System.Object.</returns>
public static object ExecuteScalar(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
{
PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
object obj2 = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return obj2;
}
}
/// <summary>
/// <para>说明:执行sql语句或者存储过程并返回结果集第一行第一列</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <returns>System.Object.</returns>
public static object ExecuteScalar(CommandType cmdType, string cmdText)
{
SqlCommand cmd = new SqlCommand();
{
PrepareCommand(cmd, _connection, null, cmdType, cmdText, null);
object obj2 = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return obj2;
}
}
/// <summary>
/// <para>说明:执行sql语句或者存储过程并返回结果集第一行第一列</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-21 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmdText">The command text.</param>
/// <returns>System.Object.</returns>
public static object ExecuteScalar(string cmdText)
{
SqlCommand cmd = new SqlCommand();
{
PrepareCommand(cmd, _connection, null, CommandType.Text, cmdText, null);
object obj2 = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return obj2;
}
}
#endregion
#region PrepareCommand
/// <summary>
/// <para>说明: sql参数处理</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-24 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="cmd">The command.</param>
/// <param name="Connection">The connection.</param>
/// <param name="trans">The trans.</param>
/// <param name="cmdType">Type of the command.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="cmdParms">The command parms.</param>
private static void PrepareCommand(SqlCommand cmd, SqlConnection Connection, SqlTransaction trans, CommandType cmdType, string cmdText, SqlParameter[] cmdParms)
{
if (Connection.State != ConnectionState.Open)
{
Connection.Open();
}
cmd.Connection = Connection;
//cmd.CommandTimeout = CommandTimeout;
cmd.CommandText = cmdText;
if (trans != null)
{
cmd.Transaction = trans;
}
cmd.CommandType = cmdType;
if (cmdParms != null)
{
foreach (SqlParameter parameter in cmdParms)
{
cmd.Parameters.Add(parameter);
}
}
}
#endregion
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Lserp_WordHelp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lserp_WordHelp")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("99914c91-26c4-4b7c-806e-9962eeda3400")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Lskj.AutoCreatWord.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Lskj.AutoCreatWord.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap Word {
get {
object obj = ResourceManager.GetObject("Word", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Word" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Word.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Lskj.AutoCreatWord.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.redist.x86" version="114.2.10" targetFramework="net40" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net40" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net40" />
</packages>