private void timer1_Tick(object sender, EventArgs e) { timer1.Stop(); this.Hide(); LoginFrm sh = new LoginFrm(); sh.Show(); }
private void registerbtn_Click(object sender, EventArgs e) { LoginFrm logfrm = new LoginFrm(); logfrm.Hide(); DBSet ds = new DBSet(); admintxt1.Text = (Convert.ToInt32(ds.StuAllId().Tables["stuaid"].Rows[0][0]) + 1).ToString();//获取查询stuid结果的第一个转为字符 if (check_stu_null()) { int id = Convert.ToInt32(admintxt1.Text); string name = nametxt.Text; string Class = ""; int index = Convert.ToInt32(classtxt.SelectedIndex + 1); if (index == 1) { Class = "软件技术1班"; } if (index == 2) { Class = "软件技术2班"; } if (index == 3) { Class = "软件技术3班"; } if (index == 4) { Class = "软件技术4班"; } int age = Convert.ToInt32(agetxt.Text); string major = ""; int index2 = Convert.ToInt32(majortxt.SelectedIndex + 1); if (index2 == 1) { major = "软件工程"; } string dapartment = ""; int index3 = Convert.ToInt32(departmenttxt.SelectedIndex + 1); if (index3 == 1) { dapartment = "信息工程系"; } string pwd = pwdtxt2.Text; int type = 0; if (teacherrad.Checked == true) { type = 2; } else if (studentrad.Checked == true) { type = 1; } else { type = 0; } string note = notetxt.Text; string isFace = null; int res = ds.AddStudentInfo(name, Class, age, major, dapartment, pwd, type, note, isFace); if (res > 0) { MessageBox.Show("添加成功!"); this.Close(); logfrm.Show(); } else { MessageBox.Show("添加失败!"); } } }