?? 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 + -