private void loadDataToGrid() { DataTable temTb = new DataTable(); DataTable tb1 = new DataTable(); DataTable tb2 = new DataTable(); temTb = boDkh.getDangKiHoc_Name_ByLopID(int.Parse(lookLopHoc.GetColumnValue("LOP_ID").ToString())); if (temTb.Rows.Count > 0) { tb1 = getLopDaCapCC(); tb2 = GetTable(); foreach (DataRow item in tb2.Rows) { DataRow newRow = tb1.NewRow(); newRow.ItemArray = item.ItemArray; tb1.Rows.Add(newRow); } DataTable tbst = new DataTable(); tbst = tb1.Clone(); for (int i = 0; i < tb1.Rows.Count; i++) { DateTime datetime; string StringDate = string.Empty; int tb1ColCount = tb1.Columns.Count; if (tb1.Rows[i][tb1ColCount - 2].ToString() != "") { datetime = Convert.ToDateTime(tb1.Rows[i][tb1ColCount - 2].ToString()); datetime = Convert.ToDateTime(datetime.ToShortDateString()); StringDate = datetime.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture); StringDate = StringDate.ToString().Substring(0, 2) + "/" + StringDate.ToString().Substring(3, 2) + "/" + StringDate.ToString().Substring(6, 4); } DataRow tbstRow = tbst.NewRow(); tbstRow[0] = tb1.Rows[i][0].ToString(); tbstRow[1] = tb1.Rows[i][1].ToString(); tbstRow[2] = tb1.Rows[i][2].ToString(); tbstRow[3] = tb1.Rows[i][3].ToString(); int subColTotal = tb1ColCount - 7; for (int isd = 4; isd < tb1ColCount - 3; isd++) { tbstRow[isd] = tb1.Rows[i][isd].ToString(); } tbstRow[tb1ColCount - 3] = tb1.Rows[i][tb1ColCount - 3].ToString(); tbstRow[tb1ColCount - 2] = StringDate.ToString(); // tb1.Rows[i][tb1ColCount - 3].ToString(); if (tb1.Rows[i][tb1ColCount - 1].ToString() != "") { tbstRow[tb1ColCount - 1] = tb1.Rows[i][tb1ColCount - 1].ToString(); tbst.Rows.Add(tbstRow); } } gridContentCertificate.Columns.Clear(); gridCertificate.DataSource = tbst; gridContentCertificate.Columns["HvID"].VisibleIndex = -1; gridContentCertificate.Columns["CCC_LOPID"].VisibleIndex = -1; sselection = new GridCheckMarksSelection(gridContentCertificate); sselection.CheckMarkColumn.VisibleIndex = 0; sselection.CheckMarkColumn.Width = 8; } else { showData(); sselection = new GridCheckMarksSelection(gridContentCertificate); sselection.CheckMarkColumn.VisibleIndex = 0; } DataTable lastSoCc = new DataTable(); lastSoCc = boCcc.getLast_SoCc(int.Parse(lookChungChi.GetColumnValue("CHC_ID").ToString())); if (lastSoCc.Rows.Count <= 0) { txtSoCcCuoi.Text = " 000000GTVT"; return; } else { txtSoCcCuoi.Text = lastSoCc.Rows[0]["SoCc"].ToString() + "GTVT"; // mSoCc = lastSoCc.Rows[0]["SoCc"].ToString(); mSoCc = txtSoCcCuoi.Text; } }