private void BtnEdit_Click(object sender, EventArgs e) { if (dgvStudentList.Rows.Count > 0) { if (dgvStudentList.SelectedRows.Count == 1) { int selectIndex = dgvStudentList.CurrentRow.Index; var studentID = dgvStudentList.Rows[selectIndex].Cells[0].Value; var student = StudentsHelper.GetById(Convert.ToInt32(studentID)); cmbSession.SelectedItem = SessionsHelper.GetByNameFromID(student.SessionID); cmbDepartment.SelectedItem = DepartmentsHelper.GetByNameFromID(student.DepartmentID); cmbProgram.SelectedItem = ProgramsHelper.GetByNameFromID(student.ProgramID); txtStudentName.Text = student.Name; txtTCNO.Text = student.TCNO; cmbGender.SelectedIndex = student.Gender; txtEnrollNo.Text = student.EnrollNo; txtAddress.Text = student.Address; txtContactNo.Text = student.ContactNo; EnableComponent(); } } }
private void BtnEdit_Click(object sender, EventArgs e) { if (dgvBookList.Rows.Count > 0) { if (dgvBookList.SelectedRows.Count == 1) { int selectIndex = dgvBookList.CurrentRow.Index; var bookID = dgvBookList.Rows[selectIndex].Cells[0].Value; var book = BooksHelper.GetBookByID(Convert.ToInt32(bookID)); cmbDepartment.SelectedItem = DepartmentsHelper.GetByNameFromID(book.DepartmentID); cmbCategory.SelectedItem = BookCategoriesHelper.GetByNameFromID(book.BookCategoryID); txtBookName.Text = book.BookName; txtTitle.Text = book.Title; txtAuthor.Text = book.Author; txtEdition.Text = book.Edition; txtEdition.Text = string.Empty; dtpRegDate.Value = book.DateOfRegister; txtPrice.Text = book.Price.ToString(); DisableComponent(); } } }
private void FillGridStudent(Students s) { dgvStudentDetail.Rows.Clear(); dgvStudentDetail.Rows.Add($"Adı : {s.Name}"); dgvStudentDetail.Rows.Add($"TC No : {s.TCNO}"); dgvStudentDetail.Rows.Add($"Dönem : {SessionsHelper.GetByNameFromID(s.SessionID)}"); dgvStudentDetail.Rows.Add($"Bölüm : {DepartmentsHelper.GetByNameFromID(s.DepartmentID)}"); dgvStudentDetail.Rows.Add($"Dönem : {ProgramsHelper.GetByNameFromID(s.ProgramID)}"); }
private void FillGridBook(Books b) { dgvBookDetail.Rows.Clear(); dgvBookDetail.Rows.Add($"Adı : {b.BookName}"); dgvBookDetail.Rows.Add($"Yazarı : {b.Author}"); dgvBookDetail.Rows.Add($"Kategori : {BookCategoriesHelper.GetByNameFromID(b.BookCategoryID)}"); dgvBookDetail.Rows.Add($"Bölüm : {DepartmentsHelper.GetByNameFromID(b.DepartmentID)}"); dgvBookDetail.Rows.Add($"Miktar : {b.NoOfCopies}"); }
private void FillGrid() { dgvStudentList.Rows.Clear(); foreach (var student in StudentsHelper.GetActiveStudentsList()) { int row = dgvStudentList.Rows.Add(); dgvStudentList.Rows[row].Cells[0].Value = student.StudentID; dgvStudentList.Rows[row].Cells[1].Value = student.Name; dgvStudentList.Rows[row].Cells[2].Value = student.TCNO; dgvStudentList.Rows[row].Cells[3].Value = student.EnrollNo; dgvStudentList.Rows[row].Cells[4].Value = SessionsHelper.GetByNameFromID(student.SessionID); dgvStudentList.Rows[row].Cells[5].Value = DepartmentsHelper.GetByNameFromID(student.DepartmentID); dgvStudentList.Rows[row].Cells[6].Value = ProgramsHelper.GetByNameFromID(student.ProgramID); dgvStudentList.Rows[row].Cells[7].Value = student.RegisterDate.ToString("dd MMMM yyyy"); dgvStudentList.Rows[row].Cells[8].Value = student.Address; dgvStudentList.Rows[row].Cells[9].Value = student.ContactNo; dgvStudentList.Rows[row].Cells[10].Value = StaffsHelper.GetByNameFromID(student.StaffID); row++; } }
private void FillGrid() { dgvBookList.Rows.Clear(); foreach (var book in BooksHelper.GetBooksList()) { int row = dgvBookList.Rows.Add(); dgvBookList.Rows[row].Cells[0].Value = book.BookID; dgvBookList.Rows[row].Cells[1].Value = book.BookName; dgvBookList.Rows[row].Cells[2].Value = BookCategoriesHelper.GetByNameFromID(book.BookCategoryID); dgvBookList.Rows[row].Cells[3].Value = DepartmentsHelper.GetByNameFromID(book.DepartmentID); dgvBookList.Rows[row].Cells[4].Value = book.Author; dgvBookList.Rows[row].Cells[5].Value = book.Title; dgvBookList.Rows[row].Cells[6].Value = book.Edition; dgvBookList.Rows[row].Cells[7].Value = book.NoOfCopies; dgvBookList.Rows[row].Cells[8].Value = book.DateOfRegister.ToString("dd MMMM yyyy"); dgvBookList.Rows[row].Cells[9].Value = book.Price; dgvBookList.Rows[row].Cells[10].Value = StaffsHelper.GetByNameFromID(_staffID); row++; } }