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 LoadGrid() { LessonGridView.DataSource = DersDAO.GetGridData(LoggedAcademician.BolumId); for (int i = 2; i < LessonGridView.ColumnCount; i++) { LessonGridView.Columns[i].ReadOnly = true; } dt = LessonGridView.DataSource as DataTable; LessonGridView.AutoResizeColumns(); }
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 OK_Click(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(StudentName.Text) && !String.IsNullOrEmpty(StudentNumber.Text) && !String.IsNullOrEmpty(StudentSurname.Text) && !String.IsNullOrEmpty(StudentUserName.Text)) { Ogrenci ogrenci = new Ogrenci { Ad = StudentName.Text, Soyad = StudentSurname.Text, Numara = StudentNumber.Text, Donem = 1, AlinanDersler = DersDAO.GetFirst(LoggedAcademican.BolumId), BolumId = LoggedAcademican.BolumId, FakulteId = LoggedAcademican.FakulteId }; if (Men.Checked == true) { ogrenci.Cinsiyet = true; } else { ogrenci.Cinsiyet = false; } ogrenci.KullaniciAdi = StudentUserName.Text; ogrenci.Sifre = Password.Encrypt(ogrenci.Numara); ogrenci.Aktif = true; ogrenci.Onay = true; ogrenci.OnceOnay = false; bool Result = OgrenciDAO.AddUpdateDeleteStudent(ogrenci, 0); 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); } } else { MessageBox.Show("Hatalı Giriş Yaptınız Lütfen Tekrar Deneyiniz !", "HATA !", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception err) { MessageBox.Show(err.Message); } }
private void AcademicianScreen_Load(object sender, EventArgs e) { this.ControlBox = false; Welcome.Text = "Hoşgeldin " + LoggedAcademician.Ad + " " + LoggedAcademician.Soyad; List <Ders> Dersler = DersDAO.FillComboBox(LoggedAcademician.Id); ChooseLesson.DisplayMember = "Ad"; ChooseLesson.ValueMember = "Id"; foreach (Ders ders in Dersler) { ChooseLesson.Items.Add(new ComboBoxDbItem { Ad = ders.Ad, Id = ders.Id }); } }
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); } }
private void ApprovingScreen_Load(object sender, EventArgs e) { List <int> dersIds = new List <int>(); for (int i = 0; i < ogrenci.AlinanDersler.Length; i += 2) { string dummy = ogrenci.AlinanDersler.Substring(i, 2); dersIds.Add(Convert.ToInt32(dummy)); } ApproveGrid.DataSource = DersDAO.ApprovingList(dersIds); if (ApproveGrid.DataSource == null) { this.Close(); } for (int i = 4; i < ApproveGrid.ColumnCount; i++) { ApproveGrid.Columns[i].ReadOnly = true; } ApproveGrid.AutoResizeColumns(); }