Ejemplo n.º 1
0
        public void lblred_MouseHover(object sender, EventArgs e)
        {
            PhongBUS            pbus    = new PhongBUS();
            ChiTietThuePhongBUS cttpbus = new ChiTietThuePhongBUS();
            ThuePhongBUS        tpbus   = new ThuePhongBUS();
            KhachHangBUS        khbus   = new KhachHangBUS();
            Label  lbl     = sender as Label;
            string ttPhong = lbl.Text;

            string[] lsPhong     = ttPhong.Split('\r');
            string   mathue      = cttpbus.getMaThue_By_MaPhong_TrangThai(pbus.maPhong_byTen(lsPhong[0].Trim()), false);
            string   ttThuePhong = "";
            int      stt         = 0;

            foreach (var item in cttpbus.getChiTietThuePhong_By_MaThue_MaPhong(mathue, pbus.maPhong_byTen(lsPhong[0].Trim())))
            {
                stt++;
                ttThuePhong += "Khách hàng " + stt + " : " + khbus.getenKH_ByID(item.MaKhach) + "\n";
            }
            foreach (var item in cttpbus.getChiTietThuePhong_By_MaThue_MaPhong(mathue, pbus.maPhong_byTen(lsPhong[0].Trim())))
            {
                if (item.NgayRa < DateTime.Now.Date)
                {
                    ttThuePhong += "Ngày ra: " + DateTime.Now.Date.ToShortDateString();
                }
                else
                {
                    ttThuePhong += "Ngày ra: " + item.NgayRa.ToShortDateString();
                }
                break;
            }
            toolTipTTThuePhong.SetToolTip(lbl, ttThuePhong);
        }
Ejemplo n.º 2
0
        /**Tạo sự kiện kích chuột phải vào label để lấy các thông tin trong label đó
         * ra truyền qua các form khác* */
        public void lblred_Click(object sender, MouseEventArgs e)
        {
            PhongBUS            pbus    = new PhongBUS();
            ChiTietThuePhongBUS cttpbus = new ChiTietThuePhongBUS();
            ThuePhongBUS        tpbus   = new ThuePhongBUS();
            Label lbl = sender as Label;

            if (e.Button == MouseButtons.Right)
            {
                string   ttPhong  = lbl.Text;
                string[] lsPhong  = ttPhong.Split('\r');
                string   tenPhong = lsPhong[0].Trim();
                frmTraKhachLe.TenPhong   = tenPhong;
                frmDatPhong.TenLoaiPhong = "Phòng " + lpbus.getTen_Byma(pbus.getLoaiPhong_ByID(pbus.maPhong_byTen(tenPhong)));
                frmTraKhachLe.LoaiPhong  = "Phòng " + lpbus.getTen_Byma(pbus.getLoaiPhong_ByID(pbus.maPhong_byTen(tenPhong)));
                frmDatPhong.TenPhong     = tenPhong;
                frmTraKhachLe.MaThue     = cttpbus.getMaThue_By_MaPhong_TrangThai(pbus.maPhong_byTen(tenPhong), false);
                frmDatPhong.maThue       = cttpbus.getMaThue_By_MaPhong_TrangThai(pbus.maPhong_byTen(tenPhong), false);
                frmDatPhong.maKhachHang  = cttpbus.getMaKhach_By_MaPhong_TrangThai(pbus.maPhong_byTen(tenPhong), false);
                frmDoiPhong.TenPhong     = tenPhong;
                frmDoiPhong.maThue       = cttpbus.getMaThue_By_MaPhong_TrangThai(pbus.maPhong_byTen(tenPhong), false);
                TenPhong = tenPhong;
            }
        }
Ejemplo n.º 3
0
        private void thuePhongToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ThuePhongBUS        tpbus   = new ThuePhongBUS();
            ChiTietThuePhongBUS cttpbus = new ChiTietThuePhongBUS();

            foreach (eThuePhong item in tpbus.getMaThue(cttpbus.getMaThue_By_MaPhong_TrangThai(pbus.maPhong_byTen(TenPhong), false)))
            {
                if (item.MaDoan != null)
                {
                    frmTraKhachLe frm = new frmTraKhachLe(this, item.MaDoan);
                    frm.ShowDialog();
                }
                else
                {
                    frmTraKhachLe frm = new frmTraKhachLe(this);
                    frm.ShowDialog();
                }
            }
        }
Ejemplo n.º 4
0
        //Load giao diện các phòng trống và phòng có chứa khách hàng
        public void TaoGiaoDienPhong(List <ePhong> soPhong, List <ePhong> phongTrong, List <ePhong> coKhach, string title)
        {
            //Tạo ra một flowLayoutPanel để chứa các panel
            PhongBUS        pbus             = new PhongBUS();
            FlowLayoutPanel flowLayoutPanel3 = new FlowLayoutPanel();

            flowLayoutPanel3.AutoSize     = true;
            flowLayoutPanel3.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            flowLayoutPanel1.Controls.Add(flowLayoutPanel3);
            Label text = new Label();

            text.Size      = new Size(1850, 30);
            text.TextAlign = ContentAlignment.TopCenter;
            text.Text      = title;
            flowLayoutPanel3.Controls.Add(text);
            //Tạo các label để chứa thông tin, màu sắc thể hiện các phòng
            foreach (var item in soPhong)
            {
                DevExpress.XtraEditors.PanelControl P0001 = new DevExpress.XtraEditors.PanelControl();
                Label lbl = new Label();
                flowLayoutPanel3.Controls.Add(P0001);
                P0001.Appearance.Options.UseBackColor = true;
                P0001.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Style3D;
                P0001.Controls.Add(lbl);
                P0001.Location = new Point(3, 3);
                P0001.Name     = item.MaPhong;
                P0001.Size     = new Size(170, 150);
                lbl.Font       = new Font("Tahoma", 9F);
                lbl.Dock       = DockStyle.Fill;
                lbl.Size       = new Size(150, 120);
                lbl.TextAlign  = ContentAlignment.TopCenter;
            }
            //Load thông tin của phòng trống vào từng label
            foreach (var item in phongTrong)
            {
                foreach (var pnl in flowLayoutPanel3.Controls.OfType <DevExpress.XtraEditors.PanelControl>())
                {
                    if (pnl.Name.Equals(item.MaPhong.Trim()))
                    {
                        pnl.BackColor = Color.LawnGreen;
                        foreach (var lbl in pnl.Controls.OfType <Label>())
                        {
                            string ma = item.MaPhong.Substring(3, 5);
                            lbl.BackColor        = Color.LawnGreen;
                            lbl.Text             = "Phòng " + Convert.ToInt32(ma);
                            lbl.MouseDown       += new MouseEventHandler(lbl_ClickTP);
                            lbl.ContextMenuStrip = cmnstrpSanSang;
                        }
                    }
                }
            }
            //Load thông tin của phòng đang có khách vào từng label
            foreach (var item in coKhach)
            {
                foreach (var pnl in flowLayoutPanel3.Controls.OfType <DevExpress.XtraEditors.PanelControl>())
                {
                    if (pnl.Name.Equals(item.MaPhong.Trim()))
                    {
                        pnl.BackColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128)))));
                        foreach (var lbl in pnl.Controls.OfType <Label>())
                        {
                            lbl.BackColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128)))));
                            string ma = item.MaPhong.Substring(3, 5);
                            ChiTietThuePhongBUS cttpbus = new ChiTietThuePhongBUS();
                            DoanBUS             dbus    = new DoanBUS();
                            ThuePhongBUS        tpbus   = new ThuePhongBUS();
                            foreach (var thuePhong in tpbus.getMaThue(cttpbus.getMaThue_By_MaPhong_TrangThai(item.MaPhong, false)))
                            {
                                if (thuePhong.MaDoan == null)
                                {
                                    lbl.Text = "Phòng " + Convert.ToInt32(ma);
                                }
                                else
                                {
                                    string tendoan  = dbus.getTen_ById(tpbus.getMaDoan_ByMaThue(cttpbus.getMaThue_By_MaPhong_TrangThai(item.MaPhong, false)));
                                    string tenPhong = "Phòng " + Convert.ToInt32(ma);
                                    lbl.Text = tenPhong + "\n\n\rĐoàn: " + tendoan;
                                }
                            }
                            lbl.MouseDown       += new MouseEventHandler(lblred_Click);
                            lbl.MouseHover      += new EventHandler(lblred_MouseHover);
                            lbl.ContextMenuStrip = cmnstrpCoKhach;
                        }
                    }
                }
            }
        }