public void DataBaseChangeGrade(ChangeGradeProcedure grade)
 {
     if (grade.GradeStatus == "o")
     {
         command = new MySqlCommand($"call odrzuc_reklamacje({grade.StudentID}, {grade.GroupID}, {grade.currentUser});", this.conection);
     }
     else if (grade.GradeStatus == "p")
     {
         command = new MySqlCommand($"call popraw_ocene('{grade.NewGrade}' ,{grade.StudentID}, {grade.GroupID}, {grade.currentUser});", this.conection);
     }
     adapter.InsertCommand = command;
     adapter.InsertCommand.ExecuteNonQuery();
     command.Dispose();
 }
Пример #2
0
        private void ChangeGrade()
        {
            string errorMessage = "";

            if (!DataValidation.DataValidation.ValidLecturerGradeStatus(tableRowContentList[5].Text, out errorMessage))
            {
                AlertWindow alertWindow = new AlertWindow(errorMessage);
                alertWindow.ShowDialog();
                return;
            }

            if (tableRowContentList[5].Text == "w")
            {
                AlertWindow alertWindow = new AlertWindow("Student ma już wprowadzoną ocenę. Możesz więc ją zmienić tylko używając statusu 'o' lub 'p'.");
                alertWindow.ShowDialog();
                return;
            }

            if (!DataValidation.DataValidation.ValidGrade(tableRowContentList[4].Text, out errorMessage))
            {
                AlertWindow alertWindow = new AlertWindow(errorMessage);
                alertWindow.ShowDialog();
                return;
            }

            ChangeGradeProcedure grade = new ChangeGradeProcedure();

            grade.StudentID   = int.Parse(tableRowContentList[0].Text);
            grade.GroupID     = int.Parse(tableRowContentList[2].Text);
            grade.NewGrade    = tableRowContentList[4].Text;
            grade.GradeStatus = tableRowContentList[5].Text;
            grade.currentUser = signInUser.UserID;

            DbService.DataBaseChangeGrade(grade);
            AlertWindow alertWindow2 = new AlertWindow("Zmiana oceny przebiegła pomyślnie.");

            alertWindow2.ShowDialog();
            CreateOcenianie();
        }