private void btnMedieViitor_Click(object sender, EventArgs e) { if (txtNrMatricol.Text != "") { Studenti stud = studentRepository.GetAllStudents().Where(s => s.NrMatricol == Convert.ToInt32(txtNrMatricol.Text)).FirstOrDefault(); if (stud != null) { bool mediaCreste = PreziceriAlgo.PrezicereMedie(stud); if (mediaCreste) { MessageBox.Show("Media pentru studentul cu Nr: " + stud.NrMatricol + " VA CRESTE"); } else { MessageBox.Show("Media pentru studentul cu Nr: " + stud.NrMatricol + " VA SCADEA"); } } else { MessageBox.Show("Nu s-a gasit un student cu nr matricol " + txtNrMatricol.Text); } } else { MessageBox.Show("Selectati un student din lista"); } }
private void btnSalvare_Click(object sender, EventArgs e) { Studenti student = new Studenti(); student.NrMatricol = Convert.ToInt32(txtNrMatricol.Text); student.Nume = txtNume.Text; student.Medie = double.Parse(txtMedia.Text); if (btnSalvare.Text == "Inserare") // insert { studentRepository.InserareStudent(student); } else { studentRepository.ActualizeazaStudent(student); } Clear(); PopulateDataGridView(); MessageBox.Show("Subscris cu succes"); }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { if (dataGridView1.CurrentRow.Index != -1) { selectedStudent = new Studenti() { NrMatricol = Convert.ToInt32(dataGridView1.CurrentRow.Cells["NrMatricol"].Value) }; selectedStudent = studentRepository.GetAllStudents().Where(s => s.NrMatricol == selectedStudent.NrMatricol).FirstOrDefault(); txtNrMatricol.Text = selectedStudent.NrMatricol.ToString(); txtNume.Text = selectedStudent.Nume; txtMedia.Text = selectedStudent.Medie.ToString(); btnSalvare.Text = "Actualizare"; if (DataSource == "SQL") { btnStergere.Enabled = true; } } }
private void btnZiBuna_Click(object sender, EventArgs e) { if (txtNrMatricol.Text != "") { Studenti stud = studentRepository.GetAllStudents().Where(s => s.NrMatricol == Convert.ToInt32(txtNrMatricol.Text)).FirstOrDefault(); if (stud != null) { bool zibuna = PreziceriAlgo.PrezicereTipZi(stud); if (zibuna) { MessageBox.Show("Studentul cu Nr: " + stud.NrMatricol + " VA AVEA O ZI BUNA"); } else { MessageBox.Show("Studentul cu Nr: " + stud.NrMatricol + " NU VA AVEA O ZI BUNA"); } } else { MessageBox.Show("Nu s-a gasit un student cu nr matricol " + txtNrMatricol.Text); } } }