信息管理与信息系统专业课综合实验大报告.doc_第1页
信息管理与信息系统专业课综合实验大报告.doc_第2页
信息管理与信息系统专业课综合实验大报告.doc_第3页
信息管理与信息系统专业课综合实验大报告.doc_第4页
信息管理与信息系统专业课综合实验大报告.doc_第5页
已阅读5页,还剩34页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

小学期上机报告学院:工商管理学院 专业:信息管理与信息系统学号:2013011967姓名:朱泽1、 HIPO图2、 数据流图3、 E-R实例图4、 输入输出设计5、 界面设计6、 核心代码数据库: private string source = ConfigurationSettings.AppSettingssource;SqlConnection con = new SqlConnection(source); con.Open();登录页面:try if (sread.Read() sread.Close(); if (com.ExecuteScalar().ToString() = 管理员) th = new Thread(new ThreadStart(StartAdminForm); th.Start(); this.Close(); else string ss = select Area_code from users where username= + txtname.Text + and password = + txtpsw.Text + ; SqlCommand cc = new SqlCommand(ss, con); myarea = cc.ExecuteScalar().ToString(); myname = txtname.Text; mytype = com.ExecuteScalar().ToString(); th = new Thread(new ThreadStart(StartOtherForm); th.Start(); this.Close(); else if (txtname.Text = | txtpsw.Text = ) MessageBox.Show(未输入用户名或密码!); else MessageBox.Show(用户名或密码错误!); 日志管理.write(DateTime.Now.ToLocalTime().ToString()+ +myname+用户登录失败); catch (Exception ex) throw new Exception(ex.ToString(); finally con.Dispose(); con.Close(); com.Dispose(); sread.Close(); 用户管理:private void add_Click(object sender, EventArgs e) string myname = .Text; string mypassword = this.password.Text; string mytype = boBox1.Text; string myarea = boBox2.Text; if (myname != & mypassword != ) string sql = select username from users where username= + myname + ; SqlConnection con = new SqlConnection(source); con.Open(); SqlCommand com = new SqlCommand(sql, con); SqlDataReader sread = com.ExecuteReader(); try if (!sread.Read() sread.Close(); string ss = insert into users (username,password,type,Area_code)values( + myname + , + mypassword + , + mytype + , + myarea + ); SqlCommand co = new SqlCommand(ss, con); if (co.ExecuteNonQuery() != 0) MessageBox.Show(增加成功!); name.Text = ; password.Text = ; co.Dispose(); else MessageBox.Show(增加失败!); co.Dispose(); else sread.Close(); MessageBox.Show(用户已存在,请重新输入用户名!); name.Text = ; password.Text = ; catch MessageBox.Show(数据库错误!); finally com.Dispose(); con.Dispose(); con.Close(); else MessageBox.Show(未输入用户名或密码!); private void delete_Click(object sender, EventArgs e) string myname = .Text; if (myname != ) string sql = select username from users where username= + myname + ; SqlConnection con = new SqlConnection(source); con.Open(); SqlCommand com = new SqlCommand(sql, con); SqlDataReader sread = com.ExecuteReader(); try if (sread.Read() sread.Close(); string ss = delete from users where username= + myname + ; SqlCommand co = new SqlCommand(ss, con); if (co.ExecuteNonQuery() != 0) MessageBox.Show(删除成功!); co.Dispose(); else MessageBox.Show(删除失败!); co.Dispose(); else sread.Close(); MessageBox.Show(用户不存在!); name.Text = ; catch MessageBox.Show(数据库错误!); finally com.Dispose(); con.Dispose(); con.Close(); else MessageBox.Show(未输入用户名!); private void update_Click(object sender, EventArgs e) string myname = .Text; string mypassword = this.password.Text; string mytype = boBox1.Text; string myarea = boBox2.Text; if (myname != & mypassword != ) string sql = select username from users where username= + myname + ; SqlConnection con = new SqlConnection(source); con.Open(); SqlCommand com = new SqlCommand(sql, con); SqlDataReader sread = com.ExecuteReader(); try if (sread.Read() sread.Close(); string ss = update users set username= + myname + ,password= + mypassword + ,type= + mytype + ,type= + myarea + where username= + myname + ; SqlCommand co = new SqlCommand(ss, con); if (co.ExecuteNonQuery() != 0) MessageBox.Show(更新成功!); co.Dispose(); else MessageBox.Show(更新失败!); co.Dispose(); else sread.Close(); MessageBox.Show(用户不存在!); name.Text = ; password.Text = ; catch MessageBox.Show(数据库错误!); finally com.Dispose(); con.Dispose(); con.Close(); else MessageBox.Show(未输入用户名或密码!); private void search_Click(object sender, EventArgs e) if (flag) this.panel1.Visible = true; string sql = select username as 用户名,password as 密码,type as 用户类型,area_code as 地区代码 from users; SqlConnection con = new SqlConnection(source); try con.Open(); SqlCommand com = new SqlCommand(sql, con); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = com; DataSet ds = new DataSet(); sda.Fill(ds, users); this.dataGridView1.DataSource = ds.Tables0.DefaultView; dataGridView1.DataSource = ds.Tablesusers; sda.Dispose(); com.Dispose(); catch(Exception ex) new Exception(ex.ToString(); finally con.Dispose(); con.Close(); flag = false; else this.panel1.Visible = false; flag = true; 表单录入:public void save_Click(object sender, EventArgs e) if (id = 1) this.Dis_name = dis_name.Text; this.Write_name = write_name.Text; this.Date1 = date1.Text; this.S_in_name = s_in_name.Text; this.S_in_loc = s_in_loc.Text; this.S_in_owner = s_in_owner.Text; this.Date2 = date2.Text; this.Set = set.Text; this.Get = get.Text; this.KPS_name = kps_name.Text; this.Check_name = check_name.Text; this.Date3 = date3.Text; if (Dis_name != & Write_name != & Date1 != & S_in_name != & S_in_loc != & S_in_owner != & Date2 != & Set != & Get != & KPS_name != & Check_name != & Check_name != & Date3 != ) if (sys_name1.Text = ) MessageBox.Show(未输入明细信息!); else if (det1.Text = | num1.Value = 0) MessageBox.Show(未进行选择!); else SqlConnection con = new SqlConnection(source); con.Open(); string s = select dis_code from S_distributor where dis_name= + Dis_name + ; SqlCommand c = new SqlCommand(s, con); string code = c.ExecuteScalar().ToString(); c.Dispose(); try string sql = select s_no from S_wellsystem where s_no=0000000001; SqlCommand com = new SqlCommand(sql, con); SqlDataReader dr = com.ExecuteReader(); if (dr.Read() /原来已有数据 dr.Close(); string s1 = select s_no from S_wellsystem order by s_no desc; SqlCommand c1 = new SqlCommand(s1, con); string num = c1.ExecuteScalar().ToString(); int no = Convert.ToInt32(num) + 1; num = no.ToString().PadLeft(10, 0); c1.Dispose(); string wellform = String.Format(0*1*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20*21*22*23*24*25*26*27*28*29*30*31*32*33*34*35*36*37*38*39*40*41*42*43*44*45*46*47*48*49*50, Dis_name, Write_name, Date1, S_in_name, note1.Text, S_in_loc, note2.Text, S_in_owner, note3.Text, Date2, note4.Text, Set, note5.Text, Get, note6.Text, KPS_name, note7.Text, sys_name1.Text, det1.Text, num1.Value, note9.Text, det2.Text, num2.Value, note9.Text, det3.Text, num3.Value, note11.Text, det4.Text, num4.Value, note12.Text, det5.Text, num5.Value, note13.Text, det6.Text, num6.Value, note14.Text, sys_name2.Text, det7.Text, num7.Value, note15.Text, det8.Text, num8.Value, note16.Text, det9.Text, num9.Value, note17.Text, det10.Text, num10.Value, note17.Text, Check_name, Date3); string ss = insert into s_wellsystem(s_no,t_date,dis_code,area_code,s_wellform)values( + num + , + Date2 + , + code + , + area + , + wellform + ); SqlCommand cc = new SqlCommand(ss, con); cc.ExecuteNonQuery(); DialogResult d = MessageBox.Show(已保存!保留此窗口吗?, 提示, MessageBoxButtons.OKCancel); 日志管理.write(DateTime.Now.ToLocalTime().ToString() + + area + 地区新建了一张人孔井安装信息表); if (d = DialogResult.OK) else if (d = DialogResult.Cancel) this.Close(); else /原来没有数据 dr.Close(); string wellform = String.Format(0*1*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20*21*22*23*24*25*26*27*28*29*30*31*32*33*34*35*36*37*38*39*40*41*42*43*44*45*46*47*48*49*50, Dis_name, Write_name, Date1, S_in_name, note1.Text, S_in_loc, note2.Text, S_in_owner, note3.Text, Date2, note4.Text, Set, note5.Text, Get, note6.Text, KPS_name, note7.Text, sys_name1.Text, det1.Text, num1.Value, note9.Text, det2.Text, num2.Value, note9.Text, det3.Text, num3.Value, note11.Text, det4.Text, num4.Value, note12.Text, det5.Text, num5.Value, note13.Text, det6.Text, num6.Value, note14.Text, sys_name2.Text, det7.Text, num7.Value, note15.Text, det8.Text, num8.Value, note16.Text, det9.Text, num9.Value, note17.Text, det10.Text, num10.Value, note17.Text, Check_name, Date3); string ss = insert into s_wellsystem(s_no,t_date,dis_code,area_code,s_wellform)values(0000000001, + Date2 + , + code + , + area + , + wellform + ); SqlCommand cc = new SqlCommand(ss, con); cc.ExecuteNonQuery(); DialogResult d = MessageBox.Show(已保存!保留此窗口吗?, 提示, MessageBoxButtons.OKCancel); 日志管理.write(DateTime.Now.ToLocalTime().ToString() + + area + 地区新建了一张人孔井安装信息表); if (d = DialogResult.OK) else if (d = DialogResult.Cancel) this.Close(); catch (Exception ex) throw new Exception(ex.ToString(); finally con.Dispose(); con.Close(); else MessageBox.Show(未输入基本信息!); else this.Dis_name = dis_name.Text; this.Write_name = write_name.Text; this.Date1 = date1.Text; this.S_in_name = s_in_name.Text; this.S_in_loc = s_in_loc.Text; this.S_in_owner = s_in_owner.Text; this.Date2 = date2.Text; this.Set = set.Text; this.Get = get.Text; this.KPS_name = kps_name.Text; this.Check_name = check_name.Text; this.Date3 = date3.Text; if (Dis_name != & Write_name != & Date1 != & S_in_name != & S_in_loc != & S_in_owner != & Date2 != & Set != & Get != & KPS_name != & Check_name != & Check_name != & Date3 != ) if (style.Text = | style1.Text = | num2_1.Text = | det2_1.Text = | det2_2.Text = ) MessageBox.Show(未输入详细信息!); else SqlConnection con = new SqlConnection(source); con.Open(); string s = select dis_code from S_distributor where dis_name= + Dis_name + ; SqlCommand c = new SqlCommand(s, con); string code = c.ExecuteScalar().ToString(); c.Dispose(); try string sql = selec

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论