我的位置: 首页 > 就业 > 学员作品 > 学生信息管理系统

学生信息管理系统

2013-03-05 11:42:07
来源:
[导读] 项目精心策划和团队协作,使本项目得以顺利完成。

作品展示及说明:

1. 登录页面

2.点击右上角退出效果

3.教务角色登录后的主界面

4.查看所有课程

5. 修改密码窗口

代码展示:
一、教师模块部分事件

/// <summary>
        /// 点Ì?击¡Â查¨¦看¡ä学¡ì生¦¨²成¨¦绩¡§事º?件t
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblViewStudentAchievement_Click(object sender, EventArgs e)
        {
            SDKForm5 s = new SDKForm5();
            s.Show();
        }
        /// <summary>
        /// 点Ì?击¡Â查¨¦看¡ä授º¨²课?班㨤级?事º?件t
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblCheckTaughtClasses_Click(object sender, EventArgs e)
        {
            //清?空?当Ì¡À前¡ãpan中D的Ì?所¨´有®D控?件t
            this.panclss.Controls.Clear();
            //创ä¡ä建¡§想?显?示º?的Ì?窗ä¡ã体¬?对?象¨®
            SDKForm4 showform = new SDKForm4();
            //设¦¨¨置?当Ì¡À前¡ã窗ä¡ã体¬?对?象¨®不?是º?顶£¤级?窗ä¡ã体¬?
            showform.TopLevel = false;
            //设¦¨¨置?当Ì¡À前¡ã显?示º?窗ä¡ã体¬?和¨ª父?窗ä¡ã体¬?一°?起e调Ì¡Â整?大䨮小?
            showform.Dock = System.Windows.Forms.DockStyle.Fill;
            //设¦¨¨置?当Ì¡À前¡ã显?示º?窗ä¡ã体¬?的Ì?边À?框¨°样¨´式º?
            showform.FormBorderStyle = FormBorderStyle.None;
            //指?定¡§当Ì¡À前¡ã显?示º?窗ä¡ã体¬?的Ì?父?窗ä¡ã体¬?是º?谁-
            showform.Parent = this.panclss;
            //将?当Ì¡À前¡ã窗ä¡ã体¬?加¨®载?到Ì?pan容¨Y器¡Â中D
            panclss.Controls.Add(showform);
            //显?示º?当Ì¡À前¡ã窗ä¡ã体¬?中D内¨²容¨Y
            showform.Show();
        }
        /// <summary>
        /// 点Ì?击¡Â修T改?密¨¹码?事º?件t
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdateTeacherPassword_Click(object sender, EventArgs e)
        {
            //清?空?当Ì¡À前¡ãpan中D的Ì?所¨´有®D控?件t
            this.panel.Controls.Clear();
            //创ä¡ä建¡§想?显?示º?的Ì?窗ä¡ã体¬?对?象¨®
            SDKForm2 showform = new SDKForm2();
            //设¦¨¨置?当Ì¡À前¡ã窗ä¡ã体¬?对?象¨®不?是º?顶£¤级?窗ä¡ã体¬?
            showform.TopLevel = false;
            //设¦¨¨置?当Ì¡À前¡ã显?示º?窗ä¡ã体¬?和¨ª父?窗ä¡ã体¬?一°?起e调Ì¡Â整?大䨮小?
            showform.Dock = System.Windows.Forms.DockStyle.Fill;
            //设¦¨¨置?当Ì¡À前¡ã显?示º?窗ä¡ã体¬?的Ì?边À?框¨°样¨´式º?
            showform.FormBorderStyle = FormBorderStyle.None;
            //指?定¡§当Ì¡À前¡ã显?示º?窗ä¡ã体¬?的Ì?父?窗ä¡ã体¬?是º?谁-
            showform.Parent = this.panel;
            //将?当Ì¡À前¡ã窗ä¡ã体¬?加¨®载?到Ì?pan容¨Y器¡Â中D
            panel.Controls.Add(showform);
            //显?示º?当Ì¡À前¡ã窗ä¡ã体¬?中D内¨²容¨Y
            showform.Show();
        }
        /// <summary>
        /// 点Ì?击¡Â查¨¦看¡ä个?人¨?信?息¡é事º?件t
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdateTeacherInfo_Click(object sender, EventArgs e)
        {
            //清?空?当Ì¡À前¡ãpan中D的Ì?所¨´有®D控?件t
            this.panel.Controls.Clear();
            //创ä¡ä建¡§想?显?示º?的Ì?窗ä¡ã体¬?对?象¨®
            SDKForm3 showform = new SDKForm3();
            //设¦¨¨置?当Ì¡À前¡ã窗ä¡ã体¬?对?象¨®不?是º?顶£¤级?窗ä¡ã体¬?
            showform.TopLevel = false;
            //设¦¨¨置?当Ì¡À前¡ã显?示º?窗ä¡ã体¬?和¨ª父?窗ä¡ã体¬?一°?起e调Ì¡Â整?大䨮小?
            showform.Dock = System.Windows.Forms.DockStyle.Fill;
            //设¦¨¨置?当Ì¡À前¡ã显?示º?窗ä¡ã体¬?的Ì?边À?框¨°样¨´式º?
            showform.FormBorderStyle = FormBorderStyle.None;
            //指?定¡§当Ì¡À前¡ã显?示º?窗ä¡ã体¬?的Ì?父?窗ä¡ã体¬?是º?谁-
            showform.Parent = this.panel;
            //将?当Ì¡À前¡ã窗ä¡ã体¬?加¨®载?到Ì?pan容¨Y器¡Â中D
            panel.Controls.Add(showform);
            //显?示º?当Ì¡À前¡ã窗ä¡ã体¬?中D内¨²容¨Y
            showform.Show();
        }

二、登录页面部分代码

  public MainForm()         {
            InitializeComponent();
            //使º1圆2角?缺¨¡À口¨²变À?透ª?明¡Â
            this.TransparencyKey = this.BackColor;
            //获?取¨?当Ì¡À前¡ã时º¡À间?
            this.lblTime.Text = System.DateTime.Now.ToString("yyyy-MM-dd");
        }
 
        /// <summary>
        /// 点Ì?击¡Â登Ì?陆?事º?件t
        /// </summary>
        public void UserLogin()
        {
            //将?登Ì?录?帐¨º号?保À¡ê存ä?,ê?以°?便À?其?他?窗ä¡ã体¬?使º1用®?
            ConText.Name = this.txtNum.Text.Trim().ToString();
            string pwd = this.txtPwd.Text.ToString();
            ConText.Sf1 = this.cmbType.Text.Trim().ToString();
            string sql = null;
            //判D断?账?号?密¨¹码?是º?否¤?为a空?
            if (ConText.Name == string.Empty || pwd.Trim() == string.Empty)
            {
                MessageBox.Show("账?号?密¨¹码?不?能¨¹为a空?!ê?!ê?!ê?");
            }
            else
            {
                //根¨´据Y登Ì?录?不?同ª?角?色¦?拼¡ä接¨®不?同ª?的Ì?sql查¨¦询¡¥语®?句?
                if (ConText.Sf1.Equals("学¡ì生¦¨²"))
                {
                    sql = string.Format("select COUNT(*)  from Students where Name='{0}' and Studentspwd='{1}'", ConText.Name, pwd);
                }
                else if (ConText.Sf1.Equals("教¨¬师º|"))
                {
                    sql = string.Format("select COUNT(*) from Teachers where TeacherName='{0}' and Teacherspwd='{1}' ", ConText.Name, pwd);
                }
 
                else if (ConText.Sf1.Equals("教¨¬务?员¡À"))
                {
                    sql = string.Format("select  COUNT(*)  from Examination1 where Name='{0}' and pwd='{1}' ", ConText.Name, pwd);
                }
                SqlCommand com = new SqlCommand(sql, DBHelp.Connection);
                DBHelp.OpenConnection();
                int i = (int)com.ExecuteScalar();
                if (i > 0)
                {
                    if (ConText.Sf1.Equals("学¡ì生¦¨²"))
                    {
                        Menu2 s = new Menu2();
                        this.Hide();
                        s.Show();
 
                    }
                    else if (ConText.Sf1.Equals("教¨¬师º|"))
                    {
                        SDKForm1 s = new SDKForm1();
                        this.Hide();
                        s.Show();
 
                    }
                    else if (ConText.Sf1.Equals("教¨¬务?员¡À"))
                    {
                        Studentinfo s = new Studentinfo();
                        this.Hide();
                        s.Show();
                    }
 
                }
                else
                {
                    MessageBox.Show("账?号?,ê?密¨¹码?错䨪误¨®!ê?");
                }
            }
            DBHelp.CloseConnection();
        }
        /// <summary>
        /// 点Ì?击¡Â关?闭À?事º?件t
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblClose_Click(object sender, EventArgs e)
        {
            quit qui = new quit();
            qui.Show();
 
        }
        /// <summary>
        /// 点Ì?击¡Â登Ì?陆?事º?件t
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUserLogin_Click(object sender, EventArgs e)
        {
            UserLogin();
        }
 
        //鼠º¨®标À¨º移°?动¡¥到Ì?X上¦?的Ì?动¡¥作Á¡Â
        private void lblClose_MouseMove(object sender, MouseEventArgs e)
        {
            lblClose.ForeColor = Color.Black;
        }
 
        private void lblClose_MouseLeave(object sender, EventArgs e)
        {
            lblClose.ForeColor = Color.DarkOrange;
        }
 
 
        /// <summary>
        /// "清?空?"按ã¡ä钮£¤
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnClear_Click(object sender, EventArgs e)
        {
            txtNum.Clear();
            txtPwd.Clear();
            cmbType.SelectedIndex = 0;
        }
 
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.cmbType.SelectedIndex = 0;
        }

三、修改密码事件

/// <summary>         /// 点Ì?击¡Â修T改?密¨¹码?事º?件t
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdatePwd_Click(object sender, EventArgs e)
        {
            string passwordOne = this.txtPasswordOne.Text.Trim();//获?得Ì?窗ä¡ã体¬?中D输º?入¨?的Ì?密¨¹码?
            string passwordTwo = this.txtPasswordTwo.Text.Trim();//获?得Ì?窗ä¡ã体¬?中D输º?入¨?的Ì?确¨¡¤认¨?密¨¹码?
            //判D断?两¢?次ä?新?密¨¹码?是º?否¤?为a空?
            if (passwordOne == string.Empty || passwordTwo == string.Empty)
            {
                MessageBox.Show("密¨¹码?不?能¨¹为a空?!ê?", "友®?情¨¦提¬¨¢示º?!!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            //判D断?两¢?次ä?新?密¨¹码?是º?否¤?相¨¤等̨¨
            else if (passwordOne != passwordTwo)
            {
                MessageBox.Show("输º?入¨?的Ì?密¨¹码?不?一°?致?!ê?", "友®?情¨¦提¬¨¢示º?!!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                string sql = string.Format("update Examination1 set pwd = '{0}' where Name = '{1}'", passwordOne, ConText.Name);
                try
                {
                    SqlCommand com = new SqlCommand(sql, DBHelp.Connection);//创ä¡ä建¡§Command对?象¨®
                    DBHelp.OpenConnection();//调Ì¡Â用®?DBHelp类¤¨¤中D打䨰开a数ºy据Y库a连¢?接¨®
                    int i = com.ExecuteNonQuery();//执¡ä行Dsql语®?句?,ê?并¡é得Ì?到Ì?返¤¦Ì回?结¨¢果?
                    if (i > 0)
                    {
                        MessageBox.Show("修T改?成¨¦功|!ê?");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("系¦Ì统ª3内¨²部?错䨪误¨®,ê?请?联¢a系¦Ì管¨¹理¤¨ª员¡À!", "友®?情¨¦提¬¨¢示º?!!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                finally
                {
                    DBHelp.CloseConnection();
                }
            }
        }



大家都关注: 学生 系统
评论
热点专题
>>