/** * OA_KaipiaoshenqingBLL.cs * * 功 能: 合作客户业务逻辑类 * 类 名: OA_KaipiaoshenqingBLL * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── * V0.01 2013-4-2 15:11 吴辉 初版 * V0.02 2013-5-29 17:43 吴崎均 增加转换在线会员为厂商客户方法 * * * * * * */ 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_KaipiaoshenqingBLL { IOA_KipiaoshenqingDAL _IOA_KaipiaoshenqingDAL = null; /// /// 初始化构造 /// public OA_KaipiaoshenqingBLL() { //获取OA_Kaipiaoshenqing DAL实现 _IOA_KaipiaoshenqingDAL = Factory.GetDALByInterfaceName(DALInterface.IOA_KipiaoshenqingDAL) as IOA_KipiaoshenqingDAL; } /// /// 新增送货安排 /// /// /// /// /// public bool InsertModel(CY.Model.OA_Kaipiaoshenqing m_OA_Kaipiaoshenqing) { try { return _IOA_KaipiaoshenqingDAL.InserModel(m_OA_Kaipiaoshenqing); } catch (Exception ex) { throw ex; } } /// /// 修改送货安排 /// /// /// public bool UpdateModel(CY.Model.OA_Kaipiaoshenqing m_OA_Kaipiaoshenqing) { try { return _IOA_KaipiaoshenqingDAL.UpdateModel(m_OA_Kaipiaoshenqing); } catch (Exception ex) { throw ex; } } /// /// 获取全部合作客户 /// /// 主键id /// public IEnumerable GetModelList() { Query query = new Query(); return _IOA_KaipiaoshenqingDAL.SelectAllModel(query); } /// /// 根据formid获得信息 /// /// 编号 /// public IEnumerable GetModelByformid(Guid formid) { return _IOA_KaipiaoshenqingDAL.GetModelByformid(formid); } /// /// 获取全部合作客户 /// /// 主键id /// public OA_Kaipiaoshenqing GetModelByKeyid(Guid? keyid) { return _IOA_KaipiaoshenqingDAL.GetModelByKeyid(keyid); } /// /// 删除合作客户 /// /// /// public bool DeleteModel(CY.Model.OA_Kaipiaoshenqing rType) { try { _IOA_KaipiaoshenqingDAL.DeleteModel(rType); } catch (Exception ex) { throw ex; } return true; } /// /// 查询合作客户分页列表 /// /// /// public IEnumerable SelectModelPage(Pagination pa, Guid FirmId, string CreateTimeStart, string CreateTimeEnd, string Kaipiaoshenqing, string Kehuqianshou, string BusinessManagerId, string CustormerName, string PayStates, string HuikuanStates) { string Condition = " and ok.FirmId ='" + FirmId + "' and ok.ApprovalStatus = 1 "; if (!string.IsNullOrEmpty(CreateTimeStart)) Condition += " and DATEDIFF(day,ok.[CreateTime],'" + CreateTimeStart + "')<=0 "; if (!string.IsNullOrEmpty(CreateTimeEnd)) Condition += " and DATEDIFF(day,ok.[CreateTime],'" + CreateTimeEnd + "')>=0 "; if (!string.IsNullOrEmpty(Kaipiaoshenqing)) Condition += " and ok.Kaipiaoshenqing = '" + Kaipiaoshenqing + "'"; if (!string.IsNullOrEmpty(Kehuqianshou)) Condition += " and ok.Kehuqianshou = '" + Kehuqianshou + "'"; if (!string.IsNullOrEmpty(BusinessManagerId)) Condition += " and ok.BusinessManagerId = '" + BusinessManagerId + "'"; if (!string.IsNullOrEmpty(CustormerName)) Condition += " and oe.CompanyName like '%" + CustormerName + "%'"; if (!string.IsNullOrEmpty(PayStates)) { if (PayStates == "2") { Condition += " and not EXISTS ( select eoe.[KaipiaoshenqingId] from [EC_OrderExtend] eoe inner join [EC_OrderBasic] eob on eob.Keyid = eoe.Keyid where ok.Keyid = eoe.[KaipiaoshenqingId] and eob.PayState !=-1 ) "; } else if (PayStates == "1") { Condition += " and EXISTS ( select eoe.[KaipiaoshenqingId] from [EC_OrderExtend] eoe inner join [EC_OrderBasic] eob on eob.Keyid = eoe.Keyid where ok.Keyid = eoe.[KaipiaoshenqingId] and eob.PayState !=-1 ) "; } } if (!string.IsNullOrEmpty(HuikuanStates)) { if (HuikuanStates == "2") { Condition += " and ok.Huikuanmoney >0 "; } else if (HuikuanStates == "1") { Condition += " and ( ok.Huikuanmoney is null or ok.Huikuanmoney <=0) "; } } Query query = new Query(); IList criterias = new List() { new Criterion("", Condition), new Criterion("orderBy"," CreateTime desc ") }; query.Criteria = criterias; return _IOA_KaipiaoshenqingDAL.SelectModelPage(query, pa); } } }