1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CY.IDAL.Inquiry;
using AbstractFactory;
using CY.Model;
using CY.Model.Inquiry;
 
namespace CY.BLL.Inquiry
{
    /// <summary>
    /// 粘信封业务逻辑类
    /// </summary>
    public class StickEnvelopeCostBLL
    {
        IStickEnvelopeCostDAL _iStickEnvelopeCostDAL = null;
 
        public StickEnvelopeCostBLL()
        {
            _iStickEnvelopeCostDAL = Factory.GetDALByInterfaceName(DALInterface.IStickEnvelopeCostDAL) as IStickEnvelopeCostDAL;
        }
 
        /// <summary>
        /// 获取粘信封价格列表
        /// </summary>
        /// <param name="firmId"></param>
        /// <param name="customerId"></param>
        /// <returns></returns>
        public IList<Inquiry_StickEnvelopeCost> GetModelList(Guid inquiryId, int printingTyId, int afterParameterId)
        {
            return _iStickEnvelopeCostDAL.GetModelList(inquiryId, printingTyId, afterParameterId);
        }
 
        /// <summary>
        /// 保存粘信封价格列表
        /// </summary>
        /// <param name="list"></param>
        /// <param name="firmId"></param>
        /// <param name="customerId"></param>
        /// <returns></returns>
        public bool SaveModelList(IList<Inquiry_StickEnvelopeCost> list, InquiryCondition inquiryCondition, int printingTyId)
        {
            return _iStickEnvelopeCostDAL.SaveModelList(list, inquiryCondition, printingTyId);
        }
 
        /// <summary>
        /// 获取粘信封
        /// </summary>
        /// <param name="printingTyId"></param>
        /// <param name="pageSizeValue"></param>
        /// <param name="inquiryId"></param>
        /// <returns></returns>
        public Inquiry_StickEnvelopeCost GetModel(int printingTyId, int envelopeModeTypeId, int afterParameterId, Guid inquiryId)
        {
            IList<Inquiry_StickEnvelopeCost> list = GetModelList(inquiryId, printingTyId, afterParameterId);
            Inquiry_StickEnvelopeCost model = list.Single<Inquiry_StickEnvelopeCost>(p => p.EnvelopeModeTypeId == envelopeModeTypeId) as Inquiry_StickEnvelopeCost;
            return model;
        }
 
        /// <summary>
        /// 获取粘信封价格
        /// </summary>
        /// <param name="printingTyId"></param>
        /// <param name="pageSizeValue"></param>
        /// <param name="inquiryId"></param>
        /// <returns></returns>
        public decimal GetStickEnvelopePrice(int printingTyId, int envelopeModeTypeId, int printCount, int afterParameterId, Guid inquiryId)
        {
            decimal price = 0;
            Inquiry_StickEnvelopeCost model = GetModel(printingTyId, envelopeModeTypeId,afterParameterId, inquiryId);
            price = model.Price * printCount;
            if (price <= model.StartPrice)
                price = model.StartPrice;
            return price;
        }
    }
}