コード例 #1
0
ファイル: TrangChu.cs プロジェクト: dangdn/Quan-Ly-Khach-San
        private void LoadData(int state)
        {
            this.Controls.Remove(_panelData);
            _panelData                  = new Panel();
            _panelData.Location         = new Point(150, 85);
            _panelData.Size             = new Size(465, 419);
            _panelData.BorderStyle      = System.Windows.Forms.BorderStyle.Fixed3D;
            _panelData.AutoScroll       = true;
            _panelData.AutoScrollMargin = new Size(0, 25);

            _dataPhong = _phongBUS.LayDanhSachPhongTheoLoaiPhong(state);
            int x = 25;
            int y = 20;

            for (int i = 0; i < _dataPhong.Count; i++)
            {
                //x = x + 120;
                Color  c = Color.White;
                string s = _dataPhong[i].TrangThai.Normalize(NormalizationForm.FormC);
                if (s == "Còn Trống".Normalize(NormalizationForm.FormC))
                {
                    c = Color.Wheat;
                }
                else
                {
                    if (s == "Đang Sử Dụng".Normalize(NormalizationForm.FormC))
                    {
                        c = Color.Yellow;
                    }
                    else
                    {
                        if (s == "Đang Bảo Trì".Normalize(NormalizationForm.FormC))
                        {
                            c = Color.Gray;
                        }
                    }
                }

                if (x > 450)
                {
                    x = 25;
                    y = y + 145;
                }
                Panel _roomPanel = DrawPanel(new Point(x, y), c, _dataPhong[i].TenPhong, _dataPhong[i].TrangThai, _dataPhong[i].IdPhong, img);


                _panelData.Controls.Add(_roomPanel);
                x += 145;
            }
            this.Controls.Add(_panelData);
        }
コード例 #2
0
        private void btnTimPhong_Click(object sender, EventArgs e)
        {
            frmMain TempForm = (frmMain)Application.OpenForms["frmMain"];

            if (TempForm.kh.TenDangNhap == "" || TempForm.kh.MatKhau == "")
            {
                MessageBox.Show("Bạn đã đăng xuất khỏi chương trình !", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                string strMaLP = cmbLoaiPhong.SelectedValue.ToString();
                if (isNumeric(strMaLP))
                {
                    int             MaLoaiPhong = int.Parse(strMaLP);
                    List <PhongDTO> DSPhong     = busPhong.LayDanhSachPhongTheoLoaiPhong(MaLoaiPhong);
                    dtgvDanhSachPhong.DataSource = DSPhong;
                    dtgvDanhSachPhong.Columns["MaPhong"].HeaderText  = "Mã phòng";
                    dtgvDanhSachPhong.Columns["SoPhong"].HeaderText  = "Số phòng";
                    dtgvDanhSachPhong.Columns["MaLoaiPhong"].Visible = false;
                }
            }
        }