public void LoadInFoRoom(List <DTO_Room> lstRoom) { var dt = DAO_Room.Instance.LoadInfoRoom(); //lstRoom.AddRange(from DataRow item in dt.Rows select new DTO_Room((string) item[0], (int) item[1], (int) item[2], (int) item[3], (DateTime) item[4])); foreach (DataRow item in dt.Rows) { DTO_Room rm = new DTO_Room((string)item[0], (int)item[1], (int)item[2], (int)item[3], (DateTime)item[4], (int)item[5]); lstRoom.Add(rm); } }
public void SapXepPhongTangDan(List <DTO_Room> lstRoom) { for (int i = 0; i < lstRoom.Count - 1; i++) { for (int j = i + 1; j < lstRoom.Count; j++) { if (string.Compare(lstRoom[i].Name, lstRoom[j].Name) <= 0) { continue; } DTO_Room rm = new DTO_Room(); rm = lstRoom[i]; lstRoom[i] = lstRoom[j]; lstRoom[j] = rm; } } }