void delStudent() { // Prompt the user before deleting student. delConf = new msgbox("Are you sure you want to delete " + students[currentView, 1] + " " + students[currentView, 2] + "?", "Delete", 2); delConf.ShowDialog(); if (delConf.DialogResult == DialogResult.Yes) { // Log the deletion of the student. File.AppendAllText(Path.Combine(specificFolder, "log.fbla"), "[D]\\" + rformLogin.users[currentUser, 0].Substring(0, rformLogin.users[currentUser, 0].Length - 1) + '\\' + "student\\" + students[currentView, 1] + " " + students[currentView, 2] + '\\' + DateTime.Now.ToShortDateString() + '\\' + DateTime.Now.ToShortTimeString() + "\r\n"); // String used to find the student inside the student file. string _contains = students[currentView, 1] + '\\' + students[currentView, 2] + '\\' + students[currentView, 3] + '\\'; // Delete the line that contains _contains in the given source. delete(_contains, specificFolder + "/data/students.fbla", false); // Reset the students array and treeview. readToArray(specificFolder + "/data/students.fbla", students, "NA"); refreshStudentTree(""); } }
private void btnClear_Click(object sender, EventArgs e) { _conf = new msgbox("Are you sure you want to clear all data?", "Erase Data?", 2); _conf.ShowDialog(); if (_conf.DialogResult == DialogResult.Yes) { clearNewStudent(); } }
private void clearToolStripMenuItem_Click(object sender, EventArgs e) { if (logClearConf.ShowDialog() == DialogResult.Yes) { File.Delete(Path.Combine(specificFolder, "log.fbla")); File.Create(Path.Combine(specificFolder, "log.fbla")).Dispose(); log.Clear(); msgbox msg = new msgbox("Successfully cleared the log.", "Success", 1); msg.Show(); listLog.Items.Clear(); } }
private void formMain_FormClosing(object sender, FormClosingEventArgs e) { if (!logout && exit) { if (logConf.ShowDialog() == DialogResult.Yes) { exit = false; Application.Exit(); } else { e.Cancel = true; } } }
void newStudent() { _conf = new msgbox("Creating a new user will erase any filled in data.", "Erase Data?", 2); if (!firstNew) { _conf.ShowDialog(); } if (_conf.DialogResult == DialogResult.Yes || firstNew) { editing = false; firstNew = false; clearNewStudent(); if (!txtNewFirst.Enabled) { enableNewStudent(true); // Generate next member number in the chain (Probably temporary). nmNewMemNum.Value = Convert.ToDecimal(studentLength + 1); } } }