private void HienThiDSHocSinh()
        {
            dgvHocSinh.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            BangDiemDAL bangDiemDAl = new BangDiemDAL();

            this.maMon            = Convert.ToInt16(cbMonHoc.SelectedValue.ToString());
            this.maLop            = Convert.ToInt16(cbLop.SelectedValue.ToString());
            dgvHocSinh.DataSource = bangDiemDAl.LoadBangDiemHS(this.maMon, this.maLop);
        }
 private void cbMonHoc_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         BangDiemDAL bangDiemDAl = new BangDiemDAL();
         this.maMon            = Convert.ToInt16(cbMonHoc.SelectedValue.ToString());
         this.maLop            = Convert.ToInt16(cbLop.SelectedValue.ToString());
         dgvHocSinh.DataSource = bangDiemDAl.LoadBangDiemHS(maMon, maLop);
         // HienThiDSHocSinh();
     }
     catch { }
 }
Beispiel #3
0
        private void btSua_Click(object sender, EventArgs e)
        {
            BangDiem bangDiem = new BangDiem();

            try
            {
                bangDiem.MaHocSinh = Convert.ToInt32(lbMaHS.Text);

                bangDiem.MaMon = this.maMon;
                bangDiem.HocKi = Convert.ToInt16(tbHocKi.Text);
                if (checkDiem(tbDMieng.Text) == true)
                {
                    bangDiem.DiemMieng = Convert.ToDouble(tbDMieng.Text);
                    if (checkDiem(tbD15ph.Text) == true)
                    {
                        bangDiem.Diem15ph = Convert.ToDouble(tbD15ph.Text);
                        if (checkDiem(tbDMotTiet.Text) == true)
                        {
                            bangDiem.Diem1tiet = Convert.ToDouble(tbDMotTiet.Text);
                            if (checkDiem(tbDiemCuoiKi.Text) == true)
                            {
                                bangDiem.DiemCuoiKi = Convert.ToDouble(tbDiemCuoiKi.Text);
                                bangDiem.DiemTB     = (bangDiem.Diem15ph + bangDiem.DiemMieng + bangDiem.Diem1tiet * 2 + bangDiem.DiemCuoiKi * 3) / 7.0;
                                bangDiem.DiemTB     = Math.Round(bangDiem.DiemTB, 2);
                                BangDiemDAL bangDiemDAl = new BangDiemDAL();
                                bangDiemDAl.updateBangdiem(bangDiem);
                                dgvHocSinh.DataSource = bangDiemDAl.LoadBangDiemHS(maMon, maLop);
                            }
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("diem", "Loi");
            }
        }