private void UpdateChartData() { series.Points.Clear(); title.Text = rdoCanNang.Checked ? "Biểu đồ cân nặng" : "Biểu đồ chiều cao"; if (maTre == "" || cboTuThang.SelectedItem == null || cboDenThang.SelectedItem == null) { return; } List <SucKhoe> listSucKhoe = SucKhoeBLL.GetListSucKhoeTheoThang( maTre, int.Parse(cboTuThang.SelectedItem.ToString()), int.Parse(cboDenThang.SelectedItem.ToString()), KeyHandle.GetKeyFromCombobox(cboNamHoc.SelectedItem.ToString())); foreach (SucKhoe sucKhoe in listSucKhoe) { series.Points.AddXY(sucKhoe.Thang.ToString() + "/" + sucKhoe.Nam.ToString(), rdoCanNang.Checked ? sucKhoe.CanNang : sucKhoe.ChieuCao); } }
private void LoadListChiTietSucKhoe() { if (cboTuThang.SelectedItem == null || cboDenThang.SelectedItem == null) { dgvChiTietSucKhoe.DataSource = null; UpdateChartData(); return; } dgvChiTietSucKhoe.DataSource = SucKhoeBLL.GetListSucKhoeTheoThang( maTre, int.Parse(cboTuThang.SelectedItem.ToString()), int.Parse(cboDenThang.SelectedItem.ToString()), KeyHandle.GetKeyFromCombobox(cboNamHoc.SelectedItem.ToString())); dgvChiTietSucKhoe.Columns[1].HeaderText = "Tháng"; dgvChiTietSucKhoe.Columns[2].HeaderText = "Năm"; dgvChiTietSucKhoe.Columns[6].HeaderText = "Cân nặng (kg)"; dgvChiTietSucKhoe.Columns[7].HeaderText = "Chiều cao (cm)"; dgvChiTietSucKhoe.Columns[9].HeaderText = "Tình trạng"; dgvChiTietSucKhoe.Columns[10].HeaderText = "Ghi chú"; dgvChiTietSucKhoe.Columns[1].Width = 60; dgvChiTietSucKhoe.Columns[2].Width = 60; dgvChiTietSucKhoe.Columns[6].Width = 150; dgvChiTietSucKhoe.Columns[7].Width = 150; dgvChiTietSucKhoe.Columns[9].Width = 200; dgvChiTietSucKhoe.Columns[10].Width = 300; string[] listProp = { "Thang", "Nam", "CanNang", "ChieuCao", "TinhTrang", "GhiChu" }; ControlFormat.DataGridViewFormat(dgvChiTietSucKhoe, listProp); dgvChiTietSucKhoe.ClearSelection(); UpdateChartData(); }