コード例 #1
0
        private void show_Phong()
        {
            lsvPhong.Items.Clear();
            tienphong = 0;
            ptpBUS    = new PhieuThuePhongBUS();
            PhieuThuePhongDTO ptp = ptpBUS.getPhieuThuePhongByID(cmbMaPT.Text);

            pdpBUS = new PhieuDatPhongBUS();
            PhieuDatPhongDTO pdp = pdpBUS.getPhieuDatPhongByID(ptp.Maphieudat);

            ctdpBUS = new ChiTietDatPhongBUS();
            IList <ChiTietDatPhongDTO> list = ctdpBUS.getChiTietDatPhongByID(pdp.Maphieudat);

            pBUS  = new PhongBUS();
            lpBUS = new LoaiPhongBUS();
            foreach (ChiTietDatPhongDTO ctdp in list)
            {
                int          i  = lsvPhong.Items.Count;
                PhongDTO     p  = pBUS.getPhongByID(ctdp.Maphong);
                LoaiPhongDTO lp = lpBUS.getLoaiPhongByID(p.Maloai);
                lsvPhong.Items.Add(ctdp.Maphong);
                lsvPhong.Items[i].SubItems.Add(lp.Gia.ToString("0,0"));
                lsvPhong.Items[i].SubItems.Add(pdp.Ngayden.ToShortDateString());
                lsvPhong.Items[i].SubItems.Add(pdp.Ngaydi.ToShortDateString());
                TimeSpan sno = pdp.Ngaydi.Date.AddDays(1) - pdp.Ngayden.Date;
                lsvPhong.Items[i].SubItems.Add(sno.Days.ToString());
                decimal tp = lp.Gia * sno.Days;
                lsvPhong.Items[i].SubItems.Add(tp.ToString("0,0"));
                tienphong += tp;
            }
            labTP.Text = tienphong.ToString("0,0");
        }
コード例 #2
0
        private void trvPhong_AfterSelect(object sender, TreeViewEventArgs e)
        {
            lsvPhong.Items.Clear();
            string maphong = trvPhong.SelectedNode.Tag.ToString();

            pBUS    = new PhongBUS();
            lpBUS   = new LoaiPhongBUS();
            ctvtBUS = new ChiTietVatTuBUS();
            vtBUS   = new VatTuBUS();
            PhongDTO p = pBUS.getPhongByID(maphong);

            if (p != null)
            {
                LoaiPhongDTO            lp       = lpBUS.getLoaiPhongByID(p.Maloai);
                IList <ChiTietVatTuDTO> lispctvt = ctvtBUS.getListChiTietVatTuByMaLP(lp.Maloai);
                foreach (ChiTietVatTuDTO ctvt in lispctvt)
                {
                    IList <VatTuDTO> listvt = vtBUS.getLikeVatTuByID(ctvt.Mavattu);
                    foreach (VatTuDTO vt in listvt)
                    {
                        int i = lsvPhong.Items.Count;
                        lsvPhong.Items.Add(p.Maphong);
                        lsvPhong.Items[i].SubItems.Add(vt.Tenvattu);
                        lsvPhong.Items[i].SubItems.Add(ctvt.Soluong.ToString());
                        lsvPhong.Items[i].SubItems.Add(Math.Round(lp.Gia, 0).ToString());
                    }
                }
            }
        }
コード例 #3
0
        public void Show_phong()
        {
            pBUS = new PhongBUS();
            lsvPhong.Items.Clear();
            IList <PhongDTO> listPDTO = pBUS.getListPhongAll();

            foreach (PhongDTO p in listPDTO)
            {
                int i = lsvPhong.Items.Count;
                lsvPhong.Items.Add(p.Maphong);
                LoaiPhongDTO lpdto = lpBUS.getLoaiPhongByID(p.Maloai);
                lsvPhong.Items[i].SubItems.Add(lpdto.Maloai);
                lsvPhong.Items[i].SubItems.Add(lpdto.Songuoi.ToString());
                lsvPhong.Items[i].SubItems.Add(lpdto.Gia.ToString("0,0"));
            }
        }