using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CY.IDAL;
using CY.Model;
using AbstractFactory;
using CY.IBaseDAL;
using CY.Infrastructure.DESEncrypt;
using CY.Infrastructure.Query;
namespace CY.BLL
{
///
/// 客户预付款记录的业务逻辑类
///
public class OA_AdvanceMoneyRecordBLL
{
IOA_AdvanceMoneyRecordDAL _IOA_AdvanceMoneyRecordDal = null;
///
/// 初始化构造
///
public OA_AdvanceMoneyRecordBLL()
{
//获取OA_AdvanceMoneyRecord DAL实现
_IOA_AdvanceMoneyRecordDal = Factory.GetDALByInterfaceName(DALInterface.IOA_AdvanceMoneyRecordDAL) as IOA_AdvanceMoneyRecordDAL;
}
///
/// 新增客户预付款记录
///
///
///
public bool InsertModel(CY.Model.OA_AdvanceMoneyRecord m_OA_AdvanceMoneyRecord)
{
try
{
return _IOA_AdvanceMoneyRecordDal.InserModel( m_OA_AdvanceMoneyRecord);
}
catch (Exception ex)
{
throw ex;
}
}
///
/// 删除客户预付款记录
///
///
///
public bool DeleteModel(CY.Model.OA_AdvanceMoneyRecord rType)
{
try
{
_IOA_AdvanceMoneyRecordDal.DeleteModel(rType);
}
catch (Exception ex)
{
throw ex;
}
return true;
}
///
/// 根据客户编号查询客户预付款记录分页列表
///
///
///
///
public IEnumerable GetModelPageListForCustomer(Pagination pa, Guid CustomerId,DateTime? beginTime, DateTime? endTime, string Money)
{
string Condition = " CustomerId ='" + CustomerId + "' and OperatTypeId = '预付款存入'";
if (beginTime.HasValue)
{
Condition += string.Format(" and CAST(LastUpdateTime AS DATE) >='{0}'", beginTime);
}
if (endTime.HasValue)
{
Condition += string.Format(" and CAST(LastUpdateTime AS DATE) <='{0}'", endTime);
}
if (!string.IsNullOrEmpty(Money))
{
Condition += string.Format(" and OperatMoney='{0}'", Money);
}
Query query = new Query();
IList criterias = new List()
{
new Criterion("", Condition),
new Criterion("orderBy"," LastUpdateTime DESC ")
};
query.Criteria = criterias;
return _IOA_AdvanceMoneyRecordDal.SelectModelPage(query, pa);
}
///
/// 根据客户编号查询客户预付款记录分页列表
///
///
///
///
public IEnumerable GetModelPageList(Pagination pa, Guid CustomerId)
{
string Condition = " CustomerId ='" + CustomerId + "'";
Query query = new Query();
IList criterias = new List()
{
new Criterion("", Condition),
new Criterion("orderBy"," LastUpdateTime DESC ")
};
query.Criteria = criterias;
return _IOA_AdvanceMoneyRecordDal.SelectModelPage(query, pa);
}
///
/// 预付款存入
///
///
///
///
///
///
public bool DepositsMoney(OA_FirmAccount m_OA_FirmAccount, OA_CorporateClients m_OA_CorporateClients, OA_FirmAccountRecord m_OA_FirmAccountRecord, OA_AdvanceMoneyRecord m_OA_AdvanceMoneyRecord)
{
return _IOA_AdvanceMoneyRecordDal.DepositsMoney(m_OA_FirmAccount, m_OA_CorporateClients, m_OA_FirmAccountRecord, m_OA_AdvanceMoneyRecord);
}
}
}