📄 accountsetting.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace 财务管理系统
{
/// <summary>
/// AccountSetting 的摘要说明。
/// </summary>
public class AccountSetting : System.Windows.Forms.Form
{
private 财务管理系统.DataSet2 dataSet21;
private System.Data.SqlClient.SqlCommand sqlSelectCommand2;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.DataGrid dataGrid2;
private System.Data.SqlClient.SqlDataAdapter da1;
private System.Data.SqlClient.SqlDataAdapter da2;
private System.Windows.Forms.Button btnNewAccount;
private System.Windows.Forms.Button btnUseAccount;
private System.Windows.Forms.Button btnBalance;
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.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn3;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn5;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn6;
private System.Data.SqlClient.SqlConnection sqlConnection1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public AccountSetting()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AccountSetting));
this.da1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.dataSet21 = new 财务管理系统.DataSet2();
this.da2 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn3 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn4 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn5 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn6 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGrid2 = new System.Windows.Forms.DataGrid();
this.btnNewAccount = new System.Windows.Forms.Button();
this.btnUseAccount = new System.Windows.Forms.Button();
this.btnBalance = new System.Windows.Forms.Button();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
((System.ComponentModel.ISupportInitialize)(this.dataSet21)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
this.SuspendLayout();
//
// da1
//
this.da1.DeleteCommand = this.sqlDeleteCommand1;
this.da1.InsertCommand = this.sqlInsertCommand1;
this.da1.SelectCommand = this.sqlSelectCommand1;
this.da1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "帐簿初始化表", 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("期初余额", "期初余额"),
new System.Data.Common.DataColumnMapping("余额方向", "余额方向")})});
this.da1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM 帐簿初始化表 WHERE (科目代码 = @Original_科目代码) AND (余额方向 = @Original_余额方向 OR @Original_余额方向 IS NULL AND 余额方向 IS NULL) AND (期初余额 = @Original_期初余额 OR @Original_期初余额 IS NULL AND 期初余额 IS NULL) AND (科目名称 = @Original_科目名称 OR @Original_科目名称 IS NULL AND 科目名称 IS NULL) AND (累计借方 = @Original_累计借方 OR @Original_累计借方 IS NULL AND 累计借方 IS NULL) AND (累计贷方 = @Original_累计贷方 OR @Original_累计贷方 IS NULL AND 累计贷方 IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_科目代码", System.Data.SqlDbType.VarChar, 20, 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, 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.Money, 8, 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, 20, 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.Money, 8, 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.Money, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "累计贷方", System.Data.DataRowVersion.Original, null));
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO 帐簿初始化表(科目代码, 科目名称, 累计借方, 累计贷方, 期初余额, 余额方向) VALUES (@科目代码, @科目名称, @累计借" +
"方, @累计贷方, @期初余额, @余额方向); SELECT 科目代码, 科目名称, 累计借方, 累计贷方, 期初余额, 余额方向 FROM 帐簿初始化表 W" +
"HERE (科目代码 = @科目代码)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@科目代码", System.Data.SqlDbType.VarChar, 20, "科目代码"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@科目名称", System.Data.SqlDbType.VarChar, 20, "科目名称"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@累计借方", System.Data.SqlDbType.Money, 8, "累计借方"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@累计贷方", System.Data.SqlDbType.Money, 8, "累计贷方"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@期初余额", System.Data.SqlDbType.Money, 8, "期初余额"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@余额方向", System.Data.SqlDbType.VarChar, 4, "余额方向"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 科目代码, 科目名称, 累计借方, 累计贷方, 期初余额, 余额方向 FROM 帐簿初始化表";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE 帐簿初始化表 SET 科目代码 = @科目代码, 科目名称 = @科目名称, 累计借方 = @累计借方, 累计贷方 = @累计贷方, 期初余额 = @期初余额, 余额方向 = @余额方向 WHERE (科目代码 = @Original_科目代码) AND (余额方向 = @Original_余额方向 OR @Original_余额方向 IS NULL AND 余额方向 IS NULL) AND (期初余额 = @Original_期初余额 OR @Original_期初余额 IS NULL AND 期初余额 IS NULL) AND (科目名称 = @Original_科目名称 OR @Original_科目名称 IS NULL AND 科目名称 IS NULL) AND (累计借方 = @Original_累计借方 OR @Original_累计借方 IS NULL AND 累计借方 IS NULL) AND (累计贷方 = @Original_累计贷方 OR @Original_累计贷方 IS NULL AND 累计贷方 IS NULL); SELECT 科目代码, 科目名称, 累计借方, 累计贷方, 期初余额, 余额方向 FROM 帐簿初始化表 WHERE (科目代码 = @科目代码)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@科目代码", System.Data.SqlDbType.VarChar, 20, "科目代码"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@科目名称", System.Data.SqlDbType.VarChar, 20, "科目名称"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@累计借方", System.Data.SqlDbType.Money, 8, "累计借方"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@累计贷方", System.Data.SqlDbType.Money, 8, "累计贷方"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@期初余额", System.Data.SqlDbType.Money, 8, "期初余额"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@余额方向", System.Data.SqlDbType.VarChar, 4, "余额方向"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_科目代码", System.Data.SqlDbType.VarChar, 20, 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, 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.Money, 8, 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, 20, 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.Money, 8, 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.Money, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "累计贷方", System.Data.DataRowVersion.Original, null));
//
// dataSet21
//
this.dataSet21.DataSetName = "DataSet2";
this.dataSet21.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// da2
//
this.da2.SelectCommand = this.sqlSelectCommand2;
this.da2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "系统参数表", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("编号", "编号"),
new System.Data.Common.DataColumnMapping("参数名称", "参数名称"),
new System.Data.Common.DataColumnMapping("取值", "取值")})});
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT 编号, 参数名称, 取值 FROM 系统参数表";
this.sqlSelectCommand2.Connection = this.sqlConnection1;
//
// dataGrid1
//
this.dataGrid1.CaptionVisible = false;
this.dataGrid1.DataMember = "帐簿初始化表";
this.dataGrid1.DataSource = this.dataSet21;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(0, 64);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(416, 424);
this.dataGrid1.TabIndex = 0;
this.dataGrid1.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
this.dataGridTableStyle1});
//
// dataGridTableStyle1
//
this.dataGridTableStyle1.DataGrid = this.dataGrid1;
this.dataGridTableStyle1.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] {
this.dataGridTextBoxColumn1,
this.dataGridTextBoxColumn2,
this.dataGridTextBoxColumn3,
this.dataGridTextBoxColumn4,
this.dataGridTextBoxColumn5,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -