📄 dataoperatorframehistory.cs
字号:
#region 命名空间...using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;using System.Data;using System.Data.SqlClient;using WindowsApplication.DataConnection;using WindowsApplication.selectCount;#endregionnamespace WindowsApplication.History{ public class dataOperatorFrameHistory : WindowsApplication.EmployeeLeaveManager.ParentFrame { #region Control... private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
private System.Data.SqlClient.SqlConnection sqlConnection;
private WindowsApplication.History.DataKaoQinSet dataKaoQinSet; private System.ComponentModel.IContainer components = null; #endregion #region 构造函数... public dataOperatorFrameHistory() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #endregion #region 设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(dataOperatorFrameHistory));
this.sqlDataAdapter = new System.Data.SqlClient.SqlDataAdapter();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection = new System.Data.SqlClient.SqlConnection();
this.dataKaoQinSet = new WindowsApplication.History.DataKaoQinSet();
((System.ComponentModel.ISupportInitialize)(this.statusZhuangTai)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ds)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusText)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataKaoQinSet)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.Name = "label1";
this.label1.Text = "数据操作历史";
//
// tool
//
this.tool.Name = "tool";
//
// status
//
this.status.Name = "status";
//
// imageList
//
this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
//
// dataGrid
//
this.dataGrid.Name = "dataGrid";
//
// sqlDataAdapter
//
this.sqlDataAdapter.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "KaHaoData_History", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("编号", "编号"),
new System.Data.Common.DataColumnMapping("日期", "日期"),
new System.Data.Common.DataColumnMapping("时间", "时间"),
new System.Data.Common.DataColumnMapping("操作员", "操作员"),
new System.Data.Common.DataColumnMapping("状态", "状态")})});
this.sqlDataAdapter.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 编号, 日期, 时间, 操作员, 状态 FROM KaHaoData_History";
this.sqlSelectCommand1.Connection = this.sqlConnection;
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO KaHaoData_History(日期, 时间, 操作员, 状态) VALUES (@日期, @时间, @操作员, @状态); SELE" +
"CT 编号, 日期, 时间, 操作员, 状态 FROM KaHaoData_History WHERE (编号 = @@IDENTITY)";
this.sqlInsertCommand1.Connection = this.sqlConnection;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@日期", System.Data.SqlDbType.VarChar, 50, "日期"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@时间", System.Data.SqlDbType.VarChar, 50, "时间"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@操作员", System.Data.SqlDbType.VarChar, 50, "操作员"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@状态", System.Data.SqlDbType.VarChar, 50, "状态"));
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE KaHaoData_History SET 日期 = @日期, 时间 = @时间, 操作员 = @操作员, 状态 = @状态 WHERE (编号 = @Original_编号) AND (操作员 = @Original_操作员 OR @Original_操作员 IS NULL AND 操作员 IS NULL) AND (日期 = @Original_日期) AND (时间 = @Original_时间 OR @Original_时间 IS NULL AND 时间 IS NULL) AND (状态 = @Original_状态 OR @Original_状态 IS NULL AND 状态 IS NULL); SELECT 编号, 日期, 时间, 操作员, 状态 FROM KaHaoData_History WHERE (编号 = @编号)";
this.sqlUpdateCommand1.Connection = this.sqlConnection;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@日期", System.Data.SqlDbType.VarChar, 50, "日期"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@时间", System.Data.SqlDbType.VarChar, 50, "时间"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@操作员", System.Data.SqlDbType.VarChar, 50, "操作员"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@状态", System.Data.SqlDbType.VarChar, 50, "状态"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_操作员", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "操作员", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_日期", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "日期", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_时间", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "时间", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_状态", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "状态", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@编号", System.Data.SqlDbType.Int, 4, "编号"));
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM KaHaoData_History WHERE (编号 = @Original_编号) AND (操作员 = @Original_操作员 OR @Original_操作员 IS NULL AND 操作员 IS NULL) AND (日期 = @Original_日期) AND (时间 = @Original_时间 OR @Original_时间 IS NULL AND 时间 IS NULL) AND (状态 = @Original_状态 OR @Original_状态 IS NULL AND 状态 IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_操作员", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "操作员", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_日期", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "日期", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_时间", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "时间", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_状态", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "状态", System.Data.DataRowVersion.Original, null));
//
// sqlConnection
//
this.sqlConnection.ConnectionString = "workstation id=localhost;integrated security=SSPI;database=SystemODBC";
//
// dataKaoQinSet
//
this.dataKaoQinSet.DataSetName = "DataKaoQinSet";
this.dataKaoQinSet.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// dataOperatorFrameHistory
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(746, 423);
this.Name = "dataOperatorFrameHistory";
this.Text = "dataOperatorFrameHistory";
this.Load += new System.EventHandler(this.dataOperatorFrameHistory_Load);
((System.ComponentModel.ISupportInitialize)(this.statusZhuangTai)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ds)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusText)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataKaoQinSet)).EndInit();
this.ResumeLayout(false);
} #endregion
#region 初始化事件...
private void dataOperatorFrameHistory_Load(object sender, System.EventArgs e)
{
#region Init DataGrid...
DataTable tempUserOperator=new DataTable();
this.sqlDataAdapter.Fill(dataKaoQinSet);
tempUserOperator=dataKaoQinSet.Tables[0];
base.dataGrid.DataSource=tempUserOperator;
base.statusText.Text="所有记录:"+selectCount.selectCount.selectCountStr("select count(*) from KaHaoData_History","KaHaoData_History").Trim();
base.dataAdapter=sqlDataAdapter;
base.ds=dataKaoQinSet;
base.cmOrders=(System.Windows.Forms.CurrencyManager) BindingContext[tempUserOperator];
#endregion
} #endregion }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -