public void DataBaseAddGrade(AddGradeProcedure grade)
 {
     command = new MySqlCommand($"call wprowadz_ocene('{grade.NewGrade}', {grade.StudentID}, {grade.GroupID}, {grade.currentUser});", this.conection);
     adapter.InsertCommand = command;
     adapter.InsertCommand.ExecuteNonQuery();
     command.Dispose();
 }
Пример #2
0
        private void AddGrade()
        {
            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 nie ma jeszcze oceny. Możesz więc ją wprowadzić tylko używając statusu 'w'.");
                alertWindow.ShowDialog();
                return;
            }

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

            AddGradeProcedure grade = new AddGradeProcedure();

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

            DbService.DataBaseAddGrade(grade);
            AlertWindow alertWindow2 = new AlertWindow("Wprowadzenie oceny przebiegło pomyślnie.");

            alertWindow2.ShowDialog();
            CreateOcenianie();
        }