private void ParchmentReqListViewItem_Tapped(object sender, TappedRoutedEventArgs e) { var fe = sender as FrameworkElement; ParchmentRequestModel requestSelected = fe.DataContext as ParchmentRequestModel; requestNo = requestSelected.RequestID; Debug.WriteLine("requestNo = " + requestNo); cancelRequestBtn.IsEnabled = true; }
private void ParchmentReqListViewItem_Tapped(object sender, TappedRoutedEventArgs e) { Debug.WriteLine("test tap"); var fe = sender as FrameworkElement; ParchmentRequestModel requestSelected = fe.DataContext as ParchmentRequestModel; requestNo = requestSelected.RequestID; Debug.WriteLine(requestNo); acceptReqBtn.IsEnabled = true; denyReqBtn.IsEnabled = true; }
public void CheckForParchmentRequests() { Requests.Clear(); // Creates the connection MySqlConnection conn = new MySqlConnection(App.connectionString); StringBuilder sb = new StringBuilder(); sb.Append("SELECT s.StudentID, s.GivenName, s.LastName, q.TafeQualCode, q.NationalQualCode, q.QualName, pr.DateApplied, pr.status, pr.parchmentRequestNo"); sb.Append(" FROM student s INNER JOIN parchment_request pr ON s.StudentID = pr.student_StudentID1"); sb.Append(" INNER JOIN qualification q ON q.QualCode = pr.qualification_QualCode"); sb.Append(" WHERE s.StudentID = '").Append(StudentID).Append("';"); // Creates the SQL command MySqlCommand command = new MySqlCommand(sb.ToString(), conn); MySqlDataReader dr; // Creates a reader to read the data conn.Open(); // Open the connection dr = command.ExecuteReader(); // Execute the command and attach to the reader int noOfRequests = 0; // While there are rows in the read while (dr.Read()) { string requestID = dr.GetString("parchmentRequestNo"); string studId = dr.GetString("StudentID"); string givenName = dr.GetString("GivenName"); string lastName = dr.GetString("LastName"); string reqQual = dr.GetString("NationalQualCode") + " " + dr.GetString("QualName"); string dateApplied = dr.GetString("DateApplied").ToString(); string status = dr.GetString("status"); noOfRequests++; ParchmentRequestModel request = new ParchmentRequestModel(requestID, studId, givenName, lastName, reqQual, dateApplied, status); Requests.Add(request); } conn.Close(); if (noOfRequests > 0) { parchmentReqTab.Visibility = Visibility.Visible; } else { parchmentReqTab.Visibility = Visibility.Collapsed; compChecklistTabViewItem.IsSelected = true; } }
public void DisplayAllPendingRequests() { MySqlConnection conn = new MySqlConnection(App.connectionString); StringBuilder sb = new StringBuilder(); sb.Append("SELECT s.StudentID, s.GivenName, s.LastName, q.NationalQualCode, q.QualName, pr.DateApplied, pr.status, pr.parchmentRequestNo"); sb.Append(" FROM student s INNER JOIN parchment_request pr ON s.StudentID = pr.student_StudentID1"); sb.Append(" INNER JOIN qualification q ON q.QualCode = pr.qualification_QualCode"); sb.Append(" WHERE pr.status = 'pending'"); sb.Append(" ORDER BY pr.DateApplied;"); // Creates the SQL command MySqlCommand command = new MySqlCommand(sb.ToString(), conn); MySqlDataReader dr; // Creates a reader to read the data conn.Open(); // Open the connection dr = command.ExecuteReader(); // Execute the command and attach to the reader // While there are rows in the read while (dr.Read()) { // string subjectdesc = dr.GetString("SubjectDescription"); string requestID = dr.GetString("parchmentRequestNo"); string studId = dr.GetString("StudentID"); string givenName = dr.GetString("GivenName"); string lastName = dr.GetString("LastName"); string reqQual = dr.GetString("NationalQualCode") + " " + dr.GetString("QualName"); string dateApplied = dr.GetString("DateApplied").ToString(); string status = dr.GetString("status"); pendingRequests++; ParchmentRequestModel request = new ParchmentRequestModel(requestID, studId, givenName, lastName, reqQual, dateApplied, status); PendingRequests.Add(request); } conn.Close(); }