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();
                }
            }
        }
예제 #2
0
 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 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++;
     }
 }