Exemple #1
0
        private void LayDanhSachPhongTrong()
        {
            List <PhongDTO> danhmuclst = new List <PhongDTO>();

            danhmuclst = PhongBUS.LayDanhSachLoaiPhong();
            for (int i = 0; i < danhmuclst.Count; i++)
            {
                string        lp  = danhmuclst[i].MaLoaiPhong;
                int           num = PhongBUS.LaySLPhongTrongTheoLoai(lp);
                DirectoryInfo dir;
                dir = new DirectoryInfo(@"..\..\ICON\" + lp);
                for (int j = 1; j <= num; j++)
                {
                    foreach (FileInfo file in dir.GetFiles())
                    {
                        //imgListRoom.Images.Add(Image.FromFile(file.FullName));
                        try
                        {
                            imgListRoom.Images.Add(Image.FromFile(file.FullName));
                        }
                        catch
                        {
                        }
                    }
                }
            }


            for (int j = 0; j < this.imgListRoom.Images.Count; j++)
            {
                ListViewItem item = new ListViewItem();
                item.ImageIndex = j;
                string a = Convert.ToString(j);
                item.Text = a;
                this.lvPhong.Items.Add(item);
            }
        }