Exemplo n.º 1
0
        private void updateD_Click(object sender, EventArgs e)
        {
            if (subjectoffstudentGrid.SelectedRows.Count > 0)
            {
                DataGridViewRow row  = dshsgrid.SelectedRows[0];
                string          mail = row.Cells[5].Value.ToString();
                HSB.GetMaHS(mail);
                HSB.getMon();
                DataGridViewRow row2 = subjectoffstudentGrid.SelectedRows[0];

                var    mon   = from ma in CTMonHoc.mh where ma.TenMon1 == row2.Cells[0].Value.ToString() select ma.MaMon1;
                string Mamh  = mon.FirstOrDefault().ToString();
                string d1    = txt15p.Text;
                string d2    = txt1t.Text;
                string d3    = txtck.Text;
                float  diem1 = float.Parse(d1);
                float  diem2 = float.Parse(d2);
                float  diem3 = float.Parse(d3);

                if ((diem1 <= 10 && diem1 >= 0) && (diem1 <= 10 && diem1 >= 0) && (diem1 <= 10 && diem1 >= 0))
                {
                    HSB.CapNhatDiem(HocSinhDTO.id, Mamh, diem1, diem2, diem3);
                    HSB.TLSL();
                    MessageBox.Show("update successfull");
                    dshsgrid_SelectionChanged(sender, e);
                }
                else
                {
                    MessageBox.Show("điểm môn không được lớn hơn 10 hoặc nhỏ hơn 0");
                }
            }
            else
            {
                MessageBox.Show("vui lòng chọn môn cần cập nhật");
            }
        }