课程设计报告完整版(6)

2019-05-17 14:22

if (rbshouru.Checked == true) leixing = \收入\;

if(MessageBox.Show(\你确定要添加此信息吗\,\提示\,MessageBoxButtons.YesNo)== DialogResult.Yes) { try

{ string insert = \个人理财 values('\ + name + \ + danjia + \ + leixing + \ + date.ToShortDateString() + \ + beizhu + \;

SqlCommand comm = new SqlCommand(insert, con); comm.ExecuteNonQuery(); }

catch (Exception ex)

{ MessageBox.Show(ex.Message + \添加用户失败\, \错误提示\); return; } }

MessageBox.Show(\添加信息成功\,\提示\);

}

button15_Click(sender, e); con.Close(); }

(6)修改个人理财信息按钮代码的实现: private void button11_Click(object sender, EventArgs e)

{修改个人理财信息 licai = new 修改个人理财信息(); licai.Visible=true; }

(7)退出此界面按钮代码的实现:

private void button14_Click(object sender, EventArgs e) { this.Close(); } (8)总计的实现按钮代码的实现:

private void button12_Click(object sender, EventArgs e)

{ 理财总计 zongji = new 理财总计(); zongji.Visible = true;

查询个人理财界面的实现,如图4-6所示:

图4-6查询个人理财界面的实现

(1)查询个人理财信息按钮代码的实现: private void button1_Click(object sender, EventArgs e) { string str = null; if (textBox1.Text != \)

{ str = \个人理财 where 费用名

称='\ + textBox1.Text + \; textBox1.Clear(); } else

if (textBox2.Text != \ && textBox3.Text != \) { int a = int.Parse(textBox2.Text.Trim()); int b = int.Parse(textBox3.Text.Trim()); if (a < b)

str = \个人理财 where 费用 between \+a+\+b+\; else

str = \个人理财 where 费用 between \ + b+ \ + a + \; textBox2.Clear(); textBox3.Clear(); } else

if (rbshou.Checked == true || rbzhi.Checked== true)

{string lei = null;

DataSet dst = new DataSet();

string connstr = \Source=(local);Initial Catalog=Message;Integrated Security=True\; SqlConnection con = new SqlConnection (connstr); ; con.Open();

SqlDataAdapter sda = new SqlDataAdapter(str, con);

sda.Fill(dst, \);

if (rbshou.Checked == true) lei = \收入\; else lei = \支出\;

str = \个人理财 where 费用类型='\ +lei+ \; } else

if (textBox4.Text != \) { DateTime time = DateTime.Now; try

time = DateTime.Parse(textBox4.Text);} catch (Exception s

MessageBox.Show(\你输入的日期格式不正确\, \错误提示\); return; }

str = \备忘录 where YEAR(时间)=YEAR('\ + time + \时

间)=MONTH('\ + time + \时间)=DAY('\ + time + \; textBox4.Clear(); } else

{ MessageBox.Show(\你没有输入要查询的条件\, \错误提示\); return; }

dataGridView1.DataSource =dst.Tables[\]. DefaultView; con.Close(); }

(2)退出此界面按钮代码的实现:

private void button2_Click(object sender, EventArgs e) { this.Close(); }

修改个人理财信息界面的实现,如下图4-7所示:

图4-7修改个人理财信息界面的实现

(1)修改个人理财按钮的实现代码: private void button1_Click(object sender, EventArgs e)

{string str = null; string leibie = null; String fname = textBox1.Text.Trim(); if (rbnshouru.Checked == true) leibie = \收入\; else

if (rbnzhichu.Checked== true) leibie = \支出\; if (textBox1.Text == \)

{ MessageBox.Show(\你没有输入要修改的标题\, \错误提示\); return; } else

if (textBox2.Text != \ && leibie == null && textBox3.Text == \ && textBox4.Text == \) {int feiyong = 0;

feiyong = int.Parse(textBox2.Text.Trim()); str = \个人理财 set 费用=\ + feiyong + \费用名称='\ + fname + \; textBox2.Clear(); } else

if (textBox2.Text == \ && leibie != null && textBox3.Text == \ && textBox4.Text == \) {str = \个人理财 set 费用类型='\ + leibie+ \费用名称='\ + fname + \; rbnshouru.Checked = false; rbnzhichu.Checked = false; } else

if (textBox2.Text == \ && leibie == null && textBox3.Text != \ && textBox4.Text == \) { DateTime time=DateTime.Parse (textBox3.Text.Trim());

str = \个人理财 set 时间=\ + time+ \

}

where 费用名称='\ + fname + \; (2)删除个人理财按钮代码的实现: textBox3.Clear(); } else

if (textBox2.Text == \ && leibie == null && textBox3.Text == \ && textBox4.Text != \) private void button4_Click(object sender, EventArgs e)

{ string str=null; int a = 0; int b = 0; string lei = null;

if (rbnshou.Checked == true) lei = \收入\; { str = \个人理财 set 备注='\ +

textBox4.Text.Trim() + \费用名

称='\ + fname + \; textBox4.Clear(); } else

{ MessageBox.Show(\你没有输入要修改的内容

\,\错误提示\); return; }

string connstr = \Source=(local);Initial Catalog=Message;Integrated

Security=True\;SqlConnection con = new SqlConnection(connstr); con.Open();

if(MessageBox.Show(\你确定要修改此信息吗?\,\提示\,MessageBoxButtons.YesNo)== DialogResult.Yes) { try

{ SqlCommand comm = new SqlCommand(str, con); comm.ExecuteNonQuery(); }

catch (Exception ex)

{ MessageBox.Show(\没有找到你要修改的信息\, \错误提示\); return; }

MessageBox.Show(\信息修改成功!\, \提示\); }

con.Close();

else

if (rbnzhi.Checked == true) lei = \支出\;

DateTime time = DateTime.Now; if (textBox5.Text != \&&textBox6.Text== \&&textBox8.Text==\&&lei==null)

{ str = \个人理财 where 费用名称='\ + textBox5.Text.Trim() + \; textBox5.Clear();

} Else

if (textBox5.Text == \ && lei==null&& textBox6.Text != \ && textBox7.Text != \ && textBox8.Text == \)

{ a = int.Parse(textBox6.Text.Trim()); b = int.Parse(textBox7.Text.Trim()); if(a

str = \from 个人理财 where用 between \+a+\+b+\; else

str = \个人理财 where 费用 between \+b+\+a+\;

textBox6.Clear(); textBox7.Clear(); } else

if (textBox5.Text == \ && textBox6.Text == \ && textBox8.Text == \ && lei != null) { str = \个人理财 where 费用类型

='\+lei+\;

rbnzhi.Checked = false; } else

if (textBox5.Text == \ && textBox6.Text == \ && textBox8.Text != \ && lei == null) {time = DateTime.Parse(textBox8 .Text.Trim());

str = \个人理财 where 时间=\ + textBox8.Text + \; textBox8.Clear(); } else

{ MessageBox.Show(\你没有输入要删除的条件!\,\错误提示\); return; }

DataSet dst = new DataSet();

string connstr = \Source=(local);Initial Catalog=Message;Integrated Security=True\;

}

catch (Exception ea)

{ MessageBox.Show(ea.Message); return; } }

MessageBox.Show(\删除成功\,\提示\); con.Close(); }

SqlConnection con = new SqlConnection (connstr); ; con.Open();

if(MessageBox.Show(\你确定要删除此信息吗?\,\提示\,MessageBoxButtons.YesNo)== DialogResult.Yes) { try

{ SqlCommand comm = new SqlCommand(str, con); comm.ExecuteNonQuery(); rbnshou.Checked =false

理财总计界面的实现如下图4-8所示:

图4-8 理财总计界面的实现

(1)退出此界面

private void button4_Click(object sender, EventArgs e) { this.Close(); }

(2)收入总计按钮代码的实现:

private void button1_Click(object sender, EventArgs e)

{ if (tbtime1.Text == \ || tbtime2.Text == \) { MessageBox.Show(\你没有输入要查询的日期范 围!\,\错误提示\); return;


课程设计报告完整版(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:健十商城孕妇食品之孕妇不能吃的水果有哪些

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: