Beispiel #1
0
 private void tsmDlt_Click(object sender, EventArgs e)
 {
     if (!this.dataGridView1.Rows[index].IsNewRow)
     {
         string  selestr1   = "select username from DT_USER where usernum ='" + this.dataGridView1.CurrentCell.Value + "'";
         string  deletestr1 = "delete from DT_USER where usernum ='" + this.dataGridView1.CurrentCell.Value + "'";
         string  deletestr2 = "delete from DT_students where stunum ='" + this.dataGridView1.CurrentCell.Value + "'";
         SqlHelp sqlHelper  = new SqlHelp();
         string  name       = sqlHelper.GetDataReaderValue(selestr1);
         if (sqlHelper.ExecuteNonQueryCount(deletestr1) > 0 && sqlHelper.ExecuteNonQueryCount(deletestr2) > 0)
         {
             this.dataGridView1.Rows.RemoveAt(index);
             right(name);
         }
     }
 }
Beispiel #2
0
        public admainManage()
        {
            InitializeComponent();
            skinEngine1.SkinFile    = "mdc_summer.ssk";
            skinEngine1.SkinDialogs = false;
            lbuserName.Text         = Login.Username;
            string  seleSt    = "select state from DT_students where name = '" + lbuserName.Text + "'";
            string  seleSex   = "select sex from DT_students where name = '" + lbuserName.Text + "'";
            string  seleDob   = "select birthday from DT_students where name = '" + lbuserName.Text + "'";
            string  seleNp    = "select [native place] from DT_students where name = '" + lbuserName.Text + "'";
            SqlHelp sqlHelper = new SqlHelp();

            lbState.Text = sqlHelper.GetDataReaderValue(seleSt);
            lbSex.Text   = sqlHelper.GetDataReaderValue(seleSex);
            lbDob.Text   = sqlHelper.GetDataReaderValue(seleDob);
            lbNp.Text    = sqlHelper.GetDataReaderValue(seleNp);
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string username = this.textBox1.Text.Trim();
            string password = this.textBox2.Text.Trim();

            if (username.Equals("") || password.Equals(""))
            {
                wrong2();
            }
            else
            {
                string  selesql   = "select * from DT_USER where username='******' and userpass='******'";
                string  seleLm    = "select limits from DT_USER where username='******'";
                SqlHelp sqlHelper = new SqlHelp();
                int     count     = sqlHelper.SqlServerRecordCount(selesql);
                if (count > 0)
                {
                    Username = textBox1.Text;
                    right();
                    Hide();
                    string limits = sqlHelper.GetDataReaderValue(seleLm);
                    if (limits == "毕业生")
                    {
                        graduateLog();
                        graduated a = new TryDBMS.graduated();
                        a.ShowDialog();
                    }
                    else if (limits == "管理员")
                    {
                        admainLog();
                        admainpage a = new TryDBMS.admainpage();
                        a.ShowDialog();
                    }
                    else
                    {
                        workclassLog();
                        WorkPage a = new TryDBMS.WorkPage();
                        a.ShowDialog();
                    }
                }
                else
                {
                    wrong1();
                }
            }
        }
Beispiel #4
0
        private void btOk_Click(object sender, EventArgs e)
        {
            string  userSex     = "";
            string  dateofbirth = tbDobn.Text + "/" + tbDobm.Text + "/" + tbDobd.Text;
            string  findCl      = "select yxnum from dt_yx where yxname ='" + cbCg.Text + "'";
            string  findMj      = "select zynum from dt_zy where zyname ='" + cbMj.Text + "'";
            SqlHelp sqlHelper   = new SqlHelp();

            if (rbFemale.Checked)
            {
                userSex = "女";
            }
            else
            {
                userSex = "男";
            }
            string updt = "update DT_students set sex = '" + userSex + "', yxnum ='" + sqlHelper.GetDataReaderValue(findCl) + "', zynum ='" + sqlHelper.GetDataReaderValue(findMj) + "', birthday ='" + dateofbirth + "', [native place] ='" + tbNp.Text + "' where name ='" + lbUnm.Text + "'";

            if (cbCg.Text == "" || tbDobd.Text == "" || tbDobm.Text == "" || tbDobn.Text == "" || cbMj.Text == "" || tbNp.Text == "")
            {
                wrong1();
            }
            else
            {
                if (sqlHelper.ExecuteNonQueryCount(updt) > 0)
                {
                    right();
                }
                else
                {
                    wrong2();
                }
            }
            Hide();
            graduated a = new graduated();

            a.ShowDialog();
        }
Beispiel #5
0
        public graduated()
        {
            InitializeComponent();
            skinEngine1.SkinFile    = "mdc_summer.ssk";
            skinEngine1.SkinDialogs = false;
            lbuserName.Text         = Login.Username;
            string  seleSt    = "select state from DT_students where name = '" + lbuserName.Text + "'";
            string  seleSex   = "select sex from DT_students where name = '" + lbuserName.Text + "'";
            string  seleNum   = "select stunum from DT_students where name = '" + lbuserName.Text + "'";
            string  seleDob   = "select birthday from DT_students where name = '" + lbuserName.Text + "'";
            string  seleNp    = "select [native place] from DT_students where name = '" + lbuserName.Text + "'";
            string  seleCg    = "select yxname from DT_YX where yxnum in (select yxnum from DT_students where name ='" + lbuserName.Text + "')";
            string  seleMj    = "select zyname from DT_ZY where zynum in (select zynum from DT_students where name ='" + lbuserName.Text + "')";
            SqlHelp sqlHelper = new SqlHelp();

            lbState.Text   = sqlHelper.GetDataReaderValue(seleSt);
            lbSex.Text     = sqlHelper.GetDataReaderValue(seleSex);
            lbNum.Text     = sqlHelper.GetDataReaderValue(seleNum);
            lbDob.Text     = sqlHelper.GetDataReaderValue(seleDob);
            lbNp.Text      = sqlHelper.GetDataReaderValue(seleNp);
            lbCollege.Text = sqlHelper.GetDataReaderValue(seleCg);
            lbMajor.Text   = sqlHelper.GetDataReaderValue(seleMj);
        }