📄 form3.cs
字号:
}
}
catch (SqlException b)
{
Console.WriteLine(b.Message);
}
finally
{
connection.Close();
}
}
else
MessageBox.Show("请输入新卡卡号!");
}
private void panel3_Paint(object sender, PaintEventArgs e)
{
DateTime date1 = DateTime.Now;
String b = date1.Year.ToString() + '-' + date1.Month.ToString() + '-' + date1.Day.ToString();
textBox28.Text = b;
}
private void panel2_Paint(object sender, PaintEventArgs e)
{
DateTime date1 = DateTime.Now;
String b = date1.Year.ToString() + '-' + date1.Month.ToString() + '-' + date1.Day.ToString();
textBox13.Text = b;
}
private void button9_Click(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=银行储蓄系统;Integrated Security=SSPI");
if (textBox22.Text != "")
{
double n=0, b;
try
{
connection.Open();
string sqlstr = " Insert into 存款信息(卡号,储户姓名,存款人,业务员编号,利率,存款日期,存款类型,存款期限,存款金额,备注) Values('" + textBox22.Text + "','" + textBox21.Text + "','" + textBox20.Text + "','" + Int32.Parse(textBox16.Text) + "','" + textBox18.Text + "','" + textBox13.Text + "','" + textBox14.Text + "','" + comboBox2.Text + "','" + textBox19.Text+ "','" + richTextBox3.Text + "')";// 插入
SqlCommand command1 = new SqlCommand(sqlstr, connection);
string sqlstr1 = "select * from 帐户信息 where 用户帐号='"+textBox22.Text+"'";
SqlCommand command2 = new SqlCommand(sqlstr1,connection);
SqlDataReader read = command2.ExecuteReader();
if (read.Read())
{
string m = read["金额"].ToString();
n = Double.Parse(m);
b = Double.Parse(textBox19.Text);
n = b+n;
if (Int32.Parse(read["类型"].ToString())!=0)
{
string sqlstr3 = " insert into 帐户信息(类型) where 用户帐号 = '" + textBox22.Text + "' values('" + textBox14.Text + "')";
SqlCommand command = new SqlCommand(sqlstr3, connection);
command.ExecuteNonQuery();
}
}
string sqlstr2 = " update 帐户信息 set 金额 = '"+n.ToString()+"' where 用户帐号 = '"+textBox22.Text+" and 类型 = '"+textBox14.Text+"'";
SqlCommand command3 = new SqlCommand(sqlstr2, connection);
command3.ExecuteNonQuery();
int i,j;
j = command1.ExecuteNonQuery();
i = command2.ExecuteNonQuery();
if ((j < 1)||(i < 1))
{
MessageBox.Show("插入失败!");
}
else MessageBox.Show("操作成功!");
}
catch (SqlException ef)
{
Console.WriteLine(ef.Message);
}
finally
{
connection.Close();
}
}
else
MessageBox.Show("请输入卡号!");
}
private void button4_Click(object sender, EventArgs e)
{
this.panel2.Visible = false;
}
private void button6_Click(object sender, EventArgs e)
{
this.panel3.Visible = false;
}
private void 全部提前支取ToolStripMenuItem_Click(object sender, EventArgs e)
{
comboBox1.Text = "活期取款";
this.panel1.Visible = true;
this.panel2.Visible = false;
this.panel3.Visible = false;
this.panel4.Visible = false;
}
private void 部分提前支取ToolStripMenuItem_Click(object sender, EventArgs e)
{
comboBox1.Text = "定期取款";
this.panel1.Visible = true;
this.panel2.Visible = false;
this.panel3.Visible = false;
this.panel4.Visible = false;
}
private void 活期ToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox14.Text = "活期存款";
this.panel2.Visible = true;
this.panel1.Visible = false;
this.panel3.Visible = false;
this.panel4.Visible = false;
}
private void 定期存款ToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox14.Text = "定期存款";
this.panel2.Visible = true;
this.panel1.Visible = false;
this.panel3.Visible = false;
this.panel4.Visible = false;
}
private void 储蓄存款ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.panel3.Visible = true;
this.panel1.Visible = false;
this.panel2.Visible = false;
this.panel4.Visible = false;
}
private void 查询ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.panel4.Visible = true;
this.panel1.Visible = false;
this.panel2.Visible = false;
this.panel3.Visible = false;
}
private void button12_Click(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=银行储蓄系统;Integrated Security=SSPI");
if (textBox29.Text != "")
{
try
{
connection.Open();
string strSQL = "select * from 储户信息 where 卡号='" + textBox29.Text.ToString() + "'and 密码='" + textBox30.Text.ToString() + "'";
SqlCommand cmd = new SqlCommand(strSQL, connection);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
//显示存款信息
#region
//string str1 = "select * from 存款信息";
//SqlCommand cmd1 = new SqlCommand(str1, connection);
//SqlDataReader dr1 = cmd1.ExecuteReader();
#endregion
//显示收付款信息
#region
#endregion
//显示储户信息
#region
#endregion
//显示帐户信息
#region
#endregion
}
else
{
MessageBox.Show("用户名或口令有错,请重新输入!");
}
}
catch (SqlException b)
{
Console.WriteLine(b.Message);
}
finally
{
connection.Close();
}
}
else
{
MessageBox.Show("请输入完整的正确信息!");
}
}
private void Form3_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“银行储蓄系统DataSet4.帐号信息”中。您可以根据需要移动或移除它。
this.帐号信息TableAdapter.Fill(this.银行储蓄系统DataSet4.帐号信息);
// TODO: 这行代码将数据加载到表“银行储蓄系统DataSet3.储户信息”中。您可以根据需要移动或移除它。
this.储户信息TableAdapter.Fill(this.银行储蓄系统DataSet3.储户信息);
// TODO: 这行代码将数据加载到表“银行储蓄系统DataSet2.存款信息”中。您可以根据需要移动或移除它。
this.存款信息TableAdapter1.Fill(this.银行储蓄系统DataSet2.存款信息);
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void 修改密码ToolStripMenuItem1_Click(object sender, EventArgs e)
{
Form4 f = new Form4();
f.Focus();
f.Show();
}
private void 在线帮助ToolStripMenuItem2_Click(object sender, EventArgs e)
{
Form5 s = new Form5();
s.Focus();
s.Show();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -