123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data.SqlClient;
- using System.Data;
- using Models;
- namespace DAL
- {
- /// <summary>
- /// 我的酒店预订多表联查数据访问类
- /// </summary>
- public class ViewMyHotelReservationsService
- {
- /// <summary>
- /// 查询所有
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- List<ViewMyHotelReservations> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<ViewMyHotelReservations>.excuteSql(new ViewMyHotelReservations(), "ViewMyHotelReservations", sql, CommandType.Text, param);
- }
- /// <summary>
- /// 获取单个对象
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回空或者单个对象</returns>
- ViewMyHotelReservations excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<ViewMyHotelReservations> ctggdList = excuteSql(sql, param);
- //判断集合是否为空
- if (ctggdList == null || ctggdList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return ctggdList[0];
- }
- /// <summary>
- /// 根据编号查询对象信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <returns>返回空或者对象信息</returns>
- public List<ViewMyHotelReservations> GetByDIId(int DIId, string arrayUsersId)
- {
- //调用获取单个对象的方法
- return excuteSql("select hr.City,hr.HotelName,(hr.CheckInDate + '~' + hr.CheckOutDate) as Date,convert(decimal(18,2),(hr.SingleRoomPrice * hr.SingleRoomCount + hr.DoubleRoomPrice * hr.DoubleRoomCount + hr.SuiteRoomPrice * hr.SuiteRoomCount + hr.OtherRoomPrice * hr.OtherRoomCount + hr.Commission)) as moneys,hr.RoomExplanation,ccp.Consumptionpatterns,sd2.[Name],ccp.BankNo,convert(decimal(18,2),ccp.PayMoney) as PayMoney, sd.[Name] as payName, ('单间:' + convert(varchar(200),hr.SingleRoomCount) + '*'+ convert(varchar(200),convert(decimal(18,2),hr.SingleRoomPrice)) + ' 双间:'+ convert(varchar(200),hr.DoubleRoomCount) + '*'+ convert(varchar(200),convert(decimal(18,2),hr.DoubleRoomPrice)) + ' 套房:' +convert(varchar(200),hr.SuiteRoomCount) + '*' + convert(varchar(200),convert(decimal(18,2),hr.SuiteRoomPrice)) + ' 其他:' + convert(varchar(200),hr.OtherRoomCount)+ '*' +convert(varchar(200),convert(decimal(18,2),hr.OtherRoomPrice)) + ' 佣金:' + convert(varchar(200),convert(decimal(18,2),hr.Commission)))as Remark,datediff(DD,checkindate,checkoutdate) * convert(decimal(18,2),(hr.SingleRoomPrice * hr.SingleRoomCount + hr.DoubleRoomPrice * hr.DoubleRoomCount + hr.SuiteRoomPrice * hr.SuiteRoomCount + hr.OtherRoomPrice * hr.OtherRoomCount + hr.Commission)) as PayMoneys ,hr.BudgetCurrency as BudgetCurrency ,(sd3.Name)as BookingWebsite,ccp.ConsumptionDate as PayTime,hr.CardPrice from HotelReservations hr join CreditCardPayment ccp on ccp.Diid = hr.Diid and ccp.Cid = hr.Id join SetData sd on sd.Id =ccp.PaymentCurrency join SetData sd2 on sd2.id = ccp.payDID join SetData sd3 on sd3.id = hr.ReservationsWebsite where hr.DIID = @Diid and hr.IsDel = 0 and ccp.CTable = 76 and hr.Operator in (21) order by CheckInDate asc", new SqlParameter("@DIId", DIId));
- }
- }
- }
|