Exemplo n.º 1
0
        public bool DeletePH(PhongHat ttPhongHat)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("delete from PhongHat where MaPH=@idPH", con);

            cmd.Parameters.AddWithValue("@idPH", ttPhongHat.maPH);
            cmd.ExecuteNonQuery();
            con.Close();
            return(true);
        }
Exemplo n.º 2
0
        public void UpdatePH(PhongHat ttPhongHat)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("update PhongHat set TenPH=@tenPH, TrangThai=@trangThai, NgayVao=@ngayVao, GioVao=@gioVao, GioRa=@gioRa  where MaPH=@idPH", con);

            cmd.Parameters.AddWithValue("@idPH", ttPhongHat.maPH);
            cmd.Parameters.AddWithValue("@tenPH", ttPhongHat.tenPH);
            cmd.Parameters.AddWithValue("@trangThai", ttPhongHat.trangThai);
            cmd.Parameters.AddWithValue("@ngayVao", ttPhongHat.ngayVao);
            cmd.Parameters.AddWithValue("@gioVao", ttPhongHat.gioVao);
            cmd.Parameters.AddWithValue("@gioRa", ttPhongHat.gioRa);
            cmd.ExecuteNonQuery();
            con.Close();
        }
Exemplo n.º 3
0
        // 12. bang phong hat
        public string InsertPH(PhongHat ttPhongHat)
        {
            string        Message;
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("insert into PhongHat(TenPH,TrangThai) values(@tenPH,@trangThai)", con);

            cmd.Parameters.AddWithValue("@tenPH", ttPhongHat.tenPH);
            cmd.Parameters.AddWithValue("@trangThai", ttPhongHat.trangThai);
            int result = cmd.ExecuteNonQuery();

            if (result == 1)
            {
                Message = "thong tin phong hat duoc them thanh cong";
            }
            else
            {
                Message = "thong tin phong hat them khong thanh cong";
            }
            con.Close();
            return(Message);
        }