ViewbreakfastPriceService.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data.SqlClient;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace DAL
  10. {
  11. public class ViewbreakfastPriceService
  12. {
  13. /// <summary>
  14. /// 查询所有
  15. /// </summary>
  16. /// <param name="sql">sql语句</param>
  17. /// <param name="param">可变参数数组</param>
  18. /// <returns>返回集合</returns>
  19. List<ViewbreakfastPrice> excuteSql(string sql, params SqlParameter[] param)
  20. {
  21. return ServiceBase<ViewbreakfastPrice>.excuteSql(new ViewbreakfastPrice(), "ViewbreakfastPrice", sql, CommandType.Text, param);
  22. }
  23. /// <summary>
  24. /// 获取单个对象
  25. /// </summary>
  26. /// <param name="sql">sql语句</param>
  27. /// <param name="param">可变参数数组</param>
  28. /// <returns>返回空或者单个对象</returns>
  29. ViewbreakfastPrice excuteType(string sql, params SqlParameter[] param)
  30. {
  31. //查询结果放入对象集合
  32. List<ViewbreakfastPrice> ctggdList = excuteSql(sql, param);
  33. //判断集合是否为空
  34. if (ctggdList == null || ctggdList.Count == 0)
  35. //返回null
  36. return null;
  37. //返回单个对象
  38. return ctggdList[0];
  39. }
  40. public List<ViewbreakfastPrice> GetAll(int diid)
  41. {
  42. string sql = $@" select a.breakfastPrice,b.PayMoney, c.HotelName,b.PaymentCurrency,c.City,d.Name as PayCurrencyName,b.DayRate,b.RMBPrice
  43. from hotelidbreakfast a inner join CreditCardPayment b on a.diid = b.diid and a.tid = b.cid inner join HotelReservations c on a.hotelid = c.id
  44. inner join SetData d on b.PaymentCurrency = d.Id
  45. where a.isdel = 0 and b.isdel = 0 and a.diid = {diid} And d.STid = 13 and d.Name <> '其他款项' and a.breakfastPrice > 0 ";
  46. return excuteSql(sql);
  47. }
  48. }
  49. }