public void ReloadData() { try { SystemUsersBO aSystemUsersBO = new SystemUsersBO(); ContractsBO aContractsBO = new ContractsBO(); colContractDate.DisplayFormat.FormatType = FormatType.DateTime; colContractDate.DisplayFormat.FormatString = "{0:dd/MM/yyyy}"; colFrom.DisplayFormat.FormatType = FormatType.DateTime; colFrom.DisplayFormat.FormatString = "{0:dd/MM/yyyy}"; colTo.DisplayFormat.FormatType = FormatType.DateTime; colTo.DisplayFormat.FormatString = "{0:dd/MM/yyyy}"; colCoefficent.DisplayFormat.FormatType = FormatType.Numeric; colCoefficent.DisplayFormat.FormatString = "{0:0,0}"; colSalaryNet.DisplayFormat.FormatType = FormatType.Numeric; colSalaryNet.DisplayFormat.FormatString = "{0:0,0}"; colSalaryCross.DisplayFormat.FormatType = FormatType.Numeric; colSalaryCross.DisplayFormat.FormatString = "{0:0,0}"; // Load data cho gridview List<ContractsEN> aListContractsEN = new List<ContractsEN>(); List<Contracts> aListTemp = aContractsBO.Select_All(); ContractsEN aContractsEN; for (int i = 0; i < aListTemp.Count; i++) { aContractsEN = new ContractsEN(); aContractsEN.SetValue(aListTemp[i]); aContractsEN.Name = aSystemUsersBO.Select_ByID(aListTemp[i].IDSystemUser).Name; aListContractsEN.Add(aContractsEN); } dgvContracts.DataSource = aListContractsEN; dgvContracts.RefreshDataSource(); } catch (Exception ex) { MessageBox.Show("frmLst_Contracts.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ReloadGridView(int IDSystemUser) { ContractsBO aContractsBO = new ContractsBO(); SystemUsersBO aSystemUsersBO = new SystemUsersBO(); List<ContractsEN> aListContractsEN = new List<ContractsEN>(); List<Contracts> aListTemp = aContractsBO.Select_ByIDSystemUser(IDSystemUser); ContractsEN aContractsEN; if (aListTemp != null) { for (int i = 0; i < aListTemp.Count; i++) { aContractsEN = new ContractsEN(); aContractsEN.SetValue(aListTemp[i]); aContractsEN.Name = aSystemUsersBO.Select_ByID(aListTemp[i].IDSystemUser).Name; aListContractsEN.Add(aContractsEN); } } dgvContracts.DataSource = aListContractsEN; dgvContracts.RefreshDataSource(); }