public FrEntryScore(Student student, DetailScore score, FrInputScore inputscore) { InitializeComponent(); this.student = student; this.score = score; this.inputscore = inputscore; va = new Validation(this.Controls, EVAlidation); }
private void UpdateToDatabase() { using (SampleDataContext db = new SampleDataContext()) { DetailScore detail = db.DetailScores.Where(ds => ds.ScoreDetailId == score.ScoreDetailId).FirstOrDefault(); detail.Assignment = Convert.ToInt32(TbxAssignment.Text); detail.MidExam = Convert.ToInt32(TbxMidExam.Text); detail.FinalExam = Convert.ToInt32(TbxFinalExam.Text); db.SubmitChanges(); } }
private void DGVStudents_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewRow row = DGVStudents.Rows[e.RowIndex]; using (SampleDataContext db = new SampleDataContext()) { student = db.Students.Where(s => s.StudentId == row.Cells["StudentId"].Value.ToString()).FirstOrDefault(); selecteddetail = db.DetailScores.Where(ds => ds.StudentId == student.StudentId).FirstOrDefault(); } } }
private async void MyList_ItemSelected(object sender, SelectedItemChangedEventArgs e) { this.Title = "Cours N° " + idCr.ToString(); List <Chapitre> ChapitreList; //get index of listView itemSelected var index = (MyList.ItemsSource as ObservableCollection <Chapitre>).IndexOf(e.SelectedItem as Chapitre); DetailScore sc = new DetailScore(); int x = 20; if (idCr == 1) { var result = await DisplayAlert("Commencer un test", "Votre meilleur score pour ce chapitre est " + sc.score, "Ok", "annuler"); // since we are using async, we should specify the DisplayAlert as awaiting. if (result) { await Navigation.PushAsync(new Ch1Q1(0, index + 1, 0, idCr)); } else { return; } } else if (idCr > 1) { ChapitreList = await App.ChapitreDb.GetChapitreForCours1(idCr - 1); var indice = ChapitreList[ChapitreList.Count - 1].IdChapitre; indice += index; //if (index == 0) // indice += index; //else if (index > 0) // indice += 1; var result = await DisplayAlert("Commencer un test", "Votre meilleur score pour ce chapitre est 50 %", "Ok", "annuler"); // since we are using async, we should specify the DisplayAlert as awaiting. if (result) { await Navigation.PushAsync(new Ch1Q1(0, indice + 1, 0, idCr)); } else { return; } } //else if ((idCr > 1) && (index > 0)) //List<Question> QuestionPreviousList = await App.QuestionDb.GetQuestionByChapter(); //if (index == 0) //{ // var result = await DisplayAlert("Commencer un test", "Votre meilleur score pour ce chapitre est 50 %", "Ok", "annuler"); // since we are using async, we should specify the DisplayAlert as awaiting. // if (result) // { // await Navigation.PushAsync(new Ch1Q1(0, index +1,0)); // } // else // { // return; // } //} //if (index == 2) //{ // var result = await DisplayAlert("Commencer un test", "Votre meilleur score pour ce chapitre est 75 %", "Ok", "annuler"); // since we are using async, we should specify the DisplayAlert as awaiting. // if (result) // { // await Navigation.PushAsync(new Ch2Q1(0)); // } // else // { // return; // } //} //if (index == 4) //{ // var result = await DisplayAlert("Commencer un test", "Votre meilleur score pour ce chapitre est 45 %", "Ok", "annuler"); // since we are using async, we should specify the DisplayAlert as awaiting. // if (result) // { // await Navigation.PushAsync(new Ch4Q1(0)); // } // else // { // return; // } //} }