Example #1
0
        public bool DeleteLoaiDV(LoaiDichVu ttLoaiDV)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("delete from LoaiDichVu where MaLoaiDV=@idLoaiDV", con);

            cmd.Parameters.AddWithValue("@idLoaiDV", ttLoaiDV.maLoaiDV);
            cmd.ExecuteNonQuery();
            con.Close();
            return(true);
        }
Example #2
0
        public void UpdateLoaiDV(LoaiDichVu ttLoaiDV)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("update LoaiDichVu set TenLoaiDV=@tenLoaiDV, LoaiDV=@loaiDV where MaLoaiDV=@idLoaiDV", con);

            cmd.Parameters.AddWithValue("@idLoaiDV", ttLoaiDV.maLoaiDV);
            cmd.Parameters.AddWithValue("@tenLoaiDV", ttLoaiDV.tenLoaiDV);
            cmd.Parameters.AddWithValue("@loaiDV", ttLoaiDV.loaiDV);
            cmd.ExecuteNonQuery();
            con.Close();
        }
Example #3
0
        // 4. bang loai dich vu
        public string InsertLoaiDV(LoaiDichVu ttLoaiDV)
        {
            string        Message;
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("insert into LoaiDichVu(TenLoaiDV,LoaiDV) values(@tenLoaiDV,@loaiDV)", con);

            cmd.Parameters.AddWithValue("@tenLoaiDV", ttLoaiDV.tenLoaiDV);
            cmd.Parameters.AddWithValue("@loaiDV", ttLoaiDV.loaiDV);
            int result = cmd.ExecuteNonQuery();

            if (result == 1)
            {
                Message = ttLoaiDV.tenLoaiDV + "them thanh cong";
            }
            else
            {
                Message = ttLoaiDV.tenLoaiDV + "them khong thanh cong";
            }
            con.Close();
            return(Message);
        }