?? form3.cs
字號(hào):
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Store
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
DateTime date1= DateTime.Now;
String b = date1.Year.ToString() +'-'+ date1.Month.ToString() + '-'+date1.Day.ToString();
textBox9.Text = b;
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (e.Node.Text.Equals("活期取款")&&e.Node.Parent.Text.Equals("取款"))
{
comboBox1.Text = "活期取款";
this.panel1.Visible = true;
this.panel2.Visible = false;
this.panel3.Visible = false;
this.panel4.Visible = false;
}
else if (e.Node.Text.Equals("定期取款") && e.Node.Parent.Text.Equals("取款"))
{
comboBox1.Text = "定期取款";
this.panel1.Visible = true;
this.panel2.Visible = false;
this.panel3.Visible = false;
this.panel4.Visible = false;
}
else if (e.Node.Text.Equals("活期存款") && e.Node.Parent.Text.Equals("存款"))
{
textBox14.Text = "活期存款";
this.panel2.Visible = true;
this.panel1.Visible = false;
this.panel3.Visible = false;
this.panel4.Visible = false;
}
else if (e.Node.Text.Equals("定期存款") && e.Node.Parent.Text.Equals("存款"))
{
textBox14.Text = "定期存款";
this.panel2.Visible = true;
this.panel1.Visible = false;
this.panel3.Visible = false;
this.panel4.Visible = false;
}
else if (e.Node.Text.Equals("開(kāi)戶") && e.Node.Parent.Text.Equals("存款"))
{
this.panel3.Visible = true;
this.panel1.Visible = false;
this.panel2.Visible = false;
this.panel4.Visible = false;
}
else if (e.Node.Text.Equals("Edit"))
{
this.panel2.Visible = true;
this.panel1.Visible = false;
}
else if (e.Node.Text.Equals("查詢"))
{
this.panel4.Visible = true;
this.panel2.Visible = false;
this.panel3.Visible = false;
this.panel1.Visible = false;
}
else if (e.Node.Text.Equals("修改密碼")&&e.Node.Parent.Text.Equals("系統(tǒng)維護(hù)"))
{
Form4 f = new Form4();
f.Focus();
f.Show();
}
else if (e.Node.Text.Equals("在線幫助") && e.Node.Parent.Text.Equals("系統(tǒng)維護(hù)"))
{
Form5 s = new Form5();
s.Focus();
s.Show();
}
}
private void button7_Click(object sender, EventArgs e)
{
this.panel1.Visible = false;
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
this.panel1.Visible = true;
this.panel2.Visible = false;
}
private void button5_Click(object sender, EventArgs e)
{
取款信息打印 frm = new 取款信息打印();
frm.Show();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text != "")
{
SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=銀行儲(chǔ)蓄系統(tǒng);Integrated Security=SSPI");
try
{
connection.Open();
SqlCommand command = new SqlCommand("select * from 儲(chǔ)戶信息 where 儲(chǔ)戶編號(hào)='" + textBox1.Text + "'", connection);
SqlDataReader reader = command.ExecuteReader();
//reader.Read();
if (reader.Read())
{
textBox2.Text = reader["儲(chǔ)戶編號(hào)"].ToString();
textBox3.Text = reader["利息"].ToString();
textBox6.Text = reader["利率"].ToString();
textBox5.Text = reader["金額"].ToString();
}
else
MessageBox.Show("儲(chǔ)戶不存在!");
}
catch (SqlException b)
{
Console.WriteLine(b.Message);
}
finally
{
connection.Close();
}
else
MessageBox.Show("請(qǐng)輸入儲(chǔ)戶編號(hào)!");
}
private void button2_Click(object sender, EventArgs e)
{
if (textBox10.Text != "")
{
SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=銀行儲(chǔ)蓄系統(tǒng);Integrated Security=SSPI");
try
{
connection.Open();
SqlCommand command = new SqlCommand("select * from 儲(chǔ)戶信息 where 儲(chǔ)戶編號(hào)='" + textBox10.Text + "'", connection);
SqlDataReader reader = command.ExecuteReader();
string c_mm=reader["密碼"].ToString();
if (Convert.ToInt32(textBox2.Text)==Convert.ToInt32(c_mm))
{
textBox4.Enabled = true;
}
else
MessageBox.Show("密碼不正確!");
}
catch (SqlException b)
{
Console.WriteLine(b.Message);
}
finally
{
connection.Close();
}
}
else
MessageBox.Show("請(qǐng)輸入儲(chǔ)戶密碼!");
}
private void button3_Click(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=銀行儲(chǔ)蓄系統(tǒng);Integrated Security=SSPI");
if (textBox4.Text != "")
{
try
{
connection.Open();
string sqlstr = " Insert into 取款信息(取款編號(hào),取款人,取款日期,取款金額,用戶帳號(hào),業(yè)務(wù)員編號(hào)) Values('" + textBox12.Text + "','" + textBox7.Text + "','" + textBox9.Text + "','" + textBox4.Text + "','" + textBox12.Text + "','" + textBox11.Text + "',)";
SqlCommand command1 = new SqlCommand(sqlstr, connection);
// 插入
//command1.Connection = connection;
SqlCommand command2 = new SqlCommand("update set 金額='" + textBox8.Text + "', from 儲(chǔ)戶信息 where 儲(chǔ)戶編號(hào)='" + textBox1.Text + "'", connection);
//string sqlstr = " Insert into card(取款編號(hào),取款人,取款日期,取款金額) Values('" + textBox12.Text + "','" + textBox7.Text + "','" + textBox9.Text + "','" + textBox4.Text + "')";// 插入
//command1.CommandText = sqlstr;
//command1.Connection = connection;
command1.ExecuteNonQuery();
MessageBox.Show("操作成功!");
}
catch (SqlException b)
{
Console.WriteLine(b.Message);
}
finally
{
connection.Close();
}
}
else
MessageBox.Show("輸入取款金額!");
}
private void button11_Click(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=銀行儲(chǔ)蓄系統(tǒng);Integrated Security=SSPI");
if (textBox27.Text != "")
{
int num = 1;
try
{
connection.Open();
string sqlstr = " Insert into 儲(chǔ)戶信息(儲(chǔ)戶編號(hào),卡號(hào),密碼,儲(chǔ)戶姓名,身份證號(hào),地址,聯(lián)系電話,業(yè)務(wù)員編號(hào),開(kāi)戶日期,備注) Values("+"'"+num+"',"+"'" + textBox27.Text + "',"+"'" + textBox26.Text + "',"+"'" + textBox25.Text + "',"+"'" + textBox24.Text + "',"+"'" + textBox23.Text + "',"+"'" + textBox17.Text + "',"+"'" + textBox15.Text + "',"+"'" + textBox28.Text + "',"+"'" +richTextBox1.Text + "')";// 插入
SqlCommand command1 = new SqlCommand(sqlstr, connection);
//SqlCommand command2 = new SqlCommand("update set 金額='" + textBox8.Text + "', from 儲(chǔ)戶信息 where 儲(chǔ)戶編號(hào)='" + textBox1.Text + "'", connection);
string sqlstr1 = " Insert into 帳戶信息(儲(chǔ)戶編號(hào),用戶帳號(hào),密碼,,開(kāi)戶日期,類型,金額,利率,期限) Values(" + "'" + num + "'," + "'" + textBox27.Text + "'," + "'" + textBox26.Text + "'," + "'" + textBox28.Text + "',"+"'0',"+"'0',"+"'0',"+"'0')";// 插入
SqlCommand command2 = new SqlCommand(sqlstr1, connection);
//command1.CommandText = sqlstr;
//command1.Connection = connection;
int i,j;
i = command1.ExecuteNonQuery();
j = command2.ExecuteNonQuery();
if ((i < 1)||(j < 1))
{
MessageBox.Show("操作失敗!");
connection.Close();
}
else
{
MessageBox.Show("操作成功!");
num++;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -