public string PhatSinhMa() { int so = dg_DAO.DemDocGia(); // 6 string Ma = "DG"; int idem = 0; foreach (char x in so.ToString()) // co 1 ki tu { idem++; // idem = 1 } for (int i = 0; i < 8 - idem; i++) // 7 so 0 { Ma += "0"; } Ma += so.ToString(); // 6 return(Ma); }