示例#1
0
        private void DataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow dr = dataGridView1.CurrentRow;

            if (dr != null)
            {
                dr.Selected      = true;
                txtMaBan.Text    = dr.Cells[0].Value.ToString();
                numSucChua.Value = decimal.Parse(dr.Cells[1].Value.ToString());

                if (dr.Cells[2].Value.ToString() == "Đang Sử Dụng")
                {
                    btSua.Enabled = btXoa.Enabled = false;
                }
                else
                {
                    btSua.Enabled = btXoa.Enabled = true;
                }

                dataGridView2.DataSource            = Ban.Ctdb(txtMaBan.Text);
                dataGridView2.Columns[0].HeaderText = "Tên";
                dataGridView2.Columns[1].HeaderText = "Số Điện Thoại";
                dataGridView2.Columns[2].HeaderText = "Thời Gian";
                dataGridView2.Columns[3].HeaderText = "Số Người";

                btThem.Enabled = false;
            }
        }
示例#2
0
        public void TestCtdb()
        {
            string  maban     = "1";
            DataSet dsHienThi = new DataSet();

            string l = "select * from DatBan where MaBan = " + maban;

            strcon.Open();

            OleDbDataAdapter daShowData = new OleDbDataAdapter(l, strcon);

            daShowData.Fill(dsHienThi);

            daShowData.Dispose();

            strcon.Close();

            int expected = dsHienThi.Tables[0].Rows.Count;

            int actual = Ban.Ctdb(maban).Rows.Count;

            Assert.AreEqual(expected, actual);
        }