private void OpenForm(string sql, string type) { SqlDataReader sqlData = YRHelper.GetDataReader(sql); if (sqlData.HasRows) { switch (type) { case "student": FrmStudent stu = new FrmStudent(txtAccount.Text); stu.Show(); this.Hide(); break; case "teacher": FrmTeacher tea = new FrmTeacher(txtAccount.Text); tea.Show(); this.Hide(); break; case "admin": FrmAdmin admin = new FrmAdmin(txtAccount.Text); admin.Show(); this.Hide(); break; } } else { MessageBox.Show("登录失败,请检查账号或密码!"); } sqlData.Close(); }
public void TimerCallName_Tick(object sender, EventArgs e) { FrmStudent StuName = new FrmStudent(); Random ra = new Random(); int i = ra.Next(StuName.stuList.Count); StuName.lblName.Text = StuName.stuList[i].Name; }
public void TestMethod1() { FrmStudent frm = new FrmStudent(); object sender = null; EventArgs e = null; frm.btnshow_Click(sender, e); frm.btnopenfile_Click(null, null); }
private void btnAdd_Click(object sender, EventArgs e) { if (!LoggedInUser.IsAdmin) { Base.ShowError("Access Denied", "You do not have the required permission"); return; } var studentForm = new FrmStudent(); studentForm.ShowDialog(); LoadData(); }
private void 学生档案查询ToolStripMenuItem_Click(object sender, EventArgs e) { if (FrmStu == null || FrmStu.IsDisposed) { FrmStu = new FrmStudent(); } Size OldSize = FrmStu.Size; this.Size = new Size(OldSize.Width + 20, OldSize.Height + 70); FrmStu.MdiParent = this; FrmStu.Location = new Point(0, 0);; FrmStu.Show(); }
private void AddStu() { try { FrmStudent frmSt = new FrmStudent(); frmSt.ShowDialog(); LoadListToGrid(); } catch (Exception ex) { Logger.LogException(ex); } }
private void btmLogin_Click(object sender, EventArgs e) { string sql = string.Format("select * from tbluser where username='******' and userpwd='{1}'", txtName.Text, txtPwd.Text); DataSet ds = Common.QuerySql(sql); if (ds.Tables[0].Rows.Count > 0) { FrmStudent f = new FrmStudent(); f.Show(); this.Hide(); } else { MessageBox.Show("账号或密码错误"); } }
private void button1_Click(object sender, EventArgs e) { string id, pwd; id = textBox1.Text; pwd = textBox1.Text; if (id == "123") { FrmStudent f = new FrmStudent(); f.Show(); } else { MessageBox.Show("账号或密码错误"); } }
void UpdateStu() { try { if (grdVwStudents.SelectedRows.Count < 1) { MessageBox.Show("Please Select a row."); return; } string strId = string.Format("{0}", grdVwStudents.SelectedRows[0].Cells[0].Value); int id; if (int.TryParse(strId, out id)) { FrmStudent frmSt = new FrmStudent(id); frmSt.ShowDialog(); } LoadListToGrid(); } catch (Exception ex) { Logger.LogException(ex); } }
public void btnshow_ClickTest() { FrmStudent frm = new FrmStudent(); frm.btnshow_Click(null, null); }
public void TestMethod1() { FrmStudent frmstudent = new FrmStudent(); frmstudent.AbsentTems(); }
private void button1_Click(object sender, EventArgs e) { FrmStudent frm = new FrmStudent(); frm.Show(); }
private void dataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { // var d = (DataGridView)sender; // var df = d.SelectedCells[0].Value.ToString(); // if(df == "Edit") (df == "Delete") if (!LoggedInUser.IsAdmin) { Base.ShowError("Access Denied", "You do not have the required permission"); return; } //edit column if (e.ColumnIndex == 0) { var id = dataGrid.Rows[e.RowIndex].Cells["id"].Value.ToString(); var item = _repo.GetStudent(id); if (item != null) { var updateForm = new FrmStudent(item.Id); updateForm.ShowDialog(); LoadData(); } } //delete column if (e.ColumnIndex == 1) { var result = Base.ShowDialog(MessageBoxButtons.YesNo, "Confirm Delete", "Are you sure you want to delete this record?"); if (result == DialogResult.Yes) { var id = dataGrid.Rows[e.RowIndex].Cells["id"].Value.ToString(); var response = _repo.DeleteStudent(id); if (response == string.Empty) { Base.ShowInfo("Success", "Student deleted successfully"); LoadData(); } else { Base.ShowError("Failed", response); } } } //enroll fingerprint column if (e.ColumnIndex == 2) { var id = dataGrid.Rows[e.RowIndex].Cells["id"].Value.ToString(); var enrollForm = new FrmEnrollFinger(id); enrollForm.ShowDialog(); } } catch (Exception ex) { Base.ShowError("Error occured", ex.Message); } }