private void OK_Click(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(EditedAcademicanPicker.Text) && !String.IsNullOrEmpty(EditedLessonName.Text)) { Ders ders = new Ders { Id = dersDTO.Id, Ad = EditedLessonName.Text, AkademisyenId = ((ComboBoxDbItem)EditedAcademicanPicker.Items[EditedAcademicanPicker.SelectedIndex]).Id, Aktif = true, Donem = Convert.ToByte(dersDTO.Donem) }; bool Result = DersDAO.AddUpdateDeleteLesson(ders, 1); if (Result == true) { MessageBox.Show("İşlem Başarı ile tamamlandı !", "Tamamlandı", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("Bir Hata oluştu", "Oops", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception err) { MessageBox.Show(err.Message); } }
private void LessonGridView_CellClick(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = LessonGridView.CurrentRow; if (LessonGridView.CurrentCell.ColumnIndex == 1) { DersDTO dersDTO = new DersDTO { Ad = row.Cells["Ad"].Value.ToString(), Id = Convert.ToInt32(dt.Rows[row.Index]["Id"]), FakulteAd = row.Cells["FakulteAd"].Value.ToString(), BolumAd = row.Cells["BolumAd"].Value.ToString(), AkademisyenId = Convert.ToInt32(dt.Rows[row.Index]["AkademisyenId"]), AkademisyenAd = row.Cells["AkademisyenAd"].Value.ToString(), Kredi = Convert.ToByte(row.Cells["Kredi"].Value), Donem = Convert.ToInt32(row.Cells["Donem"].Value), BolumId = LoggedAcademician.BolumId }; UpdateLessonScreen ULS = new UpdateLessonScreen(); ULS.GetInfo(dersDTO); ULS.ShowDialog(); LoadGrid(); } else if (LessonGridView.CurrentCell.ColumnIndex == 0) { DialogResult dialogResult = MessageBox.Show(row.Cells["Ad"].Value.ToString() + " Adlı ders kalıcı olarak silinecek", "Emin Misin ?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dialogResult == DialogResult.OK) { Ders ders = new Ders { Aktif = false, Id = Convert.ToInt32(dt.Rows[row.Index]["Id"]) }; bool Result = DersDAO.AddUpdateDeleteLesson(ders, 2); if (Result == true) { MessageBox.Show("Silme İşlemi Başarı İle Tamamlandı !", "GONE FOREVER (!)", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadGrid(); } else { MessageBox.Show("Birşeyler Yanlış Gitti !", "Oops", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("İptal Edildi !", "İptal", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void AddLessonBtn_Click(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(LessonName.Text) && !String.IsNullOrEmpty(Credit.Text) && !String.IsNullOrEmpty(AcademicianPicker.Text) && !String.IsNullOrEmpty(PeriodPicker.Text)) { Ders ders = new Ders { Ad = LessonName.Text, Aktif = true, Donem = Convert.ToByte(PeriodPicker.Text), FakulteId = LoggedAcademician.FakulteId }; if (IsShared.Checked == true) { ders.BolumId = 1; } else { ders.BolumId = LoggedAcademician.BolumId; } ders.Kredi = Convert.ToByte(Credit.Text); ders.AkademisyenId = ((ComboBoxDbItem)AcademicianPicker.Items[AcademicianPicker.SelectedIndex]).Id; DialogResult Sure = MessageBox.Show(ders.Ad + " adlı ders eklenecek emin misiniz ?", "Emin Misin ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Sure == DialogResult.Yes) { DersDAO.AddUpdateDeleteLesson(ders, 0); } else { MessageBox.Show("Ders Eklenmedi !", "Eklenmedi", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Hatalı Giriş Yaptınız Lütfen Tekrar Deneyiniz !", "HATA !", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception err) { MessageBox.Show(err.Message); } }