예제 #1
0
        private void loadData() //load data lên form
        {
            ListThamSoSTO.Clear();
            ListThamSoSTO.Add(tsBUS.getData("1"));
            if (ListThamSoSTO[0] != null)
            {
                UpdateButt_Clicked = 1;
            }
            else
            {
                UpdateButt_Clicked = 0;
                ListThamSoSTO.Clear();
                ListThamSoSTO.Add(tsBUS.getData("0"));
            }
            BindingSource bsLCT = new BindingSource();
            BindingSource bsLBT = new BindingSource();

            TuoiCTMinNumericUD.Value    = ListThamSoSTO[0].TuoiCTMin;
            TuoiCTMaxNumericUD.Value    = ListThamSoSTO[0].TuoiCTMax;
            SoLuongCTMinNumericUD.Value = ListThamSoSTO[0].SoLuongCTMin;
            SoLuongCTMaxNumericUD.Value = ListThamSoSTO[0].SoLuongCTMax;
            SoCTNgoaiMaxNumericUD.Value = ListThamSoSTO[0].SoCTNgoaiMax;
            TGGhiBanMaxNumericUD.Value  = ListThamSoSTO[0].TGGhiBanMax / 60;
            WinNumericUD.Value          = ListThamSoSTO[0].DiemThang;
            DrawNumericUD.Value         = ListThamSoSTO[0].DiemHoa;
            LostNumericUD.Value         = ListThamSoSTO[0].DiemThua;
            //truyền data vào DataTable
            DataSet dsLCT = lctBUS.getData();
            DataSet dsLBT = lbtBUS.getData();

            //truyền data LBT vào List
            ListLoaiBanThangSTO = dsLBT.Tables[0].AsEnumerable().Select(DataRow => new LoaiBanThangDTO
            {
                MaLoaiBT  = DataRow.Field <string>("MaLoaiBT"),
                TenLoaiBT = DataRow.Field <string>("TenLoaiBT")
            }).ToList();


            //hiển thị lên dgvLCT
            bsLCT.DataSource = dsLCT;
            dataGridViewLCT.Columns.Clear();
            dataGridViewLCT.ColumnHeadersVisible = false;
            dataGridViewLCT.DataSource           = null;

            dataGridViewLCT.AutoGenerateColumns = false;
            dataGridViewLCT.AllowUserToAddRows  = false;
            dataGridViewLCT.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dataGridViewLCT.DataSource          = bsLCT;
            dataGridViewLCT.DataMember          = "LCT";

            DataGridViewTextBoxColumn clLCT = new DataGridViewTextBoxColumn();

            clLCT.Name             = "LoaiCT";
            clLCT.HeaderText       = "Loại cầu thủ";
            clLCT.DataPropertyName = "LoaiCauThu";
            dataGridViewLCT.Columns.Add(clLCT);
            dataGridViewLCT.ReadOnly = true;

            //hiển thị lên dgvLBT
            dataGridViewLBT_load();

            //load dataGridVIewTTXH
            if (UpdateButt_Clicked == 0)
            {
                dataGridViewTTXH_default_load();
            }
            else
            {
                TTXHlist = tsBUS.getTTXH(UpdateButt_Clicked.ToString());
                dataGridViewTTXH_load(TTXHlist);
            }
        }