コード例 #1
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            fRent f = new fRent(this);

            this.Hide();
            f.ShowDialog();
            this.Show();
        }
コード例 #2
0
        private void simpleButton1_Click(object sender, EventArgs e)

        {
            string maxCustorm = RoomDAO.Instance.getMaxCustorm();

            if (dtgvInputCustomes.Rows.Count > Int32.Parse(maxCustorm))
            {
                MessageBox.Show("Vượt số khách hàng cho phép!!!");
                this.Hide();
                fRent f = new fRent();
                f.ShowDialog();
            }
            else
            {
                try
                {
                    if (RoomDAO.Instance.checkStatusRoomisRent(getRoomCode()) == true)                                                  // nếu phòng có thể cho thuê thì trả về true
                    {
                        getInforCustomer();                                                                                             // tạo một danh sách đối tượng khách hàng thuê phòng
                        //MessageBox.Show(getRoomCode() + "    " + _formality + "    " + getBeginDay() + "    " + dtgvInputCustomes.Rows.Count.ToString());
                        RoomDAO.Instance.CreateTenancyCard(getRoomCode(), _formality, getBeginDay(), dtgvInputCustomes.Rows.Count - 1); //tao phieu thue phong
                        RoomDAO.Instance.CreateTenancyCardDetail(_customer, getRoomCode(), getBeginDay());                              //tao chitiet-thuephong

                        MessageBox.Show("Tạo phiếu thuê phòng thành công");
                        LoadListRoomAndCloseForm();
                    }
                    else   // phòng đang sửa chữa hoặc đang cho thuê
                    {
                        if (RoomDAO.Instance.checkStatusRoomisRenting(getRoomCode()) == true)
                        {
                            MessageBox.Show("Phòng này đang được cho thuê");
                        }
                        else
                        {
                            MessageBox.Show("Phòng này đang được sửa chữa");
                        }
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Dữ liệu sai định dạng!!!");
                }
            }
        }