public void LoadTheGrid() { ScoreSetterGrid.DataSource = NotlarDAO.GetScoresForAcademician(((ComboBoxDbItem)ChooseLesson.Items[ChooseLesson.SelectedIndex]).Id, LoggedAcademician.Id); ScoreTable = ScoreSetterGrid.DataSource as DataTable; ScoreSetterGrid.AutoResizeColumns(); for (int i = 1; i < ScoreSetterGrid.ColumnCount; i++) { ScoreSetterGrid.Columns[i].ReadOnly = true; } ScoreSetterGrid.Columns[6].ReadOnly = false; ScoreSetterGrid.Columns[7].ReadOnly = false; }
private void ScoreSetterGrid_CellEndEdit(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = ScoreSetterGrid.CurrentRow; Notlar notlar = new Notlar(); bool Result; notlar.Id = Convert.ToInt32(ScoreTable.Rows[row.Index]["Id"]); if (ScoreSetterGrid.CurrentCell.ColumnIndex == 6) { notlar.Vize = Convert.ToInt32(row.Cells["Vize"].Value); Result = NotlarDAO.UpdateScore(notlar, true); if (Result == true) { MessageBox.Show("İşlem Başarı ile tamamlandı !", "Tamamlandı", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadTheGrid(); } else { MessageBox.Show("Bir Hata oluştu", "Oops", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (ScoreSetterGrid.CurrentCell.ColumnIndex == 7) { notlar.Vize = Convert.ToInt32(row.Cells["Final"].Value); Result = NotlarDAO.UpdateScore(notlar, false); if (Result == true) { MessageBox.Show("İşlem Başarı ile tamamlandı !", "Tamamlandı", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadTheGrid(); } else { MessageBox.Show("Bir Hata oluştu", "Oops", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void ShowScoresHeadScreen_Load(object sender, EventArgs e) { ScoresGridView.DataSource = NotlarDAO.GetScoresForHead(Id, OgrenciId); ScoresGridView.AutoResizeColumns(); ScoresGridView.ReadOnly = true; }