コード例 #1
0
        private void gridTeachers_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row       = gridTeachers.SelectedRows[0];
            int             teacherId = Convert.ToInt32(row.Cells["TeacherId"].Value);
            String          name      = row.Cells["TeacherName"].Value.ToString();
            String          surname   = row.Cells["TeacherSurname"].Value.ToString();
            String          dept      = row.Cells["Department"].Value.ToString();

            BLAdmin bl = new BLAdmin();

            bl.UpdateTeacher(teacherId, name, surname, dept);
            gridTeachers.DataSource = bl.GetTeachers(txtNameFilter.Text, txtSurnameFilter.Text, comboBoxDept.GetItemText(comboBoxDept.SelectedItem));
        }
コード例 #2
0
        private void EditTeachersForm_Load(object sender, EventArgs e)
        {
            gridTeachers.BorderStyle = BorderStyle.None;
            gridTeachers.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(168, 218, 220);
            gridTeachers.CellBorderStyle = DataGridViewCellBorderStyle.SingleHorizontal;
            gridTeachers.DefaultCellStyle.SelectionBackColor = Color.FromArgb(29, 53, 87);
            gridTeachers.DefaultCellStyle.SelectionForeColor = Color.WhiteSmoke;
            gridTeachers.BackgroundColor                         = Color.FromArgb(3, 56, 125);
            gridTeachers.DefaultCellStyle.BackColor              = Color.FromArgb(241, 250, 238);
            gridTeachers.DefaultCellStyle.Font                   = new Font("Microsoft Tai Le", 10);
            gridTeachers.AlternatingRowsDefaultCellStyle.Font    = new Font("Microsoft Tai Le", 10);
            gridTeachers.ColumnHeadersDefaultCellStyle.Font      = new Font("Microsoft Tai Le", 11);
            gridTeachers.EnableHeadersVisualStyles               = false;
            gridTeachers.ColumnHeadersBorderStyle                = DataGridViewHeaderBorderStyle.None;
            gridTeachers.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(20, 25, 72);
            gridTeachers.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;

            gridCourses.BorderStyle = BorderStyle.None;
            gridCourses.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(168, 218, 220);
            gridCourses.CellBorderStyle = DataGridViewCellBorderStyle.SingleHorizontal;
            gridCourses.DefaultCellStyle.SelectionBackColor = Color.FromArgb(29, 53, 87);
            gridCourses.DefaultCellStyle.SelectionForeColor = Color.WhiteSmoke;
            gridCourses.BackgroundColor                         = Color.FromArgb(3, 56, 125);
            gridCourses.DefaultCellStyle.BackColor              = Color.FromArgb(241, 250, 238);
            gridCourses.DefaultCellStyle.Font                   = new Font("Microsoft Tai Le", 10);
            gridCourses.AlternatingRowsDefaultCellStyle.Font    = new Font("Microsoft Tai Le", 10);
            gridCourses.ColumnHeadersDefaultCellStyle.Font      = new Font("Microsoft Tai Le", 11);
            gridCourses.EnableHeadersVisualStyles               = false;
            gridCourses.ColumnHeadersBorderStyle                = DataGridViewHeaderBorderStyle.None;
            gridCourses.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(20, 25, 72);
            gridCourses.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;

            BLAdmin bl = new BLAdmin();

            gridTeachers.DataSource = bl.GetTeachers("", "", "");
            gridTeachers.Columns["TeacherId"].Visible         = false;
            gridTeachers.Columns["TeacherName"].HeaderText    = "Nume";
            gridTeachers.Columns["TeacherSurname"].HeaderText = "Prenume";
            gridTeachers.Columns["Department"].HeaderText     = "Catedra";
            gridTeachers.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            lblInfo.Visible         = false;
            lblCourse.Visible       = false;
            lblSet.Visible          = false;
            gridCourses.Visible     = false;
            btnAdd.Visible          = false;
            btnDelete.Visible       = false;
            comboBoxCourses.Visible = false;
            comboBoxSet.Visible     = false;
        }
コード例 #3
0
        private void comboBoxDept_SelectedIndexChanged(object sender, EventArgs e)
        {
            BLAdmin bl = new BLAdmin();

            gridTeachers.DataSource = bl.GetTeachers(txtNameFilter.Text, txtSurnameFilter.Text, comboBoxDept.GetItemText(comboBoxDept.SelectedItem));
        }