Exemple #1
0
        void ThemPhong()
        {
            tblPhong dd = new tblPhong();

            if (dgvPhong.Rows.Count <= 1)
            {
                dd.IDPhong = 1;
            }
            else
            {
                dd.IDPhong = db.tblPhongs.Select(n => n.IDPhong).Max() + 1;
            }
            dd.SucChua  = int.Parse(txtSucChua.Text);
            dd.GiaPhong = int.Parse(txtGiaPhong.Text);
            if (ckTrangThai.Checked == true)
            {
                dd.TrangThai = "Đã Thuê";
            }
            else
            {
                dd.TrangThai = null;
            }
            db.tblPhongs.InsertOnSubmit(dd);
            db.SubmitChanges();
        }
Exemple #2
0
        void XoaPhong()
        {
            tblPhong dd = db.tblPhongs.Where(n => n.IDPhong == int.Parse(txtIDPhong.Text)).First();

            db.tblPhongs.DeleteOnSubmit(dd);
            db.SubmitChanges();
        }
Exemple #3
0
        void SuaPhong()
        {
            tblPhong dd = db.tblPhongs.Where(n => n.IDPhong == int.Parse(txtIDPhong.Text)).First();

            dd.SucChua  = int.Parse(txtSucChua.Text);
            dd.GiaPhong = int.Parse(txtGiaPhong.Text);
            if (ckTrangThai.Checked == true)
            {
                dd.TrangThai = "Đã Thuê";
            }
            else
            {
                dd.TrangThai = null;
            }
            db.SubmitChanges();
        }
Exemple #4
0
 partial void DeletetblPhong(tblPhong instance);
Exemple #5
0
 partial void UpdatetblPhong(tblPhong instance);
Exemple #6
0
 partial void InserttblPhong(tblPhong instance);