private void changeClassTeacherButton_Click(object sender, System.EventArgs e) { string Name = classNamesComboBox.selectedValue.ToString(); string newClassTeacher = newClassTeacherComboBox.selectedValue.ToString(); OleDbCommand cmd = new OleDbCommand($"UPDATE Classes SET Teacher = '{newClassTeacher}' WHERE ClassNames='{Name}'"); cmd.Connection = connection; connection.Open(); try { cmd.ExecuteNonQuery(); connection.Close(); Application.Restart(); } catch (OleDbException ex) { //MessageBox.Show(ex.Source); Point p1 = new Point(); p1.X = -205; p1.Y = 480; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("Не са изтрити данни! Пишете на [email protected]!", notificationForm.AlertType.fail, scrPos, 497); childForm.Show(); connection.Close(); } }
private void okButton_Click(object sender, System.EventArgs e) { getChosenTeacher(); dDirectorNameLabel.Text = teacherChosen.Names; dDirectorSpecialLabel.Text = teacherChosen.Special; dDirectorSubjectLabel.Text = "Учител по: " + teacherChosen.Subject; dDirectorConsultationLabel.Text = "Има консултации в: " + teacherChosen.Consultation; if (teacherChosen.Sip == "") { dDirectorSipLabel.Text = "Няма въведен СИП"; } else { dDirectorSipLabel.Text = "Има СИП в: " + teacherChosen.Sip; } string[] lines = System.IO.File.ReadAllLines(@"Resources\\NewProgramsTeachersFilePath.txt"); try { programPath = lines[0]; } catch (IndexOutOfRangeException ex) { programPath = ""; } if (teacherChosen.Page == 0) { Point p1 = new Point(); p1.X = -205; p1.Y = 480; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("Учителят няма програма!", notificationForm.AlertType.fail, scrPos, 257); childForm.Show(); } else { if (programPath != "") { dDirectorProgramWebBrowser.Navigate($@"{programPath}#page={teacherChosen.Page}"); // gets the path to the new file } else { string currentDirectory = System.IO.Directory.GetCurrentDirectory(); // gets the current directory. Nessesary due to installer dDirectorProgramWebBrowser.Refresh(); dDirectorProgramWebBrowser.Navigate(currentDirectory + "\\" + $"Teachers\\p{teacherChosen.Page}.pdf"); } } showLabels(); }
private void ConsultationChangesUC_Load(object sender, System.EventArgs e) { Allteachers = MainForm.Allteachers; teacherNamesComboBox.Items = Allteachers.Names.ToArray(); oldConsultationsTB.Enabled = false; teacherNamesComboBox.selectedIndex = 0; Point p1 = new Point(); p1.X = -205; p1.Y = 480; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("При всяка една промяна приложението ще се рестартира!", notificationForm.AlertType.fail, scrPos, 536); childForm.Show(); }
private void elBellButton_Click(object sender, EventArgs e) { contentsPanel.Controls.Add(ElBellUC.Instance); ElBellUC.Instance.Dock = DockStyle.Fill; ElBellUC.Instance.BringToFront(); if (SerialPort.GetPortNames().Length == 0) { Point p1 = new Point(); p1.X = 15; p1.Y = 545; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("Няма включен електронен звънец!", notificationForm.AlertType.noElBells, scrPos, 324); childForm.Show(); } }
private void TeacherChangesUC_Load(object sender, System.EventArgs e) { teachersComboBox.Items = getListOfSubjects().ToArray(); teachersComboBox.selectedIndex = 0; teacherNamesComboBox.Items = getListOfTeachers().ToArray(); teacherNamesComboBox.selectedIndex = 0; Point p1 = new Point(); p1.X = -205; p1.Y = 480; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("При всяка една промяна приложението ще се рестартира!", notificationForm.AlertType.fail, scrPos, 536); childForm.Show(); }
private void addTeacherButton_Click(object sender, System.EventArgs e) { if (nameTextBox.Text != "" && consultationTextBox.Text != "") { subjectID = teachersComboBox.selectedIndex + 2; string Name = nameTextBox.Text; string Subject = teachersComboBox.selectedValue.ToString(); string Special = specialTextBox.Text; string Subject_ID = subjectID.ToString(); string Consultation = consultationTextBox.Text; OleDbCommand cmd = new OleDbCommand("INSERT into Teachers (Name, Subject_ID, Special, Consultation) Values(@Name, @Subject_ID, @Special, @Consultation)"); cmd.Connection = connection; connection.Open(); cmd.Parameters.Add("@Name", OleDbType.VarChar).Value = Name; cmd.Parameters.Add("@Subject_ID", OleDbType.VarChar).Value = Subject_ID; cmd.Parameters.Add("@Special", OleDbType.VarChar).Value = Special; cmd.Parameters.Add("@Consultation", OleDbType.VarChar).Value = Consultation; try { cmd.ExecuteNonQuery(); connection.Close(); Application.Restart(); } catch (OleDbException ex) { //MessageBox.Show(ex.Source); Point p1 = new Point(); p1.X = -205; p1.Y = 480; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("Не са добавени данни! Пишете на [email protected]!", notificationForm.AlertType.fail, scrPos, 497); childForm.Show(); connection.Close(); } } else { Point p1 = new Point(); p1.X = -205; p1.Y = 480; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("Името и консултацията са задължителни!", notificationForm.AlertType.fail, scrPos, 380); childForm.Show(); } }
private void onButton_Click(object sender, System.EventArgs e) { if (comPortsComboBox.selectedIndex >= 0) { offButton.Enabled = true; onButton.Enabled = false; elBellMessageLabel.MaximumSize = new Size(320, 0); elBellMessageLabel.Text = $"Електронният звънец е включен на порт {comPortsComboBox.selectedValue}"; // sets name of port } else { Point p1 = new Point(); p1.X = -205; p1.Y = 480; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("Няма включен електронен звънец!", notificationForm.AlertType.noElBells, scrPos, 324); childForm.Show(); } }
private void changeConsultationButton_Click(object sender, System.EventArgs e) { if (newConsultationsTB.Text != "") { string Name = teacherNamesComboBox.selectedValue.ToString(); string Consultation = newConsultationsTB.Text; OleDbCommand cmd = new OleDbCommand($"UPDATE Teachers SET Consultation = '{Consultation}' WHERE Name='{Name}'"); cmd.Connection = connection; connection.Open(); try { cmd.ExecuteNonQuery(); connection.Close(); Application.Restart(); } catch (OleDbException ex) { //MessageBox.Show(ex.Source); Point p1 = new Point(); p1.X = -205; p1.Y = 480; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("Не са изтрити данни! Пишете на [email protected]!", notificationForm.AlertType.fail, scrPos, 497); childForm.Show(); connection.Close(); } } else { Point p1 = new Point(); p1.X = -205; p1.Y = 480; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("Полето не може да е празно!", notificationForm.AlertType.fail, scrPos, 289); childForm.Show(); } }
private void removeTeacherButton_Click(object sender, System.EventArgs e) { OleDbCommand cmd = new OleDbCommand($"Delete from Teachers where name='{teacherNamesComboBox.selectedValue}'"); cmd.Connection = connection; connection.Open(); try { cmd.ExecuteNonQuery(); connection.Close(); Application.Restart(); } catch (OleDbException ex) { Point p1 = new Point(); p1.X = -205; p1.Y = 480; Point scrPos = this.PointToScreen(p1); notificationForm childForm = new notificationForm("Не са изтрити данни! Пишете на [email protected]!", notificationForm.AlertType.fail, scrPos, 497); childForm.Show(); connection.Close(); } }