using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Models;
using System.Data.SqlClient;
using System.Data;
namespace DAL
{
///
/// 机票预订费用多表联查数据访问类
///
public class ViewAirTicketReservationsPayService
{
///
/// 查询所有
///
/// sql语句
/// 可变参数数组
/// 返回集合
List excuteSql(string sql, params SqlParameter[] param)
{
return ServiceBase.excuteSql(new ViewAirTicketReservationsPay(), "ViewAirTicketReservationsPay", sql, CommandType.Text, param);
}
///
/// 获取单个对象
///
/// sql语句
/// 可变参数数组
/// 返回空或者单个对象
ViewAirTicketReservationsPay excuteType(string sql, params SqlParameter[] param)
{
//查询结果放入对象集合
List ctggdList = excuteSql(sql, param);
//判断集合是否为空
if (ctggdList == null || ctggdList.Count == 0)
//返回null
return null;
//返回单个对象
return ctggdList[0];
}
///
/// 根据编号查询对象信息
///
/// 对象编号
/// 返回空或者单个对象信息
public ViewAirTicketReservationsPay GetViewAirTicketReservationsPayByID(int id)
{
//调用获取单个对象的方法
return excuteType("select * from ViewAirTicketReservationsPay where Id = @id and IsDel = 0", new SqlParameter("@id", id));
}
///
/// 获取全部
///
///
public List GetAll()
{
return excuteSql("select * from ViewAirTicketReservationsPay where IsDel = 0");
}
///
/// 查询已审核数据
///
/// 对象编号
/// 返回空或者对象信息
public List GetByDIId(int DIId)
{
return excuteSql("select (select Name from SetData where Id=ccp.CTDId) as CarType,ccp.IsMatchCreditCard,atr.FlightsDescription,ccp.Operator,ccp.AuditGMDate,sd1.name as PaydName,ccp.OrbitalPrivateTransfer,ccp.PayDid,ccp.payee,ccp.ispay,atr.OperatorDate,"
+ "atr.FlightsCode,atr.FlightsCity,atr.FlightsDate,atr.FlightsTime,atr.ClientName,sd.[Name],ccp.PayMoney as Spread,ccp.RMBprice,ccp.dayRate,atr.PriceDescription,atr.Price,"
+ "ccp.consumptionDate,sd4.Name as CType,sd3.Name+sd3.Remark as CTDId,atr.ArrivedTime,atr.PrePrice,atr.ClientNum from AirTicketReservations atr "
+ "join CreditCardPayment ccp on ccp.Diid = atr.Diid and ccp.Cid = atr.Id join SetData sd on sd.Id =ccp.PaymentCurrency join setdata sd1 on sd1.id=ccp.PayDid "
+ "join setdata sd3 on sd3.id=ccp.CTDId join setdata sd4 on sd4.Id=atr.CType where atr.DIID = @DIId and atr.IsDel = 0 and ccp.CTable = 85 and ccp.isDel=0 and ccp.IsAuditGM =1 or ccp.IsAuditGM=3 and ccp.IsPay=1 order by atr.FlightsDate", new SqlParameter("@DIId", DIId));
}
///
/// 查询未审核及已审核的所有数据
///
/// 对象编号
/// 返回空或者对象信息
public List GetByDIIdandWSH(int DIId)
{
return excuteSql("select atr.FlightsDescription,ccp.Operator,ccp.AuditGMDate,sd1.name as PaydName,ccp.OrbitalPrivateTransfer,ccp.PayDid,ccp.payee,ccp.ispay,atr.OperatorDate,"
+ "atr.FlightsCode,atr.FlightsCity,atr.FlightsDate,atr.FlightsTime,atr.ClientName,sd.[Name],ccp.PayMoney as Spread,ccp.RMBprice,ccp.dayRate,atr.PriceDescription,atr.Price,"
+ "ccp.consumptionDate,sd4.Name as CType,sd3.Name+sd3.Remark as CTDId,atr.ArrivedTime,atr.PrePrice,atr.ClientNum,ccp.IsMatchCreditCard from AirTicketReservations atr "
+ "join CreditCardPayment ccp on ccp.Diid = atr.Diid and ccp.Cid = atr.Id join SetData sd on sd.Id =ccp.PaymentCurrency join setdata sd1 on sd1.id=ccp.PayDid "
+ "join setdata sd3 on sd3.id=ccp.CTDId join setdata sd4 on sd4.Id=atr.CType where atr.DIID = @DIId and atr.IsDel = 0 and ccp.CTable = 85 and ccp.isDel=0 order by atr.FlightsDate asc ,atr.flightsTime asc", new SqlParameter("@DIId", DIId));
}
}
}