public static DialogResult AddNewStudent() { using (var frm = new FormStudent()) { return(frm.ShowDialog()); } }
public static DialogResult UpdateStudent(long studentId) { using (var frm = new FormStudent()) { frm.SelectedStudent = Common.GetStudent(studentId); return(frm.ShowDialog()); } }
private void btnDodajStudenta_Click(object sender, EventArgs e) { DialogResult dlg = FormStudent.AddNewStudent(); if (dlg == DialogResult.Yes) { LoadStudenti(); MessageBox.Show("Student je uspesno dodat.", "Obavestenje", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnIzmeniStudenta_Click(object sender, EventArgs e) { if (cmbStudenti.SelectedValue == null) { return; } long studentId = (long)cmbStudenti.SelectedValue; DialogResult dlg = FormStudent.UpdateStudent(studentId); if (dlg == DialogResult.Yes) { LoadStudenti(); MessageBox.Show("Student je uspesno azuriran.", "Obavestenje", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbStudenti.SelectedValue = studentId; } }