예제 #1
0
        private void NhanPhong_Click(object sender, EventArgs e)
        {
            Button btn = new Button();

            panelNP.Controls.Add(btn);
            panelDP.Hide();
            panelDV.Hide();
            panelHD.Hide();
            panelNP.Show();

            NP_CBMaPhieu.Hide();
            NP_CBNgay.Hide();
            NP_CBPhong.Hide();
            NP_CBMaKH.Hide();

            connectDatabase();
            SqlDataAdapter sqlDa = new SqlDataAdapter("SELECT * FROM LOAIPHONG", sqlCon);

            dtTable = new DataTable();
            sqlDa.Fill(dtTable);

            String ItemRowName = "";

            foreach (DataRow dr in dtTable.Rows)
            {
                if (dr["TENLOAI"].ToString() != ItemRowName)
                {
                    NP_LoaiPhong.Items.Add(dr["TENLOAI"]);
                }
                ItemRowName = dr["TENLOAI"].ToString();
            }


            sqlDa = new SqlDataAdapter("SELECT * FROM PHONG", sqlCon);

            dtTable = new DataTable();
            sqlDa.Fill(dtTable);

            ItemRowName = "";

            foreach (DataRow dr in dtTable.Rows)
            {
                if (dr["MAPHONG"].ToString() != ItemRowName)
                {
                    NP_Phong.Items.Add(dr["MAPHONG"]);
                }
                ItemRowName = dr["MAPHONG"].ToString();
            }

            sqlCon.Close();
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param Nhận Phòng="sender"></param>
        /// <param name="e"></param

        private bool NP_KiemTraDuLieu()
        {
            if (NP_NgayTra.Value <= DateTime.Now)
            {
                NP_CBNgay.Show();
                return(false);
            }
            else
            {
                NP_CBNgay.Hide();
            }

            if (NP_Phong.Text == "")
            {
                NP_CBPhong.Show();
                return(false);
            }
            else
            {
                NP_CBPhong.Hide();
            }

            if (NP_MaPhieu.Text == "")
            {
                NP_CBMaPhieu.Show();
                return(false);
            }
            else
            {
                NP_CBMaPhieu.Hide();
            }

            if (NP_MaKH.Text == "")
            {
                NP_CBMaKH.Show();
                return(false);
            }
            else
            {
                NP_CBMaPhieu.Hide();
            }
            return(true);
        }