示例#1
0
 private void TextBoxStudentNumber_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (textBoxStudentNumber.Text != "")
     {
         if (GradesDB.ValidStudentNumber(Convert.ToInt32(textBoxStudentNumber.Text)))
         {
             comboBoxAY.IsEnabled = true;
             SQLiteConnection SQLConnection    = Database.CreateConnection();
             SQLiteCommand    SQLCMD           = SQLConnection.CreateCommand();
             string           SQLCommandString = "SELECT DISTINCT Academic_Year FROM Grades_Table WHERE Student_Number = '" + textBoxStudentNumber.Text + "'";
             SQLCMD.CommandText = SQLCommandString;
             SQLCMD.ExecuteNonQuery();
             SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(SQLCMD);
             dataAdapter = new SQLiteDataAdapter(SQLCMD);
             DataTable data = new DataTable();
             dataAdapter.Fill(data);
             for (int i = 0; i < data.Rows.Count; i++)
             {
                 comboBoxAY.Items.Add(data.Rows[i][0].ToString());
             }
             textBoxStudentNumber.IsEnabled         = false;
             textBoxStudentNumberBorder.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x19, 0x19, 0xFA));
             comboBoxAYBorder.BorderBrush           = new SolidColorBrush(Color.FromArgb(0xFF, 0xFA, 0x19, 0x19));
             SQLConnection.Close();
         }
     }
 }
        // POST: api/Instituicoes
        public IHttpActionResult Post([FromBody] Grades grades)
        {
            Indentificacao credenciais = autenticar.autenticacao(Request, 3);

            if (credenciais == null)
            {
                return(Content(HttpStatusCode.Unauthorized, "Credenciais Invalidas ou Ausentes!"));
            }

            Grades gra = new Grades();

            gra.Gra_nome = grades.Gra_nome;
            gra.Ins_codigo.Ins_codigo = Convert.ToInt32(credenciais.Ins_codigo);

            int retorno = GradesDB.Insert(gra);

            if (retorno == -2)
            {
                return(BadRequest());
            }
            else
            {
                return(Ok(retorno));
            }
        }
示例#3
0
        private void buttonDeleteGrades_Click(object sender, RoutedEventArgs e)
        {
            DataRowView dataRow = (DataRowView)dataGridUserList.SelectedItem;

            GradesDB.DeleteGrade(Convert.ToInt32(dataRow.Row.ItemArray[0]));
            UserListReload();
            GradesListReload();
        }
示例#4
0
 private void ButtonCheck_Click(object sender, RoutedEventArgs e)
 {
     if (comboBoxAY.SelectedIndex != 0 &&
         comboBoxQuarter.SelectedIndex != 0 &&
         textBoxCourseCode.Text != "" &&
         textBoxStudentNumber.Text != "" &&
         Convert.ToInt32(textBoxStudentNumber.Text) > 0 &&
         textBoxStudentFirstName.Text != "" &&
         textBoxStudentLastName.Text != "" &&
         textBoxGrade.Text != "" &&
         Convert.ToDecimal(textBoxGrade.Text) >= 0 &&
         Convert.ToDecimal(textBoxGrade.Text) <= 100)
     {
         GradesDB.AddNewItem(comboBoxAY.SelectedValue.ToString(), comboBoxQuarter.SelectedValue.ToString(), textBoxCourseCode.Text, Convert.ToInt32(textBoxStudentNumber.Text), textBoxStudentFirstName.Text, textBoxStudentLastName.Text, decimal.Round(Convert.ToDecimal(textBoxGrade.Text), 2, MidpointRounding.AwayFromZero));
         this.Close();
     }
 }
示例#5
0
 private void ButtonSeaarch_Click(object sender, RoutedEventArgs e)
 {
     labelGrades.Content = GradesDB.getGrade(Convert.ToInt32(textBoxStudentNumber.Text), comboBoxAY.Items[comboBoxAY.SelectedIndex].ToString(), comboBoxQuarter.Items[comboBoxQuarter.SelectedIndex].ToString(), comboBoxCourseCode.Items[comboBoxCourseCode.SelectedIndex].ToString());
 }