C#课程管理系统设计.doc_第1页
C#课程管理系统设计.doc_第2页
C#课程管理系统设计.doc_第3页
C#课程管理系统设计.doc_第4页
C#课程管理系统设计.doc_第5页
已阅读5页,还剩17页未读 继续免费阅读

下载本文档

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

文档简介

大理学院 数学与计算机学院C#课程设计2013 2014学年 第一学期 课程名称 C#课程设计设计题目 管理系统设计 学生姓名 李超 学 号2011115246专业班级11级计算机科学与技术2班指导教师 杜英国老师 2013年 9月 20日目录 第一章 绪 论 人类有几千年的历史,计算机从产生到现在只有不过50多年,然而网络的迅速发展也不到十年的时候。但是,计算机和网络对社会的影响已经迅速扩大,甚至在改变人们的生活。特别是九十年代以后,多媒体和网络技术的飞速发展正在以惊人的速度改变着人们的工作方式,交往方式和生活方式。真想著名的未来学家尼格罗宏迪所说的那样“数字不再只是和计算有关,他决定着我们的生存。”科学技术是第一生产力,是最先进的生产力。现在,已经没有人怀疑信息技术的发展将要会引起人类社会全面和深刻的变革,使人类社会由工业社会迈向信息社会。面前,在社会各个方面都呈现出了与工业社会显著不同的特点。网上书店,网上医院,网上学校,网上购物,网上银行,政府上网等新兴事物如雨后春笋般涌现出来,对人们的传统生活方式,工作凡是的极大冲击,使人们感受到技术的脉搏和信息时代向前的步伐。随着现在网络的不断发展,出现了不少的杀毒软件,而且附生着许多的其他产品,比如相关的一些浏览器,云存储,还有一些小游戏等等,而人们为了更好的利用这些东西,纷纷注册了一些相关的账号,注册的人少的时候倒是可以随便都可以管理好这些注册了的账号,然而当人多的时候,在管理方面,这个就是一个很大的问题,面对庞大的信息量需要管理,为了能高效的管理这些信息,实现用户的注册,信息查询,方便管理人员对不同的用户实行不同的授权,等,从而减少管理方面的工作量,达到高效的工作。 第二章 系统介绍 本系统包括注册管理,信息查询,修改信息,删除用户等部分组成。其功能主要有: (1)用户登陆,包括输入账号,密码; (2)用户信息,包括账号,姓名,密码,生份证号码,家庭住址,联系电话; (3)信息修改,包括输入账号,密码; (4)用户删除,包括用户的一切; 用户管理系统是典型的信息管理系统,其开发主要包括后台数据库的建立和维护已经前端应用程序的开发两个方面。对于前者要求建立起数据库一致性和完整性强,数据安全性好的数据库。面对于后者则要求应用程序功能完备,易使用等特点。第三章 数据库设计3.1 数据库设计 根据对数据项与数据结构的分析,设计出能够满足系统需求的各种实体,及他们之间的关系,为后面的逻辑结构设计打下基础。3.1.1 系统ER图密码账号用户家庭地址身份证号码姓名3.2.2 数据表列名数据类型允许null值默认值编号nchar(50)不允许无姓名nchar(50)不允许无密码nchar(50)不允许无性别nchar(50)不允许无家庭地址nchar(50)不允许无联系电话nchar(50)不允许无3.2.2数据库连接代码新建类DataBaseLinkusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Data.SqlClient;namespace WindowsFormsApplication1 class DataBaseLink public string strConn = Data Source=localhost;Initial Catalog=YongHu;Integrated Security=True; public SqlConnection DataLink() SqlConnection con = new SqlConnection(strConn); return con; 第四章 主要内容4.1 登陆界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1 public partial class 登?陆?界?面? : Form public 登陆界面() InitializeComponent(); bool bl; private void button1_Click(object sender, EventArgs e) DengLu dl = new DengLu(); bl = dl.YongHuYanZheng(textBox1.Text.ToString().Trim(), textBox2.Text.ToString().Trim(); if (bl = true) this.Close(); private void button2_Click(object sender, EventArgs e) this.Close(); private void 登陆界面_Load(object sender, EventArgs e) 4.2 菜单管理界面新建windows窗体caidanlan 添加BindingNavigator BindingSource tabControl1 等窗体控件 4.2.1 用户信息 删除信息 修改信息 创建窗体如下:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1 public partial class YongHuForm2 : Form private BindingSource bs = new BindingSource(); YongHu yh = new YongHu(); DataSet ds = new DataSet(); DataTable dt1 = new DataTable(); DataTable dt2 = new DataTable(); public YongHuForm2() InitializeComponent(); DataGridViewSetting(); DataBinding(); private void DataGridViewSetting() dataGridView1.AutoGenerateColumns = false ; DataGridViewTextBoxColumn bh = new DataGridViewTextBoxColumn(); bh.Width = 90; bh.DataPropertyName = bh; bh.HeaderText = 编号; bh.Name = bh; bh.ReadOnly = true; dataGridView1.Columns.Add(bh); DataGridViewTextBoxColumn xm = new DataGridViewTextBoxColumn(); xm.Width = 90; xm.DataPropertyName = xm; xm.HeaderText = 用户名; xm.Name = xm; dataGridView1.Columns.Add(xm); DataGridViewTextBoxColumn mm = new DataGridViewTextBoxColumn(); mm.Width = 90; mm.DataPropertyName = mm; mm.HeaderText = 密码?; mm.Name = mm; mm.ReadOnly = true; mm.Visible = false; dataGridView1.Columns.Add(mm); DataGridViewTextBoxColumn xb = new DataGridViewTextBoxColumn(); xb.Width = 90; xb.DataPropertyName = xb; xb.HeaderText = 性别; xb.Name = xb; dataGridView1.Columns.Add(xb); DataGridViewTextBoxColumn sfzhm = new DataGridViewTextBoxColumn(); sfzhm.Width = 90; sfzhm.DataPropertyName = sfzhm; sfzhm.HeaderText = 身份证号码?; sfzhm.Name = sfzhm; dataGridView1.Columns.Add(sfzhm); DataGridViewTextBoxColumn jtdz = new DataGridViewTextBoxColumn(); jtdz.Width = 90; jtdz.DataPropertyName = jtdz; jtdz.HeaderText = 家庭地址; jtdz.Name = jtdz; dataGridView1.Columns.Add(jtdz); DataGridViewTextBoxColumn lxdh = new DataGridViewTextBoxColumn(); lxdh.Width = 90; lxdh.DataPropertyName = lxdh; lxdh.HeaderText = 联系电话; lxdh.Name = lxdh; dataGridView1.Columns.Add(lxdh); private void toolStripButton1_Click(object sender, EventArgs e) YongHuBianJiForm form1 = new YongHuBianJiForm(xz, null, dt1); form1.ShowDialog(); DataBinding(); public void DataBinding() DataSet ds = yh.GetData(null); bs.DataSource = ds.Tables0; dt1 = ds.Tables0; dt2 = dt1.Clone(); dt2.Columns.Remove(dt2.Columns2); bindingNavigator1.BindingSource = bs; dataGridView1.DataSource = bs; private void toolStripButton2_Click(object sender, EventArgs e) DataGridViewRow dataRow = dataGridView1.SelectedRows0; YongHuBianJiForm form1 = new YongHuBianJiForm(xg, dataRow, dt1); form1.ShowDialog(); DataBinding(); private void toolStripButton3_Click(object sender, EventArgs e) DialogResult dia = MessageBox.Show(你确定要删除此记录吗, 确认删除, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dia = DialogResult.OK) DataGridViewRow dataRow = dataGridView1.SelectedRows0; yh.Delete(dataRow.Cells0.Value.ToString(); DataBinding(); private void YongHuForm2_Load(object sender, EventArgs e) 代码如下using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1 public partial class YongHuBianJiForm : Form string str; string id; DataTable dt; public YongHuBianJiForm(string str, DataGridViewRow dgvr, DataTable dt) InitializeComponent(); this.str = str; this.dt = dt; if (str = xg) button1.Text = 修T改?; textBox1.Text = dgvr.Cells0.Value.ToString(); textBox2.Text = dgvr.Cells1.Value.ToString(); textBox3.Text = *; textBox4.Text = dgvr.Cells3.Value.ToString(); textBox5.Text = dgvr.Cells4.Value.ToString(); textBox6.Text = dgvr.Cells5.Value.ToString(); textBox7.Text = dgvr.Cells6.Value.ToString(); id = dgvr.Cells0.Value.ToString(); textBox3.ReadOnly = true; textBox1.Enabled = false; if (str = xz) button1.Text = 新?增?; private void button1_Click_1(object sender, EventArgs e) string st = new string7; if (str = xz) st0 = textBox1.Text.Trim(); st1 = textBox2.Text.Trim(); st2 = textBox3.Text.Trim(); st3 = textBox4.Text.Trim(); st4 = textBox5.Text.Trim(); st5 = textBox6.Text.Trim(); st6 = textBox7.Text.Trim(); YongHu yh = new YongHu(); yh.Add(st); this.Close(); if (str = xg) st0 = textBox1.Text.Trim(); st1 = textBox2.Text.Trim(); st2 = textBox3.Text.Trim(); st3 = textBox4.Text.Trim(); st4 = textBox5.Text.Trim(); st5 = textBox6.Text.Trim(); st6 = textBox7.Text.Trim(); YongHu yh = new YongHu(); yh.Updata(st, id); this.Close(); private void button2_Click(object sender, EventArgs e) this.Close(); private void YongHuBianJiForm_Load(object sender, EventArgs e) 登陆代码如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Data.SqlClient;using System.Windows.Forms;namespace WindowsFormsApplication1 class DengLu private DataSet ds = new DataSet(); private DataTable myTable; private DataRow myRow; /private DataColumn myClo; YongHu ys = new YongHu(); public bool YongHuYanZheng(string yh, string mm) ds = ys.GetData(null); myTable = ds.Tables0; for (int i = 0; i myTable.Rows.Count; i+) this.myRow = myTable.Rowsi; if (myRowi+1.ToString().Trim() = yh & myRowi+2.ToString().Trim() = mm) Form1.blCanLogin = true; break; if (Form1.blCanLogin = true) return true; else return false; 用户信息代码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Data.SqlClient;using System.Windows.Forms;namespace WindowsFormsApplication1 public class YongHu DataBaseLink db = new DataBaseLink(); public void Add(String yh) using (SqlConnection con = db.DataLink() if (con.State = ConnectionState.Closed) con.Open(); try string sql = Insert into YongHu(bh,xm,mm,xb,sfzhm,jtdz,lxdh) Values(bh,xm,mm,xb,sfzhm,jtdz,lxdh);/查询语?句?同?学也2可以?参?考?教材?上?的?例y子编写 SqlCommand cmd = new SqlCommand(sql, con); SqlParameter p1 = new SqlParameter(bh, yh 0); SqlParameter p2 = new SqlParameter(xm, yh 1); SqlParameter p3 = new SqlParameter(mm, yh 2); SqlParameter p4 = new SqlParameter(xb, yh3); SqlParameter p5 = new SqlParameter(sfzhm, yh 4); SqlParameter p6 = new SqlParameter(jtdz, yh 5); SqlParameter p7 = new SqlParameter(lxdh, yh 6); cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); cmd.Parameters.Add(p3); cmd.Parameters.Add(p4); cmd.Parameters.Add(p5); cmd.Parameters.Add(p6); cmd.Parameters.Add(p7); cmd.ExecuteNonQuery(); MessageBox.Show(信息添加成功); catch (Exception ex) MessageBox.Show(错误 + ex.Message, 错误提示?, MessageBoxButtons.OKCancel, MessageBoxIcon.Error); finally if (con.State = ConnectionState.Open) con.Close(); con.Dispose(); public DataSet GetData(string yh) DataSet ds = new DataSet(YongHu); if (yh = null) using (SqlConnection con = db.DataLink() if (con.State = ConnectionState.Closed) con.Open(); try string sql = Select * From YongHu; SqlDataAdapter sqlda = new SqlDataAdapter(sql, con); sqlda.Fill(ds); catch (Exception ex) MessageBox.Show(错误 + ex.Message, 错误提示?, MessageBoxButtons.OKCancel, MessageBoxIcon.Error); finally if (con.State = ConnectionState.Open) con.Close(); con.Dispose(); return ds; public void Delete(string id) using (SqlConnection con = db.DataLink() if (con.State = ConnectionState.Closed) con.Open(); try string sql = Delete From YongHu Where bh= + + id + ; SqlCommand comd = new SqlCommand(sql, con); comd.ExecuteNonQuery(); catch (Exception ex) MessageBox.Show(错误 + ex.Message, 错误提示?, MessageBoxButtons.OKCancel, MessageBoxIcon.Error); finally if (con.State = ConnectionState.Open) con.Close(); con.Dispose(); pu

温馨提示

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

评论

0/150

提交评论