Exemplo n.º 1
0
        private void ToolStripCapNhat_Click(object sender, EventArgs e)
        {
            //Default();
            PhongData data = new PhongData();

            listViewEx1.Items.Clear();
            foreach (DataRow dr in data.LayMaPhong().Rows)
            {
                PhongInFo phong = new PhongInFo();
                phong.MaLoaiPhong    = (string)dr.ItemArray[1];
                phong.MaPhong        = (string)dr.ItemArray[0];
                phong.TinhTrangPhong = (int)dr.ItemArray[2];
                ListViewItem item = new ListViewItem(phong.MaPhong);

                if (phong.TinhTrangPhong == 1)
                {
                    item.ImageIndex = 0;
                }
                else if (phong.TinhTrangPhong == 2)
                {
                    item.ImageIndex = 1;
                }
                else
                {
                    item.ImageIndex = 2;
                }
                listViewEx1.Items.Add(item);
            }
        }
Exemplo n.º 2
0
        public void HienThi(TextBox txtMaPhong, ComboBox cmbMaLPhong, ComboBox cmbMaTTrPhong, TextBox txtGhiChu, DataGridView dg, BindingNavigator bn)
        {
            BindingSource bs = new BindingSource();

            bs.DataSource    = data.LayMaPhong();
            dg.DataSource    = bs;
            bn.BindingSource = bs;

            txtMaPhong.DataBindings.Clear();
            txtMaPhong.DataBindings.Add("Text", bs, "MaPhong");

            cmbMaLPhong.DataBindings.Clear();
            cmbMaLPhong.DataBindings.Add("SelectedValue", bs, "MaLoaiPhong");

            cmbMaTTrPhong.DataBindings.Clear();
            cmbMaTTrPhong.DataBindings.Add("SelectedValue", bs, "MaLoaiTinhTrangPhong");

            txtGhiChu.DataBindings.Clear();
            txtGhiChu.DataBindings.Add("Text", bs, "GhiChu");
        }
Exemplo n.º 3
0
        public QUANLYKHACHSAN.BusinessObject.PhongInFo LayMaPhong(string maphong)
        {
            PhongData        p   = new PhongData();
            LoaiPhongControl lp  = new LoaiPhongControl();
            DataTable        tbl = p.LayMaPhong(maphong);

            QUANLYKHACHSAN.BusinessObject.PhongInFo pif = null;
            pif = new QUANLYKHACHSAN.BusinessObject.PhongInFo();

            if (tbl.Rows.Count > 0)
            {
                pif.MaPhong     = Convert.ToString(tbl.Rows[0]["MaPhong"]);
                pif.MaLoaiPhong = Convert.ToString(tbl.Rows[0]["MaLoaiPhong"]);
                pif.GhiChu      = Convert.ToString(tbl.Rows[0]["GhiChu"]);
            }
            return(pif);
        }