Ejemplo n.º 1
0
        // 6. bang chi tiet dich vu
        public string InsertCTDV(CTDV ttCTDV)
        {
            string        Message;
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("insert into CTDichVu(MaDV,MaPH,DonGia,SoLuong) values(@idDV,@maPH,@donGia,@soLuong)", con);

            cmd.Parameters.AddWithValue("@idDV", ttCTDV.maDV);
            cmd.Parameters.AddWithValue("@maPH", ttCTDV.maPH);
            cmd.Parameters.AddWithValue("@donGia", ttCTDV.donGia);
            cmd.Parameters.AddWithValue("@soLuong", ttCTDV.soLuong);
            int result = cmd.ExecuteNonQuery();

            if (result == 1)
            {
                Message = "dich vu co ma la " + ttCTDV.maDV + " duoc them thanh cong";
            }
            else
            {
                Message = "dich vu co ma la " + ttCTDV.maDV + " them khong thanh cong";
            }
            con.Close();
            return(Message);
        }
Ejemplo n.º 2
0
        public bool DeleteCTDV(CTDV ttCTDV)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("delete from CTDichVu where MaDV=@idDV and MaPH=@idPH", con);

            cmd.Parameters.AddWithValue("@idDV", ttCTDV.maDV);
            cmd.Parameters.AddWithValue("@idPH", ttCTDV.maPH);
            cmd.ExecuteNonQuery();
            con.Close();
            return(true);
        }
Ejemplo n.º 3
0
        public void UpdateCTDV(CTDV ttCTDV)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("update CTDichVu set DonGia=@donGia, SoLuong=@soLuong  where  MaPH=@maPH and MaDV=@idDV", con);

            cmd.Parameters.AddWithValue("@idDV", ttCTDV.maDV);
            cmd.Parameters.AddWithValue("@maPH", ttCTDV.maPH);
            cmd.Parameters.AddWithValue("@donGia", ttCTDV.donGia);
            cmd.Parameters.AddWithValue("@soLuong", ttCTDV.soLuong);
            cmd.ExecuteNonQuery();
            con.Close();
        }