using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Models;
namespace DAL
{
///
/// 我的酒店预订多表联查数据访问类
///
public class ViewMyHotelReservationsService
{
///
/// 查询所有
///
/// sql语句
/// 可变参数数组
/// 返回集合
List excuteSql(string sql, params SqlParameter[] param)
{
return ServiceBase.excuteSql(new ViewMyHotelReservations(), "ViewMyHotelReservations", sql, CommandType.Text, param);
}
///
/// 获取单个对象
///
/// sql语句
/// 可变参数数组
/// 返回空或者单个对象
ViewMyHotelReservations excuteType(string sql, params SqlParameter[] param)
{
//查询结果放入对象集合
List ctggdList = excuteSql(sql, param);
//判断集合是否为空
if (ctggdList == null || ctggdList.Count == 0)
//返回null
return null;
//返回单个对象
return ctggdList[0];
}
///
/// 根据编号查询对象信息
///
/// 对象编号
/// 返回空或者对象信息
public List 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));
}
}
}