基线 SVN r240
SVN-Revision: r240
This commit is contained in:
+269
@@ -0,0 +1,269 @@
|
||||
|
||||
namespace Lskj.GarbledCodeProcessing
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
DevExpress.XtraGrid.GridLevelNode gridLevelNode1 = new DevExpress.XtraGrid.GridLevelNode();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.txtTimeInterval = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.txtName = new System.Windows.Forms.TextBox();
|
||||
this.txtDataBase = new System.Windows.Forms.TextBox();
|
||||
this.txtPassword = new System.Windows.Forms.TextBox();
|
||||
this.txtSeverId = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.btnBegin = new System.Windows.Forms.Button();
|
||||
this.gridControl = new DevExpress.XtraGrid.GridControl();
|
||||
this.gridView = new DevExpress.XtraGrid.Views.Grid.GridView();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridControl)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.button1);
|
||||
this.panel1.Controls.Add(this.label6);
|
||||
this.panel1.Controls.Add(this.txtTimeInterval);
|
||||
this.panel1.Controls.Add(this.label5);
|
||||
this.panel1.Controls.Add(this.txtName);
|
||||
this.panel1.Controls.Add(this.txtDataBase);
|
||||
this.panel1.Controls.Add(this.txtPassword);
|
||||
this.panel1.Controls.Add(this.txtSeverId);
|
||||
this.panel1.Controls.Add(this.label4);
|
||||
this.panel1.Controls.Add(this.label3);
|
||||
this.panel1.Controls.Add(this.label2);
|
||||
this.panel1.Controls.Add(this.label1);
|
||||
this.panel1.Controls.Add(this.btnBegin);
|
||||
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(816, 66);
|
||||
this.panel1.TabIndex = 7;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.Location = new System.Drawing.Point(639, 38);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(79, 23);
|
||||
this.button1.TabIndex = 12;
|
||||
this.button1.Text = "开始同步";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.Location = new System.Drawing.Point(515, 9);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(78, 23);
|
||||
this.label6.TabIndex = 11;
|
||||
this.label6.Text = "秒(最短30秒)";
|
||||
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// txtTimeInterval
|
||||
//
|
||||
this.txtTimeInterval.Location = new System.Drawing.Point(420, 9);
|
||||
this.txtTimeInterval.Name = "txtTimeInterval";
|
||||
this.txtTimeInterval.Size = new System.Drawing.Size(89, 21);
|
||||
this.txtTimeInterval.TabIndex = 10;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.Location = new System.Drawing.Point(336, 9);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(88, 23);
|
||||
this.label5.TabIndex = 9;
|
||||
this.label5.Text = "间隔时间设置";
|
||||
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// txtName
|
||||
//
|
||||
this.txtName.Location = new System.Drawing.Point(81, 40);
|
||||
this.txtName.Name = "txtName";
|
||||
this.txtName.Size = new System.Drawing.Size(98, 21);
|
||||
this.txtName.TabIndex = 8;
|
||||
this.txtName.Text = "lserpAdmin";
|
||||
//
|
||||
// txtDataBase
|
||||
//
|
||||
this.txtDataBase.Location = new System.Drawing.Point(242, 9);
|
||||
this.txtDataBase.Name = "txtDataBase";
|
||||
this.txtDataBase.Size = new System.Drawing.Size(88, 21);
|
||||
this.txtDataBase.TabIndex = 7;
|
||||
this.txtDataBase.Text = "vitalong";
|
||||
//
|
||||
// txtPassword
|
||||
//
|
||||
this.txtPassword.Location = new System.Drawing.Point(242, 40);
|
||||
this.txtPassword.Name = "txtPassword";
|
||||
this.txtPassword.PasswordChar = '*';
|
||||
this.txtPassword.Size = new System.Drawing.Size(88, 21);
|
||||
this.txtPassword.TabIndex = 6;
|
||||
this.txtPassword.Text = "lserp110";
|
||||
//
|
||||
// txtSeverId
|
||||
//
|
||||
this.txtSeverId.Location = new System.Drawing.Point(81, 9);
|
||||
this.txtSeverId.Name = "txtSeverId";
|
||||
this.txtSeverId.Size = new System.Drawing.Size(98, 21);
|
||||
this.txtSeverId.TabIndex = 5;
|
||||
this.txtSeverId.Text = "110.185.160.75,11229";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.Location = new System.Drawing.Point(174, 9);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(71, 23);
|
||||
this.label4.TabIndex = 4;
|
||||
this.label4.Text = "数据库";
|
||||
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Location = new System.Drawing.Point(12, 40);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(71, 23);
|
||||
this.label3.TabIndex = 3;
|
||||
this.label3.Text = "登录名称";
|
||||
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Location = new System.Drawing.Point(174, 40);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(71, 23);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "登录密码";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(71, 23);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "服务器地址";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// btnBegin
|
||||
//
|
||||
this.btnBegin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnBegin.Location = new System.Drawing.Point(639, 12);
|
||||
this.btnBegin.Name = "btnBegin";
|
||||
this.btnBegin.Size = new System.Drawing.Size(79, 23);
|
||||
this.btnBegin.TabIndex = 0;
|
||||
this.btnBegin.Text = "获取数据";
|
||||
this.btnBegin.UseVisualStyleBackColor = true;
|
||||
this.btnBegin.Click += new System.EventHandler(this.btnBegin_Click);
|
||||
//
|
||||
// gridControl
|
||||
//
|
||||
this.gridControl.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
gridLevelNode1.RelationName = "Level1";
|
||||
this.gridControl.LevelTree.Nodes.AddRange(new DevExpress.XtraGrid.GridLevelNode[] {
|
||||
gridLevelNode1});
|
||||
this.gridControl.Location = new System.Drawing.Point(0, 72);
|
||||
this.gridControl.MainView = this.gridView;
|
||||
this.gridControl.Name = "gridControl";
|
||||
this.gridControl.Size = new System.Drawing.Size(816, 354);
|
||||
this.gridControl.TabIndex = 8;
|
||||
this.gridControl.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
|
||||
this.gridView});
|
||||
//
|
||||
// gridView
|
||||
//
|
||||
this.gridView.Appearance.HeaderPanel.Font = new System.Drawing.Font("宋体", 9F);
|
||||
this.gridView.Appearance.HeaderPanel.Options.UseFont = true;
|
||||
this.gridView.Appearance.HeaderPanel.Options.UseTextOptions = true;
|
||||
this.gridView.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
|
||||
this.gridView.Appearance.HeaderPanel.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
|
||||
this.gridView.Appearance.Preview.Font = new System.Drawing.Font("宋体", 9F);
|
||||
this.gridView.Appearance.Preview.Options.UseFont = true;
|
||||
this.gridView.Appearance.Row.Font = new System.Drawing.Font("宋体", 9F);
|
||||
this.gridView.Appearance.Row.Options.UseBackColor = true;
|
||||
this.gridView.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Flat;
|
||||
this.gridView.GridControl = this.gridControl;
|
||||
this.gridView.IndicatorWidth = 40;
|
||||
this.gridView.Name = "gridView";
|
||||
this.gridView.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.True;
|
||||
this.gridView.OptionsClipboard.CopyColumnHeaders = DevExpress.Utils.DefaultBoolean.False;
|
||||
this.gridView.OptionsFilter.ShowAllTableValuesInCheckedFilterPopup = false;
|
||||
this.gridView.OptionsFilter.ShowAllTableValuesInFilterPopup = true;
|
||||
this.gridView.OptionsFind.FindNullPrompt = "";
|
||||
this.gridView.OptionsSelection.MultiSelect = true;
|
||||
this.gridView.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CellSelect;
|
||||
this.gridView.OptionsView.AllowHtmlDrawHeaders = true;
|
||||
this.gridView.OptionsView.ColumnAutoWidth = false;
|
||||
this.gridView.OptionsView.ColumnHeaderAutoHeight = DevExpress.Utils.DefaultBoolean.True;
|
||||
this.gridView.OptionsView.RowAutoHeight = true;
|
||||
this.gridView.OptionsView.ShowGroupPanel = false;
|
||||
this.gridView.PaintStyleName = "Skin";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(816, 426);
|
||||
this.Controls.Add(this.gridControl);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "Form1";
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridControl)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox txtTimeInterval;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox txtName;
|
||||
private System.Windows.Forms.TextBox txtDataBase;
|
||||
private System.Windows.Forms.TextBox txtPassword;
|
||||
private System.Windows.Forms.TextBox txtSeverId;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button btnBegin;
|
||||
public DevExpress.XtraGrid.GridControl gridControl;
|
||||
private DevExpress.XtraGrid.Views.Grid.GridView gridView;
|
||||
private System.Windows.Forms.Button button1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
using DevExpress.Utils;
|
||||
using DevExpress.XtraEditors.Repository;
|
||||
using DevExpress.XtraGrid.Columns;
|
||||
using DevExpress.XtraGrid.Views.Base;
|
||||
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
|
||||
using Lskj.Control;
|
||||
using Lskj.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.GarbledCodeProcessing
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// ini文件内段落名
|
||||
/// </summary>
|
||||
public string company = "乱码处理";
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void btnBegin_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ConnectServer())
|
||||
{
|
||||
DataTable DT = SqlHelper.ExecuteDataTable(@"
|
||||
select hr_emp_rizhinr,hr_emp_billdocument_id from HR_ygrizhidjtab where hr_emp_rizhinr like '%{%';");
|
||||
|
||||
|
||||
|
||||
GridColumn gridColumn1 = new GridColumn();
|
||||
gridColumn1.FieldName = "hr_emp_billdocument_id";
|
||||
gridColumn1.Name = "hr_emp_billdocument_id";
|
||||
gridColumn1.Caption = "主键";
|
||||
gridColumn1.Width = 200;
|
||||
gridColumn1.VisibleIndex = 0;
|
||||
|
||||
this.gridView.Columns.Add(gridColumn1);
|
||||
|
||||
|
||||
|
||||
GridColumn gridColumn = new GridColumn();
|
||||
gridColumn.FieldName = "hr_emp_rizhinr";
|
||||
gridColumn.Name = "hr_emp_rizhinr";
|
||||
gridColumn.Caption = "日志内容";
|
||||
gridColumn.Width = 200;
|
||||
gridColumn.VisibleIndex = 1;
|
||||
|
||||
|
||||
gridColumn.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;
|
||||
gridColumn.OptionsColumn.AllowEdit = false;
|
||||
gridColumn.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
|
||||
|
||||
gridColumn.OptionsColumn.AllowMerge = DefaultBoolean.False;
|
||||
|
||||
gridColumn.AppearanceCell.Options.UseFont = true;
|
||||
|
||||
this.gridView.Columns.Add(gridColumn);
|
||||
|
||||
RepositoryItemRichTextEdit richEdit = new RepositoryItemRichTextEdit();
|
||||
richEdit.Encoding = Encoding.UTF8;//乱码问题
|
||||
gridControl.RepositoryItems.Add(richEdit);
|
||||
gridColumn.ColumnEdit = richEdit;
|
||||
|
||||
|
||||
|
||||
|
||||
gridControl.DataSource = DT;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string ff(string value) {
|
||||
|
||||
RichTextBox rtfObj = new RichTextBox();
|
||||
rtfObj.Rtf = value;
|
||||
string disValue = rtfObj.Text;
|
||||
return disValue;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
DataTable dt = gridControl.DataSource as DataTable;
|
||||
string sql = " update HR_ygrizhidjtab set hr_emp_rizhinr='{0}' where hr_emp_billdocument_id='{1}'";
|
||||
string updateSql = string.Empty;
|
||||
string text = string.Empty;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
try
|
||||
{
|
||||
updateSql = string.Empty;
|
||||
text = string.Empty;
|
||||
|
||||
text = ff(dr["hr_emp_rizhinr"] + "");
|
||||
|
||||
updateSql = string.Format(sql, text.Replace("'", "''"), dr["hr_emp_billdocument_id"] + "");
|
||||
SqlHelper.ExecuteNonQuery(updateSql);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MessageUtil.Show("成功");
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region 连接服务器
|
||||
/// <summary>
|
||||
/// <para>说明:连接服务器</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-09 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="isSave">if set to <c>true</c> [is save].</param>
|
||||
public bool ConnectServer(bool isSave = false)
|
||||
{
|
||||
string serverName = this.txtSeverId.Text.Trim();//地址
|
||||
string dbName = this.txtDataBase.Text.Trim();//数据库名
|
||||
string user = this.txtName.Text.Trim();//用户名
|
||||
string password = this.txtPassword.Text.Trim();//密码
|
||||
|
||||
if (string.IsNullOrWhiteSpace(serverName))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ServerNameIsNull);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(dbName))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ServerDBIsNull);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(user))
|
||||
{
|
||||
MessageUtil.Show("请重新输入用户名");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// 测试数据库连接
|
||||
try
|
||||
{
|
||||
if (ConnectingToDatabase())
|
||||
{
|
||||
if (isSave)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
IniUtil.IniWriteValue(company, "serverName", serverName);
|
||||
IniUtil.IniWriteValue(company, "dbName", dbName);
|
||||
IniUtil.IniWriteValue(company, "user", user);
|
||||
IniUtil.IniWriteValue(company, "password", password);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectFault);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.ConnectFault);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <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 ConnectingToDatabase()
|
||||
{
|
||||
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)
|
||||
{
|
||||
// LogHelper.Instance.WriteLog(ex.Message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取连接服务器的字符串
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetConnection()
|
||||
{
|
||||
return string.Format("Server={0};Database={1};Persist Security Info=True;User ID={2};Password={3};Connection Timeout=5;MultipleActiveResultSets=true", txtSeverId.Text.ToString(), txtDataBase.Text.ToString(), txtName.Text.ToString(), txtPassword.Text.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?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>
|
||||
</root>
|
||||
@@ -0,0 +1,91 @@
|
||||
|
||||
using Lskj.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.GarbledCodeProcessing
|
||||
{
|
||||
public static class IniUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// ini文件目录
|
||||
/// </summary>
|
||||
static string location = Environment.CurrentDirectory + "\\" + "Setting.ini";
|
||||
|
||||
/// <summary>
|
||||
/// ini文件获取数据
|
||||
/// </summary>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="defVal"></param>
|
||||
/// <param name="retVal"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileString(string section, string key, string defVal, StringBuilder retVal, int size, string filePath);
|
||||
|
||||
/// <summary>
|
||||
/// ini文件写入数据
|
||||
/// </summary>
|
||||
/// <param name="section"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="val"></param>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32")]
|
||||
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
|
||||
|
||||
/// <summary>
|
||||
/// 写INI文件
|
||||
/// </summary>
|
||||
/// <param name="section">段落</param>
|
||||
/// <param name="key">键</param>
|
||||
/// <param name="iValue">值</param>
|
||||
public static void IniWriteValue(string section, string key, string iValue)
|
||||
{
|
||||
WritePrivateProfileString(section, key, iValue, location);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取INI文件
|
||||
/// </summary>
|
||||
/// <param name="section">段落</param>
|
||||
/// <param name="key">键</param>
|
||||
/// <returns>返回的键值</returns>
|
||||
public static string IniReadValue(string section, string key)
|
||||
{
|
||||
StringBuilder temp = new StringBuilder(255);
|
||||
int i = GetPrivateProfileString(section, key, "", temp, 255, location);
|
||||
return temp.ToString();
|
||||
}
|
||||
|
||||
//public static string Read(string iniName, string mainKey, string listKey)
|
||||
//{
|
||||
// string value = string.Empty;
|
||||
// try
|
||||
// {
|
||||
// 判读INI文件是否存在
|
||||
// string filePath = Path.Combine(new string[] { PubUtil.AbsolutelyPath + iniName });
|
||||
// if (File.Exists(filePath))
|
||||
// {
|
||||
// StringBuilder temp = new StringBuilder(1024);
|
||||
// string fileName = Path.GetFileNameWithoutExtension(filePath);
|
||||
// GetPrivateProfileString(mainKey, listKey, "", temp, 1024, filePath);
|
||||
|
||||
// return temp + "";
|
||||
// }
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// }
|
||||
// return value;
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<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>{AD714FC0-AE77-456C-B0D5-20FAEC19F272}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Lskj.GarbledCodeProcessing</RootNamespace>
|
||||
<AssemblyName>Lskj.GarbledCodeProcessing</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</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>
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.BonusSkins.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.BonusSkins.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Charts.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.Charts.v15.2.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.Data.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.DataAccess.v15.2.UI, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.DataAccess.v15.2.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Office.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.Office.v15.2.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Pdf.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.Pdf.v15.2.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Printing.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.Printing.v15.2.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.RichEdit.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.RichEdit.v15.2.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Sparkline.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.Sparkline.v15.2.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Spreadsheet.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.Spreadsheet.v15.2.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.Utils.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraBars.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraBars.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraCharts.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraCharts.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraCharts.v15.2.UI, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraCharts.v15.2.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraCharts.v15.2.Wizard, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraCharts.v15.2.Wizard.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraEditors.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraGrid.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraGrid.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraLayout.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraLayout.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraNavBar.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraNavBar.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraPrinting.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraPrinting.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraReports.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraReports.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraReports.v15.2.Extensions, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraReports.v15.2.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraRichEdit.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraRichEdit.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraScheduler.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraScheduler.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraScheduler.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraScheduler.v15.2.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraScheduler.v15.2.Reporting.Extensions, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraScheduler.v15.2.Reporting.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraSpellChecker.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraSpellChecker.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraTreeList.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\DevExpress.XtraTreeList.v15.2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Lskj.Business">
|
||||
<HintPath>引用dll\Lskj.Business.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Lskj.Control, Version=1.0.0.3, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>引用dll\Lskj.Control.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Lskj.Core">
|
||||
<HintPath>引用dll\Lskj.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Lskj.Data">
|
||||
<HintPath>引用dll\Lskj.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Lskj.Util">
|
||||
<HintPath>引用dll\Lskj.Util.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<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="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="IniUtil.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SqlHelper.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\licenses.licx" />
|
||||
<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>
|
||||
</Compile>
|
||||
<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>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32413.511
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lskj.GarbledCodeProcessing", "Lskj.GarbledCodeProcessing.csproj", "{AD714FC0-AE77-456C-B0D5-20FAEC19F272}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AD714FC0-AE77-456C-B0D5-20FAEC19F272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AD714FC0-AE77-456C-B0D5-20FAEC19F272}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AD714FC0-AE77-456C-B0D5-20FAEC19F272}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AD714FC0-AE77-456C-B0D5-20FAEC19F272}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A8EAA804-080F-4547-8369-59C4FE99A407}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.GarbledCodeProcessing
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Lskj.GarbledCodeProcessing")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Lskj.GarbledCodeProcessing")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("ad714fc0-ae77-456c-b0d5-20faec19f272")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,70 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace Lskj.GarbledCodeProcessing.Properties
|
||||
{
|
||||
/// <summary>
|
||||
/// 强类型资源类,用于查找本地化字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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 ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Lskj.GarbledCodeProcessing.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?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.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: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" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</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" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace Lskj.GarbledCodeProcessing.Properties
|
||||
{
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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>
|
||||
@@ -0,0 +1,605 @@
|
||||
/******************************
|
||||
* 说明:数据库操作类
|
||||
* 创建人:龚宇超
|
||||
* 创建日期: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.GarbledCodeProcessing
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据库操作类
|
||||
/// </summary>
|
||||
public static class SqlHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据连接
|
||||
/// </summary>
|
||||
public static SqlConnection _connection;
|
||||
/// <summary>
|
||||
/// 请求超时时间
|
||||
/// </summary>
|
||||
public static int CommandTimeout;
|
||||
|
||||
#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 (Exception e)
|
||||
{
|
||||
if (e.Message.StartsWith("在从服务器接收结果时发生传输级错误") ||
|
||||
e.Message.StartsWith("在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误") ||
|
||||
e.Message.StartsWith("在向服务器发送请求时发生传输级错误"))
|
||||
{
|
||||
throw new Exception("无法连接服务器,请检查网络连接.");
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
return ExecuteDataSet(cmdType, cmdText, tabName, null);
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
return ExecuteDataSet(CommandType.Text, cmdText, "temp");
|
||||
}
|
||||
/// <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="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();
|
||||
int num = 0;
|
||||
try
|
||||
{
|
||||
PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
|
||||
num = cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e.Message.StartsWith("在从服务器接收结果时发生传输级错误") ||
|
||||
e.Message.StartsWith("在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误") ||
|
||||
e.Message.StartsWith("在向服务器发送请求时发生传输级错误"))
|
||||
{
|
||||
throw new Exception("无法连接服务器,请检查网络连接.");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Dispose();
|
||||
}
|
||||
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)
|
||||
{
|
||||
return ExecuteNonQuery(CommandType.Text, cmdText, null);
|
||||
}
|
||||
/// <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)
|
||||
{
|
||||
return ExecuteNonQuery(CommandType.Text, cmdText);
|
||||
}
|
||||
#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
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user